Attachment "TabState.c" to
ticket [2912962f]
added by
decosterjos
2009-12-12 05:09:49.
/*
* 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.
*/
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;
} else {
state &= ~TTK_STATE_FOCUS;
}
if (index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
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;
}
if (tab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;
}
return state;
}