diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-06 08:28:58 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-06 08:28:58 +0200 |
commit | a73b54d8ab2164984c884caafb2e8f53d6557133 (patch) | |
tree | 2f0b2ff5dda324a379c6f9b6e37a918cd9fc3a58 /src/ui/util.c | |
parent | 78dcb6d388155454cfd042072419eb03080ad57d (diff) |
Mobile: Widget interaction and appearance
Overflow-scrollable allows momentum scrolls. Adjusting fonts in phone sheets.
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index df44cc80..29ac04a3 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -359,7 +359,7 @@ iWidget *makePadding_Widget(int size) { | |||
359 | 359 | ||
360 | iLabelWidget *makeHeading_Widget(const char *text) { | 360 | iLabelWidget *makeHeading_Widget(const char *text) { |
361 | iLabelWidget *heading = new_LabelWidget(text, NULL); | 361 | iLabelWidget *heading = new_LabelWidget(text, NULL); |
362 | setFlags_Widget(as_Widget(heading), frameless_WidgetFlag | fixedSize_WidgetFlag, iTrue); | 362 | setFlags_Widget(as_Widget(heading), frameless_WidgetFlag | alignLeft_WidgetFlag /*| fixedSize_WidgetFlag*/, iTrue); |
363 | setBackgroundColor_Widget(as_Widget(heading), none_ColorId); | 363 | setBackgroundColor_Widget(as_Widget(heading), none_ColorId); |
364 | return heading; | 364 | return heading; |
365 | } | 365 | } |
@@ -931,14 +931,32 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
931 | iWidget *value = child_Widget(values, 0); | 931 | iWidget *value = child_Widget(values, 0); |
932 | removeChild_Widget(headings, heading); | 932 | removeChild_Widget(headings, heading); |
933 | removeChild_Widget(values, value); | 933 | removeChild_Widget(values, value); |
934 | iLabelWidget *headingLabel = NULL; | ||
934 | iLabelWidget *valueLabel = NULL; | 935 | iLabelWidget *valueLabel = NULL; |
936 | iInputWidget *valueInput = NULL; | ||
937 | if (isInstance_Object(heading, &Class_LabelWidget)) { | ||
938 | headingLabel = (iLabelWidget *) heading; | ||
939 | } | ||
935 | if (isInstance_Object(value, &Class_LabelWidget)) { | 940 | if (isInstance_Object(value, &Class_LabelWidget)) { |
936 | valueLabel = (iLabelWidget *) value; | 941 | valueLabel = (iLabelWidget *) value; |
937 | } | 942 | } |
943 | if (isInstance_Object(value, &Class_InputWidget)) { | ||
944 | valueInput = (iInputWidget *) value; | ||
945 | } | ||
946 | if (valueLabel) { | ||
947 | setFont_LabelWidget(valueLabel, defaultBig_FontId); | ||
948 | } | ||
949 | if (valueInput) { | ||
950 | setFont_InputWidget(valueInput, defaultBig_FontId); | ||
951 | setContentPadding_InputWidget(valueInput, 3 * gap_UI, 3 * gap_UI); | ||
952 | } | ||
938 | /* Toggles have the button on the right. */ | 953 | /* Toggles have the button on the right. */ |
939 | if (valueLabel && cmp_String(command_LabelWidget(valueLabel), "toggle") == 0) { | 954 | if (valueLabel && cmp_String(command_LabelWidget(valueLabel), "toggle") == 0) { |
940 | iWidget *div = new_Widget(); | 955 | iWidget *div = new_Widget(); |
956 | setFrameColor_Widget(div, uiSeparator_ColorId); | ||
957 | setPadding_Widget(div, gap_UI, gap_UI, 4 * gap_UI, gap_UI); | ||
941 | addChildFlags_Widget(div, iClob(heading), 0); | 958 | addChildFlags_Widget(div, iClob(heading), 0); |
959 | setFont_LabelWidget((iLabelWidget *) heading, defaultBig_FontId); | ||
942 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); | 960 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); |
943 | addChild_Widget(div, iClob(value)); | 961 | addChild_Widget(div, iClob(value)); |
944 | addChildFlags_Widget(sheet, | 962 | addChildFlags_Widget(sheet, |
@@ -952,9 +970,15 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
952 | /* Subheading padding goes above. */ | 970 | /* Subheading padding goes above. */ |
953 | addChild_Widget(sheet, iClob(value)); | 971 | addChild_Widget(sheet, iClob(value)); |
954 | addChild_Widget(sheet, iClob(heading)); | 972 | addChild_Widget(sheet, iClob(heading)); |
973 | setFont_LabelWidget(headingLabel, uiLabelBold_FontId); | ||
955 | } | 974 | } |
956 | else { | 975 | else { |
957 | addChild_Widget(sheet, iClob(heading)); | 976 | addChild_Widget(sheet, iClob(heading)); |
977 | if (headingLabel) { | ||
978 | setTextColor_LabelWidget(headingLabel, uiSubheading_ColorId); | ||
979 | setText_LabelWidget(headingLabel, | ||
980 | collect_String(upper_String(text_LabelWidget(headingLabel)))); | ||
981 | } | ||
958 | addChild_Widget(sheet, iClob(value)); | 982 | addChild_Widget(sheet, iClob(value)); |
959 | /* Align radio buttons to the right. */ | 983 | /* Align radio buttons to the right. */ |
960 | if (childCount_Widget(value)) { | 984 | if (childCount_Widget(value)) { |
@@ -962,6 +986,12 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
962 | resizeToParentWidth_WidgetFlag | | 986 | resizeToParentWidth_WidgetFlag | |
963 | resizeWidthOfChildren_WidgetFlag, | 987 | resizeWidthOfChildren_WidgetFlag, |
964 | iTrue); | 988 | iTrue); |
989 | iForEach(ObjectList, sub, children_Widget(value)) { | ||
990 | if (isInstance_Object(sub.object, &Class_LabelWidget)) { | ||
991 | iLabelWidget *opt = sub.object; | ||
992 | setFont_LabelWidget(opt, defaultBig_FontId); | ||
993 | } | ||
994 | } | ||
965 | } | 995 | } |
966 | } | 996 | } |
967 | } | 997 | } |