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.c50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/ui/util.c b/src/ui/util.c
index 91b67e06..61d3e9bb 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -861,12 +861,8 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) {
861 setFlags_Widget(menu, 861 setFlags_Widget(menu,
862 keepOnTop_WidgetFlag | collapse_WidgetFlag | hidden_WidgetFlag | 862 keepOnTop_WidgetFlag | collapse_WidgetFlag | hidden_WidgetFlag |
863 arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag | 863 arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag |
864 resizeChildrenToWidestChild_WidgetFlag | overflowScrollable_WidgetFlag | 864 resizeChildrenToWidestChild_WidgetFlag | overflowScrollable_WidgetFlag,
865 (isPortraitPhone_App() ? drawBackgroundToVerticalSafeArea_WidgetFlag : 0),
866 iTrue); 865 iTrue);
867 if (!isPortraitPhone_App()) {
868 setFrameColor_Widget(menu, uiBackgroundSelected_ColorId);
869 }
870 makeMenuItems_Widget(menu, items, n); 866 makeMenuItems_Widget(menu, items, n);
871 addChild_Widget(parent, menu); 867 addChild_Widget(parent, menu);
872 iRelease(menu); /* owned by parent now */ 868 iRelease(menu); /* owned by parent now */
@@ -884,6 +880,7 @@ void openMenu_Widget(iWidget *d, iInt2 windowCoord) {
884 880
885static void updateMenuItemFonts_Widget_(iWidget *d) { 881static void updateMenuItemFonts_Widget_(iWidget *d) {
886 const iBool isPortraitPhone = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); 882 const iBool isPortraitPhone = (deviceType_App() == phone_AppDeviceType && isPortrait_App());
883 const iBool isMobile = (deviceType_App() != desktop_AppDeviceType);
887 const iBool isSlidePanel = (flags_Widget(d) & horizontalOffset_WidgetFlag) != 0; 884 const iBool isSlidePanel = (flags_Widget(d) & horizontalOffset_WidgetFlag) != 0;
888 iForEach(ObjectList, i, children_Widget(d)) { 885 iForEach(ObjectList, i, children_Widget(d)) {
889 if (isInstance_Object(i.object, &Class_LabelWidget)) { 886 if (isInstance_Object(i.object, &Class_LabelWidget)) {
@@ -895,14 +892,14 @@ static void updateMenuItemFonts_Widget_(iWidget *d) {
895 if (deviceType_App() == desktop_AppDeviceType) { 892 if (deviceType_App() == desktop_AppDeviceType) {
896 setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId); 893 setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId);
897 } 894 }
898 else if (isPortraitPhone) { 895 else { //if (isPortraitPhone) {
899 if (!isSlidePanel) { 896 //if (!isSlidePanel) {
900 setFont_LabelWidget(label, isCaution ? uiLabelBigBold_FontId : uiLabelBig_FontId); 897 setFont_LabelWidget(label, isCaution ? uiLabelBigBold_FontId : uiLabelBig_FontId);
901 } 898 // }
902 }
903 else {
904 setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId);
905 } 899 }
900// else {
901// setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId);
902// }
906 } 903 }
907 else if (childCount_Widget(i.object)) { 904 else if (childCount_Widget(i.object)) {
908 updateMenuItemFonts_Widget_(i.object); 905 updateMenuItemFonts_Widget_(i.object);
@@ -1034,6 +1031,12 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1034 setFlags_Widget(d, hidden_WidgetFlag, iFalse); 1031 setFlags_Widget(d, hidden_WidgetFlag, iFalse);
1035 setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue); 1032 setFlags_Widget(d, commandOnMouseMiss_WidgetFlag, iTrue);
1036 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse); 1033 setFlags_Widget(findChild_Widget(d, "menu.cancel"), disabled_WidgetFlag, iFalse);
1034 if (!isPortraitPhone) {
1035 setFrameColor_Widget(d, uiBackgroundSelected_ColorId);
1036 }
1037 else {
1038 setFrameColor_Widget(d, none_ColorId);
1039 }
1037 arrange_Widget(d); /* need to know the height */ 1040 arrange_Widget(d); /* need to know the height */
1038 iBool allowOverflow = iFalse; 1041 iBool allowOverflow = iFalse;
1039 /* A vertical offset determined by a possible selected label in the menu. */ 1042 /* A vertical offset determined by a possible selected label in the menu. */
@@ -1104,13 +1107,22 @@ void openMenuFlags_Widget(iWidget *d, iInt2 windowCoord, int menuOpenFlags) {
1104 } 1107 }
1105#endif 1108#endif
1106 raise_Widget(d); 1109 raise_Widget(d);
1107 if (isPortraitPhone) { 1110 if (deviceType_App() != desktop_AppDeviceType) {
1108 setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, iFalse); 1111 setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag,
1109 setFlags_Widget(d, resizeWidthOfChildren_WidgetFlag | drawBackgroundToBottom_WidgetFlag, iTrue); 1112 !isPortraitPhone);
1110 if (!isSlidePanel) { 1113 setFlags_Widget(d,
1111 setFlags_Widget(d, borderTop_WidgetFlag, iTrue); 1114 resizeWidthOfChildren_WidgetFlag | drawBackgroundToBottom_WidgetFlag |
1115 drawBackgroundToVerticalSafeArea_WidgetFlag,
1116 isPortraitPhone);
1117 if (isPortraitPhone) {
1118 if (!isSlidePanel) {
1119 setFlags_Widget(d, borderTop_WidgetFlag, iTrue);
1120 }
1121 d->rect.size.x = rootSize.x;
1122 }
1123 else {
1124 d->rect.size.x = 0;
1112 } 1125 }
1113 d->rect.size.x = rootSize.x;
1114 } 1126 }
1115 updateMenuItemFonts_Widget_(d); 1127 updateMenuItemFonts_Widget_(d);
1116 arrange_Widget(d); 1128 arrange_Widget(d);
@@ -2458,7 +2470,7 @@ iWidget *makePreferences_Widget(void) {
2458 { "title id:heading.settings" }, 2470 { "title id:heading.settings" },
2459 { "panel text:" gear_Icon " ${heading.prefs.general}", 0, 0, (const void *) generalPanelItems }, 2471 { "panel text:" gear_Icon " ${heading.prefs.general}", 0, 0, (const void *) generalPanelItems },
2460 { "panel icon:0x1f5a7 id:heading.prefs.network", 0, 0, (const void *) networkPanelItems }, 2472 { "panel icon:0x1f5a7 id:heading.prefs.network", 0, 0, (const void *) networkPanelItems },
2461 { "panel text:" person_Icon " ${sidebar.identities}", 0, 0, (const void *) identityPanelItems }, 2473 { "panel noscroll:1 text:" person_Icon " ${sidebar.identities}", 0, 0, (const void *) identityPanelItems },
2462 { "padding" }, 2474 { "padding" },
2463 { "panel icon:0x1f4f1 id:heading.prefs.interface", 0, 0, (const void *) uiPanelItems }, 2475 { "panel icon:0x1f4f1 id:heading.prefs.interface", 0, 0, (const void *) uiPanelItems },
2464 { "panel icon:0x1f3a8 id:heading.prefs.colors", 0, 0, (const void *) colorPanelItems }, 2476 { "panel icon:0x1f3a8 id:heading.prefs.colors", 0, 0, (const void *) colorPanelItems },