void iupTabsCheckCurrentTab(Ihandle* ih, int pos, int removed) { int cur_pos = iupdrvTabsGetCurrentTab(ih); if (cur_pos == pos) { int p; /* if given tab is the current tab, then the current tab must be changed to a visible tab */ Ihandle* child; /* this function is called after the child has being removed from the hierarchy, but before the system tab being removed. */ p = 0; if (removed && p == pos) p++; for (child = ih->firstchild; child; child = child->brother) { if (p != pos && iupdrvTabsIsTabVisible(child, p)) { iupdrvTabsSetCurrentTab(ih, p); return; } p++; if (removed && p == pos) p++; /* increment twice to compensate for child already removed */ } } }
char* iupTabsGetTabVisibleAttrib(Ihandle* ih, int pos) { Ihandle* child = IupGetChild(ih, pos); if (child) return iupStrReturnBoolean(iupdrvTabsIsTabVisible(child, pos)); else return NULL; }
static void iTabsSetTab(Ihandle* ih, Ihandle* child, int pos) { if (ih->handle) { int cur_pos = iupdrvTabsGetCurrentTab(ih); if (cur_pos != pos && iupdrvTabsIsTabVisible(child, pos)) iupdrvTabsSetCurrentTab(ih, pos); } else iupAttribSet(ih, "_IUPTABS_VALUE_HANDLE", (char*)child); }
void iupTabsCheckCurrentTab(Ihandle* ih, int pos) { int cur_pos = iupdrvTabsGetCurrentTab(ih); if (cur_pos == pos) { Ihandle* child; for (pos = 0, child = ih->firstchild; child; child = child->brother, pos++) { if (pos != cur_pos && iupdrvTabsIsTabVisible(child)) { iupdrvTabsSetCurrentTab(ih, pos); return; } } } }