summaryrefslogtreecommitdiff
path: root/src/ui/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/util.c')
-rw-r--r--src/ui/util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 9ac1913d..5868e9d7 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -195,6 +195,8 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) {
195 195
196void openMenu_Widget(iWidget *d, iInt2 coord) { 196void openMenu_Widget(iWidget *d, iInt2 coord) {
197 /* Menu closes when commands are emitted, so handle any pending ones beforehand. */ 197 /* Menu closes when commands are emitted, so handle any pending ones beforehand. */
198 postCommand_App("cancel"); /* dismiss any other menus */
199 processEvents_App(postedEventsOnly_AppEventMode);
198 setFlags_Widget(d, hidden_WidgetFlag, iFalse); 200 setFlags_Widget(d, hidden_WidgetFlag, iFalse);
199 arrange_Widget(d); 201 arrange_Widget(d);
200 d->rect.pos = coord; 202 d->rect.pos = coord;
@@ -318,7 +320,7 @@ static void addTabPage_Widget_(iWidget *tabs, enum iWidgetAddPos addPos, iWidget
318 iClob(new_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))), 320 iClob(new_LabelWidget(label, key, kmods, format_CStr("tabs.switch page:%p", page))),
319 addPos); 321 addPos);
320 setFlags_Widget(button, selected_WidgetFlag, isSel); 322 setFlags_Widget(button, selected_WidgetFlag, isSel);
321 setFlags_Widget(button, expand_WidgetFlag, iTrue); 323 setFlags_Widget(button, commandOnClick_WidgetFlag | expand_WidgetFlag, iTrue);
322 addChildPos_Widget(pages, page, addPos); 324 addChildPos_Widget(pages, page, addPos);
323 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel); 325 setFlags_Widget(page, hidden_WidgetFlag | disabled_WidgetFlag, !isSel);
324} 326}
@@ -388,6 +390,10 @@ iLabelWidget *tabPageButton_Widget(iWidget *tabs, const iAnyObject *page) {
388 return tabButtonForPage_Widget_(tabs, page); 390 return tabButtonForPage_Widget_(tabs, page);
389} 391}
390 392
393iBool isTabButton_Widget(const iWidget *d) {
394 return d->parent && cmp_String(id_Widget(d->parent), "tabs.buttons") == 0;
395}
396
391void setTabPageLabel_Widget(iWidget *tabs, const iAnyObject *page, const iString *label) { 397void setTabPageLabel_Widget(iWidget *tabs, const iAnyObject *page, const iString *label) {
392 iLabelWidget *button = tabButtonForPage_Widget_(tabs, page); 398 iLabelWidget *button = tabButtonForPage_Widget_(tabs, page);
393 setText_LabelWidget(button, label); 399 setText_LabelWidget(button, label);