diff options
-rw-r--r-- | src/ui/labelwidget.c | 4 | ||||
-rw-r--r-- | src/ui/util.c | 50 | ||||
-rw-r--r-- | src/ui/widget.c | 16 |
3 files changed, 49 insertions, 21 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 9ef62262..947d5daa 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -491,9 +491,9 @@ int font_LabelWidget(const iLabelWidget *d) { | |||
491 | } | 491 | } |
492 | 492 | ||
493 | void updateSize_LabelWidget(iLabelWidget *d) { | 493 | void updateSize_LabelWidget(iLabelWidget *d) { |
494 | iWidget *w = as_Widget(d); | 494 | iWidget *w = as_Widget(d); |
495 | const int64_t flags = flags_Widget(w); | 495 | const int64_t flags = flags_Widget(w); |
496 | const iInt2 size = defaultSize_LabelWidget(d); | 496 | const iInt2 size = defaultSize_LabelWidget(d); |
497 | if (!d->flags.noAutoMinHeight) { | 497 | if (!d->flags.noAutoMinHeight) { |
498 | w->minSize.y = size.y; /* vertically text must remain visible */ | 498 | w->minSize.y = size.y; /* vertically text must remain visible */ |
499 | } | 499 | } |
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 | ||
885 | static void updateMenuItemFonts_Widget_(iWidget *d) { | 881 | static 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 }, |
diff --git a/src/ui/widget.c b/src/ui/widget.c index cedda461..254c2590 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -31,6 +31,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
31 | #include "util.h" | 31 | #include "util.h" |
32 | #include "window.h" | 32 | #include "window.h" |
33 | 33 | ||
34 | #include "labelwidget.h" | ||
35 | |||
34 | #include <the_Foundation/ptrarray.h> | 36 | #include <the_Foundation/ptrarray.h> |
35 | #include <the_Foundation/ptrset.h> | 37 | #include <the_Foundation/ptrset.h> |
36 | #include <SDL_mouse.h> | 38 | #include <SDL_mouse.h> |
@@ -836,6 +838,12 @@ static void arrange_Widget_(iWidget *d) { | |||
836 | } | 838 | } |
837 | 839 | ||
838 | static void resetArrangement_Widget_(iWidget *d) { | 840 | static void resetArrangement_Widget_(iWidget *d) { |
841 | if (d->flags & resizeToParentWidth_WidgetFlag) { | ||
842 | d->rect.size.x = 0; | ||
843 | } | ||
844 | if (d->flags & resizeToParentHeight_WidgetFlag) { | ||
845 | d->rect.size.y = 0; | ||
846 | } | ||
839 | iForEach(ObjectList, i, children_Widget(d)) { | 847 | iForEach(ObjectList, i, children_Widget(d)) { |
840 | iWidget *child = as_Widget(i.object); | 848 | iWidget *child = as_Widget(i.object); |
841 | resetArrangement_Widget_(child); | 849 | resetArrangement_Widget_(child); |
@@ -847,6 +855,14 @@ static void resetArrangement_Widget_(iWidget *d) { | |||
847 | ~child->flags & fixedWidth_WidgetFlag) { | 855 | ~child->flags & fixedWidth_WidgetFlag) { |
848 | child->rect.size.x = 0; | 856 | child->rect.size.x = 0; |
849 | } | 857 | } |
858 | if (d->flags & resizeChildrenToWidestChild_WidgetFlag) { | ||
859 | if (isInstance_Object(child, &Class_LabelWidget)) { | ||
860 | updateSize_LabelWidget((iLabelWidget *) child); | ||
861 | } | ||
862 | else { | ||
863 | child->rect.size.x = 0; | ||
864 | } | ||
865 | } | ||
850 | if (d->flags & arrangeVertical_WidgetFlag) { | 866 | if (d->flags & arrangeVertical_WidgetFlag) { |
851 | child->rect.pos.y = 0; | 867 | child->rect.pos.y = 0; |
852 | } | 868 | } |