summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-04-07 20:06:57 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-04-07 20:06:57 (GMT)
commit0df0b52efea0f84d37f058d5eb5034a1bbc3151a (patch)
treea90beb6e42a91052907a0db7470755125d3c95f7 /generic
parent992f234a040bd34bbcf4ca73c6eed2d2345685d8 (diff)
parent0b70616ba05255d0d81b5e4aac59becde0787af7 (diff)
downloadtk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.zip
tk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.tar.gz
tk-0df0b52efea0f84d37f058d5eb5034a1bbc3151a.tar.bz2
Fix [2912962fff]: Notebook does not set TTK_STATE_USER1 and TTK_STATE_USER2.
Diffstat (limited to 'generic')
-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;