summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-04-07 20:07:15 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-04-07 20:07:15 (GMT)
commit32acb2810ec1c33b9ed9851c6432292a15725e2f (patch)
tree1070a3bc3de5e247144d47b5108bac2064ccb965
parent29e7efeba03bc79da5f7b87455ddadac7ba8871e (diff)
parent0df0b52efea0f84d37f058d5eb5034a1bbc3151a (diff)
downloadtk-32acb2810ec1c33b9ed9851c6432292a15725e2f.zip
tk-32acb2810ec1c33b9ed9851c6432292a15725e2f.tar.gz
tk-32acb2810ec1c33b9ed9851c6432292a15725e2f.tar.bz2
Fix [2912962fff]: Notebook does not set TTK_STATE_USER1 and TTK_STATE_USER2.
-rw-r--r--generic/ttk/ttkNotebook.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index b649e4b..06aa275 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -289,13 +289,14 @@ static void ActivateTab(Notebook *nb, int index)
* TabState --
* Return the state of the specified tab, based on
* notebook state, currentIndex, activeIndex, and user-specified tab state.
- * The USER1 bit is set for the leftmost tab, and USER2
- * is set for the rightmost tab.
+ * The USER1 bit is set for the leftmost visible tab, and USER2
+ * is set for the rightmost visible tab.
*/
static Ttk_State TabState(Notebook *nb, int index)
{
Ttk_State state = nb->core.state;
Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index);
+ int i = 0;
if (index == nb->notebook.currentIndex) {
state |= TTK_STATE_SELECTED;
@@ -306,11 +307,25 @@ static Ttk_State TabState(Notebook *nb, int index)
if (index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
- if (index == 0) {
- state |= TTK_STATE_USER1;
+ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ if (tab->state == TAB_STATE_HIDDEN) {
+ continue;
+ }
+ if (index == i) {
+ state |= TTK_STATE_USER1;
+ }
+ break;
}
- if (index == Ttk_NumberSlaves(nb->notebook.mgr) - 1) {
- state |= TTK_STATE_USER2;
+ for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) {
+ Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i);
+ if (tab->state == TAB_STATE_HIDDEN) {
+ continue;
+ }
+ if (index == i) {
+ state |= TTK_STATE_USER2;
+ }
+ break;
}
if (tab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;