diff options
author | fvogel <fvogelnew1@free.fr> | 2017-04-07 20:06:57 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2017-04-07 20:06:57 (GMT) |
commit | 0df0b52efea0f84d37f058d5eb5034a1bbc3151a (patch) | |
tree | a90beb6e42a91052907a0db7470755125d3c95f7 | |
parent | 992f234a040bd34bbcf4ca73c6eed2d2345685d8 (diff) | |
parent | 0b70616ba05255d0d81b5e4aac59becde0787af7 (diff) | |
download | tk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.zip tk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.tar.gz tk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.tar.bz2 |
Fix [2912962fff]: Notebook does not set TTK_STATE_USER1 and TTK_STATE_USER2.
-rw-r--r-- | generic/ttk/ttkNotebook.c | 27 |
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; |