diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/root.c | 27 | ||||
-rw-r--r-- | src/ui/window.c | 6 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index d98701b8..5b1167d8 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -635,10 +635,12 @@ static void updateNavBarSize_(iWidget *navBar) { | |||
635 | iForIndices(k, lists) { | 635 | iForIndices(k, lists) { |
636 | iForEach(ObjectList, i, lists[k]) { | 636 | iForEach(ObjectList, i, lists[k]) { |
637 | iWidget *child = as_Widget(i.object); | 637 | iWidget *child = as_Widget(i.object); |
638 | setFlags_Widget(child, tight_WidgetFlag, isNarrow); | 638 | if (cmp_String(id_Widget(i.object), "navbar.unsplit")) { |
639 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | 639 | setFlags_Widget(child, tight_WidgetFlag, isNarrow); |
640 | iLabelWidget *label = i.object; | 640 | if (isInstance_Object(i.object, &Class_LabelWidget)) { |
641 | updateSize_LabelWidget(label); | 641 | iLabelWidget *label = i.object; |
642 | updateSize_LabelWidget(label); | ||
643 | } | ||
642 | } | 644 | } |
643 | } | 645 | } |
644 | } | 646 | } |
@@ -1023,6 +1025,16 @@ void updateMetrics_Root(iRoot *d) { | |||
1023 | postRefresh_App(); | 1025 | postRefresh_App(); |
1024 | } | 1026 | } |
1025 | 1027 | ||
1028 | static void addUnsplitButton_(iWidget *navBar) { | ||
1029 | iLabelWidget *unsplit = addChildFlags_Widget( | ||
1030 | navBar, | ||
1031 | iClob(newIcon_LabelWidget(close_Icon, 0, 0, "ui.split arg:0 focusother:1")), | ||
1032 | collapse_WidgetFlag | frameless_WidgetFlag | tight_WidgetFlag | hidden_WidgetFlag); | ||
1033 | setId_Widget(as_Widget(unsplit), "navbar.unsplit"); | ||
1034 | setTextColor_LabelWidget(unsplit, uiTextAction_ColorId); | ||
1035 | updateSize_LabelWidget(unsplit); | ||
1036 | } | ||
1037 | |||
1026 | void createUserInterface_Root(iRoot *d) { | 1038 | void createUserInterface_Root(iRoot *d) { |
1027 | iWidget *root = d->widget = new_Widget(); | 1039 | iWidget *root = d->widget = new_Widget(); |
1028 | root->rect.size = get_Window()->size; | 1040 | root->rect.size = get_Window()->size; |
@@ -1101,6 +1113,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1101 | addChild_Widget(div, iClob(navBar)); | 1113 | addChild_Widget(div, iClob(navBar)); |
1102 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); | 1114 | setBackgroundColor_Widget(navBar, uiBackground_ColorId); |
1103 | setCommandHandler_Widget(navBar, handleNavBarCommands_); | 1115 | setCommandHandler_Widget(navBar, handleNavBarCommands_); |
1116 | #if defined (iPlatformApple) | ||
1117 | addUnsplitButton_(navBar); | ||
1118 | #endif | ||
1104 | iWidget *navBack; | 1119 | iWidget *navBack; |
1105 | setId_Widget(navBack = addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); | 1120 | setId_Widget(navBack = addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); |
1106 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); | 1121 | setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); |
@@ -1279,6 +1294,10 @@ void createUserInterface_Root(iRoot *d) { | |||
1279 | setAlignVisually_LabelWidget(navMenu, iTrue); | 1294 | setAlignVisually_LabelWidget(navMenu, iTrue); |
1280 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); | 1295 | setId_Widget(addChildFlags_Widget(navBar, iClob(navMenu), collapse_WidgetFlag), "navbar.menu"); |
1281 | #endif | 1296 | #endif |
1297 | #if !defined (iPlatformApple) | ||
1298 | /* On PC platforms, the close buttons are generally on the top right. */ | ||
1299 | addUnsplitButton_(navBar); | ||
1300 | #endif | ||
1282 | } | 1301 | } |
1283 | /* Tab bar. */ { | 1302 | /* Tab bar. */ { |
1284 | iWidget *mainStack = new_Widget(); | 1303 | iWidget *mainStack = new_Widget(); |
diff --git a/src/ui/window.c b/src/ui/window.c index b8ce413b..4b39383c 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1491,6 +1491,7 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) { | |||
1491 | } | 1491 | } |
1492 | /* The last child is the [+] button for adding a tab. */ | 1492 | /* The last child is the [+] button for adding a tab. */ |
1493 | moveTabButtonToEnd_Widget(findChild_Widget(docTabs, "newtab")); | 1493 | moveTabButtonToEnd_Widget(findChild_Widget(docTabs, "newtab")); |
1494 | setFlags_Widget(findWidget_Root("navbar.unsplit"), hidden_WidgetFlag, iTrue); | ||
1494 | iRelease(tabs); | 1495 | iRelease(tabs); |
1495 | postCommandf_App("tabs.switch id:%s", cstr_String(id_Widget(constAs_Widget(curPage)))); | 1496 | postCommandf_App("tabs.switch id:%s", cstr_String(id_Widget(constAs_Widget(curPage)))); |
1496 | } | 1497 | } |
@@ -1540,6 +1541,11 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) { | |||
1540 | postCommand_Root(w->roots[newRootIndex], "navigate.home"); | 1541 | postCommand_Root(w->roots[newRootIndex], "navigate.home"); |
1541 | } | 1542 | } |
1542 | } | 1543 | } |
1544 | /* Show unsplit buttons. */ | ||
1545 | for (int i = 0; i < 2; i++) { | ||
1546 | setFlags_Widget(findChild_Widget(w->roots[i]->widget, "navbar.unsplit"), | ||
1547 | hidden_WidgetFlag, iFalse); | ||
1548 | } | ||
1543 | setCurrent_Root(NULL); | 1549 | setCurrent_Root(NULL); |
1544 | } | 1550 | } |
1545 | d->splitMode = splitMode; | 1551 | d->splitMode = splitMode; |