diff options
-rw-r--r-- | src/ui/util.c | 18 | ||||
-rw-r--r-- | src/ui/util.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 8a174393..a68d340d 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -340,6 +340,18 @@ iWidget *removeTabPage_Widget(iWidget *tabs, size_t index) { | |||
340 | return page; | 340 | return page; |
341 | } | 341 | } |
342 | 342 | ||
343 | iLabelWidget *tabButtonForPage_Widget_(iWidget *tabs, const iWidget *page) { | ||
344 | iWidget *buttons = findChild_Widget(tabs, "tabs.buttons"); | ||
345 | iForEach(ObjectList, i, buttons->children) { | ||
346 | iAssert(isInstance_Object(i.object, &Class_LabelWidget)); | ||
347 | iAny *label = i.object; | ||
348 | if (pointerLabel_Command(cstr_String(command_LabelWidget(label)), "page") == page) { | ||
349 | return label; | ||
350 | } | ||
351 | } | ||
352 | return NULL; | ||
353 | } | ||
354 | |||
343 | void showTabPage_Widget(iWidget *tabs, const iWidget *page) { | 355 | void showTabPage_Widget(iWidget *tabs, const iWidget *page) { |
344 | /* Select the corresponding button. */ { | 356 | /* Select the corresponding button. */ { |
345 | iWidget *buttons = findChild_Widget(tabs, "tabs.buttons"); | 357 | iWidget *buttons = findChild_Widget(tabs, "tabs.buttons"); |
@@ -364,6 +376,12 @@ void showTabPage_Widget(iWidget *tabs, const iWidget *page) { | |||
364 | } | 376 | } |
365 | } | 377 | } |
366 | 378 | ||
379 | void setTabPageLabel_Widget(iWidget *tabs, const iAnyObject *page, const iString *label) { | ||
380 | iLabelWidget *button = tabButtonForPage_Widget_(tabs, page); | ||
381 | setText_LabelWidget(button, label); | ||
382 | arrange_Widget(tabs); | ||
383 | } | ||
384 | |||
367 | const iWidget *currentTabPage_Widget(const iWidget *tabs) { | 385 | const iWidget *currentTabPage_Widget(const iWidget *tabs) { |
368 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); | 386 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); |
369 | iConstForEach(ObjectList, i, pages->children) { | 387 | iConstForEach(ObjectList, i, pages->children) { |
diff --git a/src/ui/util.h b/src/ui/util.h index a23f84c1..1f35b8e8 100644 --- a/src/ui/util.h +++ b/src/ui/util.h | |||
@@ -100,6 +100,7 @@ void prependTabPage_Widget (iWidget *tabs, iWidget *page, const char *l | |||
100 | iWidget * tabPage_Widget (iWidget *tabs, size_t index); | 100 | iWidget * tabPage_Widget (iWidget *tabs, size_t index); |
101 | iWidget * removeTabPage_Widget (iWidget *tabs, size_t index); /* returns the page */ | 101 | iWidget * removeTabPage_Widget (iWidget *tabs, size_t index); /* returns the page */ |
102 | void showTabPage_Widget (iWidget *tabs, const iWidget *page); | 102 | void showTabPage_Widget (iWidget *tabs, const iWidget *page); |
103 | void setTabPageLabel_Widget (iWidget *tabs, const iAnyObject *page, const iString *label); | ||
103 | const iWidget *currentTabPage_Widget(const iWidget *tabs); | 104 | const iWidget *currentTabPage_Widget(const iWidget *tabs); |
104 | size_t tabCount_Widget (const iWidget *tabs); | 105 | size_t tabCount_Widget (const iWidget *tabs); |
105 | 106 | ||