diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index b0bef69e..40debd28 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -295,7 +295,11 @@ static iBool tabSwitcher_(iWidget *tabs, const char *cmd) { | |||
295 | iWidget *makeTabs_Widget(iWidget *parent) { | 295 | iWidget *makeTabs_Widget(iWidget *parent) { |
296 | iWidget *tabs = makeVDiv_Widget(); | 296 | iWidget *tabs = makeVDiv_Widget(); |
297 | iWidget *buttons = addChild_Widget(tabs, iClob(new_Widget())); | 297 | iWidget *buttons = addChild_Widget(tabs, iClob(new_Widget())); |
298 | setFlags_Widget(buttons, arrangeHorizontal_WidgetFlag | arrangeHeight_WidgetFlag, iTrue); | 298 | buttons->rect.size.y = 2 * gap_UI + lineHeight_Text(default_FontId); |
299 | setFlags_Widget(buttons, | ||
300 | resizeChildren_WidgetFlag | arrangeHorizontal_WidgetFlag | | ||
301 | fixedHeight_WidgetFlag, | ||
302 | iTrue); | ||
299 | setId_Widget(buttons, "tabs.buttons"); | 303 | setId_Widget(buttons, "tabs.buttons"); |
300 | iWidget *pages = addChildFlags_Widget( | 304 | iWidget *pages = addChildFlags_Widget( |
301 | tabs, iClob(new_Widget()), expand_WidgetFlag | resizeChildren_WidgetFlag); | 305 | tabs, iClob(new_Widget()), expand_WidgetFlag | resizeChildren_WidgetFlag); |
@@ -313,7 +317,7 @@ static void addTabPage_Widget_(iWidget *tabs, enum iWidgetAddPos addPos, iWidget | |||
313 | findChild_Widget(tabs, "tabs.buttons"), | 317 | findChild_Widget(tabs, "tabs.buttons"), |
314 | iClob(new_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))), | 318 | iClob(new_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))), |
315 | addPos); | 319 | addPos); |
316 | setFlags_Widget(button, selected_WidgetFlag, isSel); | 320 | setFlags_Widget(button, selected_WidgetFlag | expand_WidgetFlag, isSel); |
317 | addChildPos_Widget(pages, page, addPos); | 321 | addChildPos_Widget(pages, page, addPos); |
318 | setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel); | 322 | setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel); |
319 | } | 323 | } |
@@ -385,6 +389,11 @@ void setTabPageLabel_Widget(iWidget *tabs, const iAnyObject *page, const iString | |||
385 | arrange_Widget(tabs); | 389 | arrange_Widget(tabs); |
386 | } | 390 | } |
387 | 391 | ||
392 | size_t tabPageIndex_Widget(const iWidget *tabs, const iAnyObject *page) { | ||
393 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); | ||
394 | return childIndex_Widget(pages, page); | ||
395 | } | ||
396 | |||
388 | const iWidget *currentTabPage_Widget(const iWidget *tabs) { | 397 | const iWidget *currentTabPage_Widget(const iWidget *tabs) { |
389 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); | 398 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); |
390 | iConstForEach(ObjectList, i, pages->children) { | 399 | iConstForEach(ObjectList, i, pages->children) { |
@@ -396,7 +405,7 @@ const iWidget *currentTabPage_Widget(const iWidget *tabs) { | |||
396 | } | 405 | } |
397 | 406 | ||
398 | size_t tabCount_Widget(const iWidget *tabs) { | 407 | size_t tabCount_Widget(const iWidget *tabs) { |
399 | return childCount_Widget(findChild_Widget(tabs, "tabs.buttons")); | 408 | return childCount_Widget(findChild_Widget(tabs, "tabs.pages")); |
400 | } | 409 | } |
401 | 410 | ||
402 | /*-----------------------------------------------------------------------------------------------*/ | 411 | /*-----------------------------------------------------------------------------------------------*/ |