summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-13 08:57:43 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-13 08:57:43 +0200
commit97d8767043174ba7901014cc904579e1a741ef30 (patch)
treef7eb54246df4aa8a8fa4ca2f2cdfab0a95325d0d /src/ui/window.c
parent4d9c26488c25ecbadb3444f9d628a0bb6bc93fa2 (diff)
Arrange URL child indicators; widget arrangement
The indicators in the URL input field are now arranged horizontally, so they don't overlap. Improved arrangement of (un)collapsed widgets.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c75
1 files changed, 40 insertions, 35 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index edbbf0e9..554dc592 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -519,8 +519,9 @@ static iBool willPerformSearchQuery_(const iString *userInput) {
519 519
520static void showSearchQueryIndicator_(iBool show) { 520static void showSearchQueryIndicator_(iBool show) {
521 iWidget *indicator = findWidget_App("input.indicator.search"); 521 iWidget *indicator = findWidget_App("input.indicator.search");
522 setFlags_Widget(indicator, hidden_WidgetFlag, !show); 522 showCollapsed_Widget(indicator, show);
523 iInputWidget *url = (iInputWidget *) parent_Widget(indicator); 523 iAssert(isInstance_Object(parent_Widget(parent_Widget(indicator)), &Class_InputWidget));
524 iInputWidget *url = (iInputWidget *) parent_Widget(parent_Widget(indicator));
524 setContentPadding_InputWidget(url, -1, contentPadding_InputWidget(url).left + 525 setContentPadding_InputWidget(url, -1, contentPadding_InputWidget(url).left +
525 (show ? width_Widget(indicator) : 0)); 526 (show ? width_Widget(indicator) : 0));
526} 527}
@@ -857,17 +858,19 @@ static void updateMetrics_Window_(iWindow *d) {
857 iWidget *navBar = findChild_Widget(d->root, "navbar"); 858 iWidget *navBar = findChild_Widget(d->root, "navbar");
858 iWidget *lock = findChild_Widget(navBar, "navbar.lock"); 859 iWidget *lock = findChild_Widget(navBar, "navbar.lock");
859 iWidget *url = findChild_Widget(d->root, "url"); 860 iWidget *url = findChild_Widget(d->root, "url");
860 iWidget *fprog = findChild_Widget(navBar, "feeds.progress"); 861// iWidget *fprog = findChild_Widget(navBar, "feeds.progress");
861 iWidget *docProg = findChild_Widget(navBar, "document.progress"); 862// iWidget *docProg = findChild_Widget(navBar, "document.progress");
862 iWidget *indSearch = findChild_Widget(navBar, "input.indicator.search"); 863// iWidget *indSearch = findChild_Widget(navBar, "input.indicator.search");
864 iWidget *rightEmbed = findChild_Widget(navBar, "url.rightembed");
863 setPadding_Widget(as_Widget(url), 0, gap_UI, 0, gap_UI); 865 setPadding_Widget(as_Widget(url), 0, gap_UI, 0, gap_UI);
864 navBar->rect.size.y = 0; /* recalculate height based on children (FIXME: shouldn't be needed) */ 866 navBar->rect.size.y = 0; /* recalculate height based on children (FIXME: shouldn't be needed) */
865 updateSize_LabelWidget((iLabelWidget *) lock); 867 updateSize_LabelWidget((iLabelWidget *) lock);
866 setContentPadding_InputWidget((iInputWidget *) url, width_Widget(lock) * 0.75, 868 setContentPadding_InputWidget((iInputWidget *) url, width_Widget(lock) * 0.75,
867 width_Widget(lock) * 0.75); 869 width_Widget(lock) * 0.75);
868 fprog->rect.pos.y = gap_UI; 870 rightEmbed->rect.pos.y = gap_UI;
869 docProg->rect.pos.y = gap_UI; 871// fprog->rect.pos.y = gap_UI;
870 indSearch->rect.pos.y = gap_UI; 872// docProg->rect.pos.y = gap_UI;
873// indSearch->rect.pos.y = gap_UI;
871 updatePadding_Window_(d); 874 updatePadding_Window_(d);
872 arrange_Widget(d->root); 875 arrange_Widget(d->root);
873 postRefresh_App(); 876 postRefresh_App();
@@ -968,52 +971,54 @@ static void setupUserInterface_Window(iWindow *d) {
968 noBackground_WidgetFlag | frameless_WidgetFlag | unpadded_WidgetFlag | 971 noBackground_WidgetFlag | frameless_WidgetFlag | unpadded_WidgetFlag |
969 (deviceType_App() == desktop_AppDeviceType ? tight_WidgetFlag : 0); 972 (deviceType_App() == desktop_AppDeviceType ? tight_WidgetFlag : 0);
970 /* Page information/certificate warning. */ { 973 /* Page information/certificate warning. */ {
971 iLabelWidget *lock = 974 iLabelWidget *lock = addChildFlags_Widget(
972 addChildFlags_Widget(as_Widget(url), 975 as_Widget(url),
973 iClob(newIcon_LabelWidget("\U0001f513", SDLK_i, KMOD_PRIMARY, "document.info")), 976 iClob(newIcon_LabelWidget("\U0001f513", SDLK_i, KMOD_PRIMARY, "document.info")),
974 embedFlags | moveToParentLeftEdge_WidgetFlag); 977 embedFlags | moveToParentLeftEdge_WidgetFlag);
975 setId_Widget(as_Widget(lock), "navbar.lock"); 978 setId_Widget(as_Widget(lock), "navbar.lock");
976 setFont_LabelWidget(lock, defaultSymbols_FontId); 979 setFont_LabelWidget(lock, defaultSymbols_FontId);
977 updateTextCStr_LabelWidget(lock, "\U0001f512"); 980 updateTextCStr_LabelWidget(lock, "\U0001f512");
978 } 981 }
982 iWidget *rightEmbed = new_Widget();
983 setId_Widget(rightEmbed, "url.rightembed");
984 addChildFlags_Widget(as_Widget(url),
985 iClob(rightEmbed),
986 arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag |
987 resizeHeightOfChildren_WidgetFlag |
988 moveToParentRightEdge_WidgetFlag);
989 /* Feeds refresh indicator is inside the input field. */ {
990 iLabelWidget *queryInd =
991 new_LabelWidget(uiTextAction_ColorEscape "\u21d2 Search Query", NULL);
992 setId_Widget(as_Widget(queryInd), "input.indicator.search");
993 setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId);
994 setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId);
995 setAlignVisually_LabelWidget(queryInd, iTrue);
996 addChildFlags_Widget(rightEmbed,
997 iClob(queryInd),
998 collapse_WidgetFlag | hidden_WidgetFlag);
999 }
979 /* Feeds refresh indicator is inside the input field. */ { 1000 /* Feeds refresh indicator is inside the input field. */ {
980 iLabelWidget *fprog = new_LabelWidget(uiTextCaution_ColorEscape 1001 iLabelWidget *fprog = new_LabelWidget(uiTextCaution_ColorEscape
981 "\u2605 Refreshing Feeds...", NULL); 1002 "\u2605 Updating Feeds", NULL);
982 setId_Widget(as_Widget(fprog), "feeds.progress"); 1003 setId_Widget(as_Widget(fprog), "feeds.progress");
983 setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId); 1004 setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId);
984 setAlignVisually_LabelWidget(fprog, iTrue); 1005 setAlignVisually_LabelWidget(fprog, iTrue);
985// shrink_Rect(&as_Widget(fprog)->rect, init_I2(0, gap_UI)); 1006 addChildFlags_Widget(rightEmbed,
986 addChildFlags_Widget(as_Widget(url),
987 iClob(fprog), 1007 iClob(fprog),
988 moveToParentRightEdge_WidgetFlag | hidden_WidgetFlag); 1008 collapse_WidgetFlag | hidden_WidgetFlag);
989 } 1009 }
990 /* Download progress indicator is also inside the input field, but hidden normally. 1010 /* Download progress indicator is also inside the input field, but hidden normally. */ {
991 TODO: It shouldn't overlap the feeds indicator... */ {
992 iLabelWidget *progress = new_LabelWidget(uiTextCaution_ColorEscape "00.000 MB", NULL); 1011 iLabelWidget *progress = new_LabelWidget(uiTextCaution_ColorEscape "00.000 MB", NULL);
993 setId_Widget(as_Widget(progress), "document.progress"); 1012 setId_Widget(as_Widget(progress), "document.progress");
994 setBackgroundColor_Widget(as_Widget(progress), uiBackground_ColorId); 1013 setBackgroundColor_Widget(as_Widget(progress), uiBackground_ColorId);
995 setAlignVisually_LabelWidget(progress, iTrue); 1014 setAlignVisually_LabelWidget(progress, iTrue);
996// shrink_Rect(&as_Widget(progress)->rect, init_I2(0, gap_UI)); 1015 addChildFlags_Widget(
997 addChildFlags_Widget(as_Widget(url), 1016 rightEmbed, iClob(progress), collapse_WidgetFlag);
998 iClob(progress),
999 moveToParentRightEdge_WidgetFlag);
1000 }
1001 /* Feeds refresh indicator is inside the input field. */ {
1002 iLabelWidget *queryInd =
1003 new_LabelWidget(uiTextAction_ColorEscape "\u21d2 Search Query", NULL);
1004 setId_Widget(as_Widget(queryInd), "input.indicator.search");
1005 setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId);
1006 setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId);
1007 setAlignVisually_LabelWidget(queryInd, iTrue);
1008// shrink_Rect(&as_Widget(queryInd)->rect, init_I2(0, gap_UI));
1009 addChildFlags_Widget(as_Widget(url),
1010 iClob(queryInd),
1011 moveToParentRightEdge_WidgetFlag | hidden_WidgetFlag);
1012 } 1017 }
1013 /* Reload button. */ 1018 /* Reload button. */
1014 iLabelWidget *reload = newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"); 1019 iLabelWidget *reload = newIcon_LabelWidget(reloadCStr_, 0, 0, "navigate.reload");
1015 setId_Widget(as_Widget(reload), "reload"); 1020 setId_Widget(as_Widget(reload), "reload");
1016 addChildFlags_Widget(as_Widget(url), iClob(reload), embedFlags | moveToParentRightEdge_WidgetFlag); 1021 addChildFlags_Widget(rightEmbed, iClob(reload), embedFlags);
1017 updateSize_LabelWidget(reload); 1022 updateSize_LabelWidget(reload);
1018 } 1023 }
1019 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); 1024 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag);