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 | 1f5e343c59ab93c9a00512ebd0e6e1d71b531a0c (patch) | |
tree | a90beb6e42a91052907a0db7470755125d3c95f7 /generic/ttk | |
parent | 4a56670621d64417b4a557a1fd2cedc16656cf6c (diff) | |
parent | 914ca2a804f2d3e32ab2da849bf5070166803b48 (diff) | |
download | tk-1f5e343c59ab93c9a00512ebd0e6e1d71b531a0c.zip tk-1f5e343c59ab93c9a00512ebd0e6e1d71b531a0c.tar.gz tk-1f5e343c59ab93c9a00512ebd0e6e1d71b531a0c.tar.bz2 |
Fix [2912962fff]: Notebook does not set TTK_STATE_USER1 and TTK_STATE_USER2.
Diffstat (limited to 'generic/ttk')
-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; |