summaryrefslogtreecommitdiff
path: root/src/ui/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/root.c')
-rw-r--r--src/ui/root.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/ui/root.c b/src/ui/root.c
index 5c4296cf..6e187313 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -703,6 +703,20 @@ void updateToolbarColors_Root(iRoot *d) {
703#endif 703#endif
704} 704}
705 705
706void showOrHideNewTabButton_Root(iRoot *d) {
707 iWidget *tabs = findChild_Widget(d->widget, "doctabs");
708 iWidget *newTabButton = findChild_Widget(tabs, "newtab");
709 iBool hide = iFalse;
710 iForIndices(i, prefs_App()->navbarActions) {
711 if (prefs_App()->navbarActions[i] == newTab_ToolbarAction) {
712 hide = iTrue;
713 break;
714 }
715 }
716 setFlags_Widget(newTabButton, hidden_WidgetFlag, hide);
717 arrange_Widget(findChild_Widget(tabs, "tabs.buttons"));
718}
719
706void notifyVisualOffsetChange_Root(iRoot *d) { 720void notifyVisualOffsetChange_Root(iRoot *d) {
707 if (d && (d->didAnimateVisualOffsets || d->didChangeArrangement)) { 721 if (d && (d->didAnimateVisualOffsets || d->didChangeArrangement)) {
708 iNotifyAudience(d, visualOffsetsChanged, RootVisualOffsetsChanged); 722 iNotifyAudience(d, visualOffsetsChanged, RootVisualOffsetsChanged);
@@ -848,6 +862,7 @@ static void updateNavBarActions_(iWidget *navBar) {
848 } 862 }
849 iEndCollect(); 863 iEndCollect();
850 } 864 }
865 showOrHideNewTabButton_Root(navBar->root);
851} 866}
852 867
853static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { 868static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {
@@ -1312,8 +1327,7 @@ void createUserInterface_Root(iRoot *d) {
1312#if defined (iPlatformApple) 1327#if defined (iPlatformApple)
1313 addUnsplitButton_(navBar); 1328 addUnsplitButton_(navBar);
1314#endif 1329#endif
1315 iWidget *navBack; 1330 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.action1");
1316 setId_Widget(navBack = addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.action1");
1317 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.action2"); 1331 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.action2");
1318 /* Button for toggling the left sidebar. */ 1332 /* Button for toggling the left sidebar. */
1319 setId_Widget(addChildFlags_Widget( 1333 setId_Widget(addChildFlags_Widget(
@@ -1497,6 +1511,16 @@ void createUserInterface_Root(iRoot *d) {
1497 /* On PC platforms, the close buttons are generally on the top right. */ 1511 /* On PC platforms, the close buttons are generally on the top right. */
1498 addUnsplitButton_(navBar); 1512 addUnsplitButton_(navBar);
1499#endif 1513#endif
1514 if (deviceType_App() == tablet_AppDeviceType) {
1515 /* Ensure that all navbar buttons match the height of the input field.
1516 This is required because touch input fields are given extra padding,
1517 making them taller than buttons by default. */
1518 iForEach(ObjectList, i, children_Widget(navBar)) {
1519 if (isInstance_Object(i.object, &Class_LabelWidget)) {
1520 as_Widget(i.object)->sizeRef = as_Widget(url);
1521 }
1522 }
1523 }
1500 } 1524 }
1501 /* Tab bar. */ { 1525 /* Tab bar. */ {
1502 iWidget *mainStack = new_Widget(); 1526 iWidget *mainStack = new_Widget();
@@ -1517,7 +1541,7 @@ void createUserInterface_Root(iRoot *d) {
1517 } 1541 }
1518 setId_Widget( 1542 setId_Widget(
1519 addChildFlags_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new")), 1543 addChildFlags_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new")),
1520 moveToParentRightEdge_WidgetFlag), 1544 moveToParentRightEdge_WidgetFlag | collapse_WidgetFlag),
1521 "newtab"); 1545 "newtab");
1522 } 1546 }
1523 /* Sidebars. */ { 1547 /* Sidebars. */ {
@@ -1528,6 +1552,7 @@ void createUserInterface_Root(iRoot *d) {
1528 addChildPos_Widget(content, iClob(sidebar1), front_WidgetAddPos); 1552 addChildPos_Widget(content, iClob(sidebar1), front_WidgetAddPos);
1529 iSidebarWidget *sidebar2 = new_SidebarWidget(right_SidebarSide); 1553 iSidebarWidget *sidebar2 = new_SidebarWidget(right_SidebarSide);
1530 addChildPos_Widget(content, iClob(sidebar2), back_WidgetAddPos); 1554 addChildPos_Widget(content, iClob(sidebar2), back_WidgetAddPos);
1555 setFlags_Widget(as_Widget(sidebar2), disabledWhenHidden_WidgetFlag, iTrue);
1531 } 1556 }
1532 else { 1557 else {
1533 /* Sidebar is a slide-over sheet. */ 1558 /* Sidebar is a slide-over sheet. */