diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 08:53:28 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-18 15:01:13 +0300 |
commit | 8026b29755cde294ed1db34dd254bba4d0d0b381 (patch) | |
tree | ef5cf33b15ed1f15e86ee79f548db08643aa619e /src/ui | |
parent | 88e1a4667d981bf7d87f1e4052a7671a960351da (diff) |
Root: Updating size of navbar buttons/indicators
Not all UI elements were appropriate sized when switching between normal and tight layout.
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/root.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/ui/root.c b/src/ui/root.c index 6cf3f424..8c98bdd3 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -583,20 +583,22 @@ static void updateNavBarSize_(iWidget *navBar) { | |||
583 | /* Button sizing. */ | 583 | /* Button sizing. */ |
584 | if (isNarrow ^ ((flags_Widget(navBar) & tight_WidgetFlag) != 0)) { | 584 | if (isNarrow ^ ((flags_Widget(navBar) & tight_WidgetFlag) != 0)) { |
585 | setFlags_Widget(navBar, tight_WidgetFlag, isNarrow); | 585 | setFlags_Widget(navBar, tight_WidgetFlag, isNarrow); |
586 | iForEach(ObjectList, i, navBar->children) { | 586 | iObjectList *lists[] = { |
587 | iWidget *child = as_Widget(i.object); | 587 | children_Widget(navBar), |
588 | setFlags_Widget(child, tight_WidgetFlag, isNarrow); | 588 | children_Widget(findChild_Widget(navBar, "url")), |
589 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | 589 | children_Widget(findChild_Widget(navBar, "url.buttons")), |
590 | iLabelWidget *label = i.object; | 590 | }; |
591 | updateSize_LabelWidget(label); | 591 | iForIndices(k, lists) { |
592 | iForEach(ObjectList, i, lists[k]) { | ||
593 | iWidget *child = as_Widget(i.object); | ||
594 | setFlags_Widget(child, tight_WidgetFlag, isNarrow); | ||
595 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | ||
596 | iLabelWidget *label = i.object; | ||
597 | updateSize_LabelWidget(label); | ||
598 | } | ||
592 | } | 599 | } |
593 | } | 600 | } |
594 | updateUrlInputContentPadding_(navBar); | 601 | updateUrlInputContentPadding_(navBar); |
595 | /* Note that InputWidget uses the `tight` flag to adjust its inner padding. */ | ||
596 | // const int embedButtonWidth = width_Widget(findChild_Widget(navBar, "navbar.lock")); | ||
597 | // setContentPadding_InputWidget(findChild_Widget(navBar, "url"), | ||
598 | // embedButtonWidth * 0.75f, | ||
599 | // embedButtonWidth * 0.75f); | ||
600 | } | 602 | } |
601 | if (isPhone) { | 603 | if (isPhone) { |
602 | static const char *buttons[] = { "navbar.back", "navbar.forward", "navbar.sidebar", | 604 | static const char *buttons[] = { "navbar.back", "navbar.forward", "navbar.sidebar", |
@@ -620,7 +622,8 @@ static void updateNavBarSize_(iWidget *navBar) { | |||
620 | urlBar->rect.size.x = iMini(navBarAvailableSpace_(navBar), 167 * gap_UI); | 622 | urlBar->rect.size.x = iMini(navBarAvailableSpace_(navBar), 167 * gap_UI); |
621 | arrange_Widget(navBar); | 623 | arrange_Widget(navBar); |
622 | } | 624 | } |
623 | refresh_Widget(navBar); | 625 | updateMetrics_Root(navBar->root); /* tight flags changed; need to resize URL bar contents */ |
626 | // refresh_Widget(navBar); | ||
624 | postCommand_Widget(navBar, "layout.changed id:navbar"); | 627 | postCommand_Widget(navBar, "layout.changed id:navbar"); |
625 | } | 628 | } |
626 | 629 | ||
@@ -1086,7 +1089,9 @@ void createUserInterface_Root(iRoot *d) { | |||
1086 | setNoAutoMinHeight_LabelWidget(pin, iTrue); | 1089 | setNoAutoMinHeight_LabelWidget(pin, iTrue); |
1087 | addChildFlags_Widget(rightEmbed, | 1090 | addChildFlags_Widget(rightEmbed, |
1088 | iClob(pin), | 1091 | iClob(pin), |
1089 | collapse_WidgetFlag | hidden_WidgetFlag | tight_WidgetFlag | frameless_WidgetFlag); | 1092 | collapse_WidgetFlag | hidden_WidgetFlag | tight_WidgetFlag | |
1093 | frameless_WidgetFlag); | ||
1094 | updateSize_LabelWidget(pin); | ||
1090 | } | 1095 | } |
1091 | iWidget *urlButtons = new_Widget(); | 1096 | iWidget *urlButtons = new_Widget(); |
1092 | setId_Widget(urlButtons, "url.buttons"); | 1097 | setId_Widget(urlButtons, "url.buttons"); |