diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 207 |
1 files changed, 184 insertions, 23 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 10fa66b0..c6e2fd1a 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -26,6 +26,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
26 | #include "bookmarks.h" | 26 | #include "bookmarks.h" |
27 | #include "color.h" | 27 | #include "color.h" |
28 | #include "command.h" | 28 | #include "command.h" |
29 | #include "defs.h" | ||
29 | #include "documentwidget.h" | 30 | #include "documentwidget.h" |
30 | #include "gmutil.h" | 31 | #include "gmutil.h" |
31 | #include "feeds.h" | 32 | #include "feeds.h" |
@@ -517,6 +518,7 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | |||
517 | void openMenu_Widget(iWidget *d, iInt2 coord) { | 518 | void openMenu_Widget(iWidget *d, iInt2 coord) { |
518 | const iInt2 rootSize = rootSize_Window(get_Window()); | 519 | const iInt2 rootSize = rootSize_Window(get_Window()); |
519 | const iBool isPortraitPhone = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); | 520 | const iBool isPortraitPhone = (deviceType_App() == phone_AppDeviceType && isPortrait_App()); |
521 | const iBool isSlidePanel = (flags_Widget(d) & horizontalOffset_WidgetFlag) != 0; | ||
520 | /* Menu closes when commands are emitted, so handle any pending ones beforehand. */ | 522 | /* Menu closes when commands are emitted, so handle any pending ones beforehand. */ |
521 | postCommand_App("cancel"); /* dismiss any other menus */ | 523 | postCommand_App("cancel"); /* dismiss any other menus */ |
522 | processEvents_App(postedEventsOnly_AppEventMode); | 524 | processEvents_App(postedEventsOnly_AppEventMode); |
@@ -526,6 +528,9 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
526 | if (isPortraitPhone) { | 528 | if (isPortraitPhone) { |
527 | setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, iFalse); | 529 | setFlags_Widget(d, arrangeWidth_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, iFalse); |
528 | setFlags_Widget(d, resizeWidthOfChildren_WidgetFlag, iTrue); | 530 | setFlags_Widget(d, resizeWidthOfChildren_WidgetFlag, iTrue); |
531 | if (!isSlidePanel) { | ||
532 | setFlags_Widget(d, borderTop_WidgetFlag, iTrue); | ||
533 | } | ||
529 | d->rect.size.x = rootSize_Window(get_Window()).x; | 534 | d->rect.size.x = rootSize_Window(get_Window()).x; |
530 | } | 535 | } |
531 | /* Update item fonts. */ { | 536 | /* Update item fonts. */ { |
@@ -537,7 +542,9 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
537 | setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId); | 542 | setFont_LabelWidget(label, isCaution ? uiLabelBold_FontId : uiLabel_FontId); |
538 | } | 543 | } |
539 | else if (isPortraitPhone) { | 544 | else if (isPortraitPhone) { |
540 | setFont_LabelWidget(label, isCaution ? defaultBigBold_FontId : defaultBig_FontId); | 545 | if (!isSlidePanel) { |
546 | setFont_LabelWidget(label, isCaution ? defaultBigBold_FontId : defaultBig_FontId); | ||
547 | } | ||
541 | } | 548 | } |
542 | else { | 549 | else { |
543 | setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId); | 550 | setFont_LabelWidget(label, isCaution ? uiContentBold_FontId : uiContent_FontId); |
@@ -547,7 +554,12 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
547 | } | 554 | } |
548 | arrange_Widget(d); | 555 | arrange_Widget(d); |
549 | if (isPortraitPhone) { | 556 | if (isPortraitPhone) { |
550 | d->rect.pos = init_I2(0, rootSize.y); | 557 | if (isSlidePanel) { |
558 | d->rect.pos = zero_I2(); //neg_I2(bounds_Widget(parent_Widget(d)).pos); | ||
559 | } | ||
560 | else { | ||
561 | d->rect.pos = init_I2(0, rootSize.y); | ||
562 | } | ||
551 | } | 563 | } |
552 | else { | 564 | else { |
553 | d->rect.pos = coord; | 565 | d->rect.pos = coord; |
@@ -568,7 +580,7 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
568 | rightExcess += r; | 580 | rightExcess += r; |
569 | } | 581 | } |
570 | #endif | 582 | #endif |
571 | if (bottomExcess > 0) { | 583 | if (bottomExcess > 0 && (!isPortraitPhone || !isSlidePanel)) { |
572 | d->rect.pos.y -= bottomExcess; | 584 | d->rect.pos.y -= bottomExcess; |
573 | } | 585 | } |
574 | if (topExcess > 0) { | 586 | if (topExcess > 0) { |
@@ -583,7 +595,7 @@ void openMenu_Widget(iWidget *d, iInt2 coord) { | |||
583 | postRefresh_App(); | 595 | postRefresh_App(); |
584 | postCommand_Widget(d, "menu.opened"); | 596 | postCommand_Widget(d, "menu.opened"); |
585 | if (isPortraitPhone) { | 597 | if (isPortraitPhone) { |
586 | setVisualOffset_Widget(d, height_Widget(d), 0, 0); | 598 | setVisualOffset_Widget(d, isSlidePanel ? width_Widget(d) : height_Widget(d), 0, 0); |
587 | setVisualOffset_Widget(d, 0, 330, easeOut_AnimFlag | softer_AnimFlag); | 599 | setVisualOffset_Widget(d, 0, 330, easeOut_AnimFlag | softer_AnimFlag); |
588 | } | 600 | } |
589 | } | 601 | } |
@@ -594,7 +606,11 @@ void closeMenu_Widget(iWidget *d) { | |||
594 | postRefresh_App(); | 606 | postRefresh_App(); |
595 | postCommand_Widget(d, "menu.closed"); | 607 | postCommand_Widget(d, "menu.closed"); |
596 | if (isPortrait_App() && deviceType_App() == phone_AppDeviceType) { | 608 | if (isPortrait_App() && deviceType_App() == phone_AppDeviceType) { |
597 | setVisualOffset_Widget(d, height_Widget(d), 200, easeIn_AnimFlag | softer_AnimFlag); | 609 | setVisualOffset_Widget(d, |
610 | flags_Widget(d) & horizontalOffset_WidgetFlag ? | ||
611 | width_Widget(d) : height_Widget(d), | ||
612 | 200, | ||
613 | easeIn_AnimFlag | softer_AnimFlag); | ||
598 | } | 614 | } |
599 | } | 615 | } |
600 | 616 | ||
@@ -882,7 +898,43 @@ iWidget *makeSheet_Widget(const char *id) { | |||
882 | return sheet; | 898 | return sheet; |
883 | } | 899 | } |
884 | 900 | ||
901 | static iBool slidePanelHandler_(iWidget *d, const char *cmd) { | ||
902 | if (equal_Command(cmd, "panel.open")) { | ||
903 | iWidget *button = pointer_Command(cmd); | ||
904 | iWidget *panel = userData_Object(button); | ||
905 | openMenu_Widget(panel, zero_I2()); | ||
906 | updateTextCStr_LabelWidget(findWidget_App("panel.back"), "Settings"); | ||
907 | return iTrue; | ||
908 | } | ||
909 | if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd) && | ||
910 | argLabel_Command(cmd, "button") == SDL_BUTTON_X1) { | ||
911 | postCommand_App("panel.close"); | ||
912 | return iTrue; | ||
913 | } | ||
914 | if (equal_Command(cmd, "panel.close")) { | ||
915 | iBool wasClosed = iFalse; | ||
916 | iForEach(ObjectList, i, children_Widget(parent_Widget(d))) { | ||
917 | iWidget *child = i.object; | ||
918 | if (!cmp_String(id_Widget(child), "panel") && isVisible_Widget(child)) { | ||
919 | closeMenu_Widget(child); | ||
920 | setFocus_Widget(NULL); | ||
921 | updateTextCStr_LabelWidget(findWidget_App("panel.back"), "Back"); | ||
922 | wasClosed = iTrue; | ||
923 | } | ||
924 | } | ||
925 | if (!wasClosed) { | ||
926 | postCommand_App("prefs.dismiss"); | ||
927 | } | ||
928 | return iTrue; | ||
929 | } | ||
930 | return iFalse; | ||
931 | } | ||
932 | |||
885 | static iBool isTwoColumnPage_(iWidget *d) { | 933 | static iBool isTwoColumnPage_(iWidget *d) { |
934 | if (cmp_String(id_Widget(d), "dialogbuttons") == 0 || | ||
935 | cmp_String(id_Widget(d), "prefs.tabs") == 0) { | ||
936 | return iFalse; | ||
937 | } | ||
886 | if (class_Widget(d) == &Class_Widget && childCount_Widget(d) == 2) { | 938 | if (class_Widget(d) == &Class_Widget && childCount_Widget(d) == 2) { |
887 | return class_Widget(child_Widget(d, 0)) == &Class_Widget && | 939 | return class_Widget(child_Widget(d, 0)) == &Class_Widget && |
888 | class_Widget(child_Widget(d, 1)) == &Class_Widget; | 940 | class_Widget(child_Widget(d, 1)) == &Class_Widget; |
@@ -894,46 +946,129 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
894 | if (deviceType_App() == phone_AppDeviceType) { | 946 | if (deviceType_App() == phone_AppDeviceType) { |
895 | /* The sheet contents are completely rearranged on a phone. We'll set up a linear | 947 | /* The sheet contents are completely rearranged on a phone. We'll set up a linear |
896 | fullscreen arrangement of the widgets. Sheets are already scrollable so they | 948 | fullscreen arrangement of the widgets. Sheets are already scrollable so they |
897 | can be taller than the display. */ | 949 | can be taller than the display. In hindsight, it may have been easier to |
950 | create phone versions of each dialog, but at least this works with any future | ||
951 | changes to the UI (..."works"). */ | ||
952 | int topSafe = 0; | ||
953 | int navBarHeight = lineHeight_Text(defaultBig_FontId) + 4 * gap_UI; | ||
898 | #if defined (iPlatformAppleMobile) | 954 | #if defined (iPlatformAppleMobile) |
899 | /* Safe area insets. */ { | 955 | /* Safe area insets. */ { |
900 | /* TODO: Must be updated when orientation changes; use a widget flag? */ | 956 | /* TODO: Must be updated when orientation changes; use a widget flag? */ |
901 | float l, t, r, b; | 957 | float l, t, r, b; |
902 | safeAreaInsets_iOS(&l, &t, &r, &b); | 958 | safeAreaInsets_iOS(&l, &t, &r, &b); |
903 | setPadding_Widget(sheet, l, t, r, b); | 959 | // setPadding_Widget(sheet, l, t, r, b); |
960 | setPadding1_Widget(sheet, 0); | ||
961 | topSafe = t; | ||
962 | navBarHeight += t; | ||
904 | } | 963 | } |
905 | #endif | 964 | #endif |
906 | setFlags_Widget(sheet, | 965 | setFlags_Widget(sheet, |
907 | parentCannotResize_WidgetFlag | arrangeWidth_WidgetFlag | | 966 | keepOnTop_WidgetFlag | |
908 | centerHorizontal_WidgetFlag, | 967 | parentCannotResize_WidgetFlag | |
968 | arrangeSize_WidgetFlag | | ||
969 | centerHorizontal_WidgetFlag | | ||
970 | arrangeVertical_WidgetFlag | | ||
971 | arrangeHorizontal_WidgetFlag | | ||
972 | overflowScrollable_WidgetFlag, | ||
909 | iFalse); | 973 | iFalse); |
910 | setFlags_Widget(sheet, frameless_WidgetFlag | resizeWidthOfChildren_WidgetFlag, iTrue); | 974 | setFlags_Widget(sheet, |
975 | commandOnClick_WidgetFlag | | ||
976 | frameless_WidgetFlag | | ||
977 | resizeWidthOfChildren_WidgetFlag, | ||
978 | iTrue); | ||
979 | setBackgroundColor_Widget(sheet, green_ColorId); | ||
911 | iPtrArray *contents = collect_PtrArray(new_PtrArray()); /* two-column pages */ | 980 | iPtrArray *contents = collect_PtrArray(new_PtrArray()); /* two-column pages */ |
981 | iPtrArray *panelButtons = collect_PtrArray(new_PtrArray()); | ||
912 | iWidget *tabs = findChild_Widget(sheet, "prefs.tabs"); | 982 | iWidget *tabs = findChild_Widget(sheet, "prefs.tabs"); |
983 | iWidget *topPanel = new_Widget(); | ||
984 | setId_Widget(topPanel, "panel.top"); | ||
985 | //setBackgroundColor_Widget(topPanel, red_ColorId); | ||
913 | if (tabs) { | 986 | if (tabs) { |
914 | /* Pull out the pages and make them sequential. */ | 987 | iRelease(removeChild_Widget(sheet, child_Widget(sheet, 0))); /* heading */ |
988 | iRelease(removeChild_Widget(sheet, findChild_Widget(sheet, "dialogbuttons"))); | ||
989 | /* Pull out the pages and make them panels. */ | ||
915 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); | 990 | iWidget *pages = findChild_Widget(tabs, "tabs.pages"); |
916 | size_t pageCount = tabCount_Widget(tabs); | 991 | size_t pageCount = tabCount_Widget(tabs); |
917 | for (size_t i = 0; i < pageCount; i++) { | 992 | for (size_t i = 0; i < pageCount; i++) { |
993 | iString *text = copy_String(text_LabelWidget(tabPageButton_Widget(tabs, tabPage_Widget(tabs, 0)))); | ||
918 | iWidget *page = removeTabPage_Widget(tabs, 0); | 994 | iWidget *page = removeTabPage_Widget(tabs, 0); |
919 | iWidget *pageContent = child_Widget(page, 1); /* surrounded by padding widgets */ | 995 | iWidget *pageContent = child_Widget(page, 1); /* surrounded by padding widgets */ |
920 | pushBack_PtrArray(contents, ref_Object(pageContent)); | 996 | pushBack_PtrArray(contents, ref_Object(pageContent)); |
997 | iLabelWidget *panelButton; | ||
998 | pushBack_PtrArray(panelButtons, | ||
999 | addChildFlags_Widget(topPanel, | ||
1000 | iClob(panelButton = new_LabelWidget | ||
1001 | (i == 1 ? "User Interface" : cstr_String(text), | ||
1002 | "panel.open")), | ||
1003 | alignLeft_WidgetFlag | frameless_WidgetFlag | | ||
1004 | borderBottom_WidgetFlag | extraPadding_WidgetFlag | | ||
1005 | chevron_WidgetFlag)); | ||
1006 | const iChar icons[] = { | ||
1007 | 0x2699, /* gear */ | ||
1008 | 0x1f4f1, /* mobile phone */ | ||
1009 | 0x1f3a8, /* palette */ | ||
1010 | 0x1f523, | ||
1011 | 0x1f5a7, /* computer network */ | ||
1012 | }; | ||
1013 | setIcon_LabelWidget(panelButton, icons[i]); | ||
1014 | setFont_LabelWidget(panelButton, defaultBig_FontId); | ||
1015 | setBackgroundColor_Widget(as_Widget(panelButton), uiBackgroundSidebar_ColorId); | ||
921 | iRelease(page); | 1016 | iRelease(page); |
1017 | delete_String(text); | ||
922 | } | 1018 | } |
923 | destroy_Widget(tabs); | 1019 | destroy_Widget(tabs); |
924 | } | 1020 | } |
925 | else { | 1021 | iForEach(ObjectList, i, children_Widget(sheet)) { |
926 | iForEach(ObjectList, i, children_Widget(sheet)) { | 1022 | iWidget *child = i.object; |
927 | iWidget *child = i.object; | 1023 | if (isTwoColumnPage_(child)) { |
928 | if (isTwoColumnPage_(child)) { | 1024 | printf("Non-tabbed two-column page:\n"); |
929 | pushBack_PtrArray(contents, removeChild_Widget(sheet, child)); | 1025 | printTree_Widget(child); |
930 | } | 1026 | pushBack_PtrArray(contents, removeChild_Widget(sheet, child)); |
1027 | } | ||
1028 | else { | ||
1029 | removeChild_Widget(sheet, child); | ||
1030 | addChild_Widget(topPanel, child); | ||
1031 | iRelease(child); | ||
931 | } | 1032 | } |
932 | } | 1033 | } |
1034 | iAssert(size_PtrArray(contents) == size_PtrArray(panelButtons)); | ||
1035 | topPanel->rect.pos = init_I2(0, navBarHeight); | ||
1036 | addChildFlags_Widget(sheet, iClob(topPanel), | ||
1037 | arrangeVertical_WidgetFlag | | ||
1038 | resizeWidthOfChildren_WidgetFlag | arrangeHeight_WidgetFlag | | ||
1039 | overflowScrollable_WidgetFlag | | ||
1040 | commandOnClick_WidgetFlag); | ||
1041 | setCommandHandler_Widget(topPanel, slidePanelHandler_); | ||
933 | iForEach(PtrArray, j, contents) { | 1042 | iForEach(PtrArray, j, contents) { |
1043 | iWidget *owner = topPanel; | ||
1044 | if (!isEmpty_PtrArray(panelButtons)) { | ||
1045 | iLabelWidget *button = at_PtrArray(panelButtons, index_PtrArrayIterator(&j)); | ||
1046 | owner = new_Widget(); | ||
1047 | setId_Widget(owner, "panel"); | ||
1048 | setUserData_Object(button, owner); | ||
1049 | setBackgroundColor_Widget(owner, uiBackground_ColorId); | ||
1050 | addChild_Widget(owner, iClob(makePadding_Widget(navBarHeight - topSafe))); | ||
1051 | iLabelWidget *title = addChildFlags_Widget(owner, | ||
1052 | iClob(new_LabelWidget(cstr_String(text_LabelWidget(button)), NULL)), alignLeft_WidgetFlag | frameless_WidgetFlag); | ||
1053 | setFont_LabelWidget(title, uiLabelLargeBold_FontId); | ||
1054 | setTextColor_LabelWidget(title, uiHeading_ColorId); | ||
1055 | addChildFlags_Widget(sheet, | ||
1056 | iClob(owner), | ||
1057 | focusRoot_WidgetFlag | | ||
1058 | //mouseModal_WidgetFlag | | ||
1059 | hidden_WidgetFlag | | ||
1060 | disabled_WidgetFlag | | ||
1061 | arrangeVertical_WidgetFlag | | ||
1062 | resizeWidthOfChildren_WidgetFlag | | ||
1063 | arrangeHeight_WidgetFlag | | ||
1064 | overflowScrollable_WidgetFlag | | ||
1065 | horizontalOffset_WidgetFlag | | ||
1066 | commandOnClick_WidgetFlag); | ||
1067 | } | ||
934 | iWidget *pageContent = j.ptr; | 1068 | iWidget *pageContent = j.ptr; |
935 | iWidget *headings = child_Widget(pageContent, 0); | 1069 | iWidget *headings = child_Widget(pageContent, 0); |
936 | iWidget *values = child_Widget(pageContent, 1); | 1070 | iWidget *values = child_Widget(pageContent, 1); |
1071 | iBool isFirst = iTrue; | ||
937 | while (!isEmpty_ObjectList(children_Widget(headings))) { | 1072 | while (!isEmpty_ObjectList(children_Widget(headings))) { |
938 | iWidget *heading = child_Widget(headings, 0); | 1073 | iWidget *heading = child_Widget(headings, 0); |
939 | iWidget *value = child_Widget(values, 0); | 1074 | iWidget *value = child_Widget(values, 0); |
@@ -968,7 +1103,7 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
968 | setFont_LabelWidget((iLabelWidget *) heading, defaultBig_FontId); | 1103 | setFont_LabelWidget((iLabelWidget *) heading, defaultBig_FontId); |
969 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); | 1104 | addChildFlags_Widget(div, iClob(new_Widget()), expand_WidgetFlag); |
970 | addChild_Widget(div, iClob(value)); | 1105 | addChild_Widget(div, iClob(value)); |
971 | addChildFlags_Widget(sheet, | 1106 | addChildFlags_Widget(owner, |
972 | iClob(div), | 1107 | iClob(div), |
973 | borderBottom_WidgetFlag | arrangeHeight_WidgetFlag | | 1108 | borderBottom_WidgetFlag | arrangeHeight_WidgetFlag | |
974 | resizeWidthOfChildren_WidgetFlag | | 1109 | resizeWidthOfChildren_WidgetFlag | |
@@ -977,12 +1112,17 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
977 | else { | 1112 | else { |
978 | if (valueLabel && isEmpty_String(text_LabelWidget(valueLabel))) { | 1113 | if (valueLabel && isEmpty_String(text_LabelWidget(valueLabel))) { |
979 | /* Subheading padding goes above. */ | 1114 | /* Subheading padding goes above. */ |
980 | addChild_Widget(sheet, iClob(value)); | 1115 | // if (!isFirst) { |
981 | addChildFlags_Widget(sheet, iClob(heading), 0); | 1116 | // addChild_Widget(owner, iClob(value)); |
1117 | // } | ||
1118 | // else { | ||
1119 | iRelease(value); | ||
1120 | // } | ||
1121 | addChildFlags_Widget(owner, iClob(heading), 0); | ||
982 | setFont_LabelWidget(headingLabel, uiLabelBold_FontId); | 1122 | setFont_LabelWidget(headingLabel, uiLabelBold_FontId); |
983 | } | 1123 | } |
984 | else { | 1124 | else { |
985 | addChildFlags_Widget(sheet, iClob(heading), borderBottom_WidgetFlag); | 1125 | addChildFlags_Widget(owner, iClob(heading), borderBottom_WidgetFlag); |
986 | if (headingLabel) { | 1126 | if (headingLabel) { |
987 | setTextColor_LabelWidget(headingLabel, uiSubheading_ColorId); | 1127 | setTextColor_LabelWidget(headingLabel, uiSubheading_ColorId); |
988 | setText_LabelWidget(headingLabel, | 1128 | setText_LabelWidget(headingLabel, |
@@ -999,14 +1139,14 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
999 | setBackgroundColor_Widget(pad, uiBackgroundSidebar_ColorId); | 1139 | setBackgroundColor_Widget(pad, uiBackgroundSidebar_ColorId); |
1000 | setPadding_Widget(pad, 0, 1 * gap_UI, 0, 1 * gap_UI); | 1140 | setPadding_Widget(pad, 0, 1 * gap_UI, 0, 1 * gap_UI); |
1001 | addChild_Widget(pad, iClob(value)); | 1141 | addChild_Widget(pad, iClob(value)); |
1002 | addChildFlags_Widget(sheet, iClob(pad), borderBottom_WidgetFlag | | 1142 | addChildFlags_Widget(owner, iClob(pad), borderBottom_WidgetFlag | |
1003 | arrangeVertical_WidgetFlag | | 1143 | arrangeVertical_WidgetFlag | |
1004 | resizeToParentWidth_WidgetFlag | | 1144 | resizeToParentWidth_WidgetFlag | |
1005 | resizeWidthOfChildren_WidgetFlag | | 1145 | resizeWidthOfChildren_WidgetFlag | |
1006 | arrangeHeight_WidgetFlag); | 1146 | arrangeHeight_WidgetFlag); |
1007 | } | 1147 | } |
1008 | else { | 1148 | else { |
1009 | addChild_Widget(sheet, iClob(value)); | 1149 | addChild_Widget(owner, iClob(value)); |
1010 | } | 1150 | } |
1011 | /* Align radio buttons to the right. */ | 1151 | /* Align radio buttons to the right. */ |
1012 | if (childCount_Widget(value) >= 2) { | 1152 | if (childCount_Widget(value) >= 2) { |
@@ -1021,15 +1161,35 @@ void finalizeSheet_Widget(iWidget *sheet) { | |||
1021 | if (isInstance_Object(sub.object, &Class_LabelWidget)) { | 1161 | if (isInstance_Object(sub.object, &Class_LabelWidget)) { |
1022 | iLabelWidget *opt = sub.object; | 1162 | iLabelWidget *opt = sub.object; |
1023 | setFont_LabelWidget(opt, defaultMedium_FontId); | 1163 | setFont_LabelWidget(opt, defaultMedium_FontId); |
1164 | setFlags_Widget(as_Widget(opt), noBackground_WidgetFlag, iTrue); | ||
1024 | } | 1165 | } |
1025 | } | 1166 | } |
1026 | } | 1167 | } |
1027 | } | 1168 | } |
1028 | } | 1169 | } |
1170 | isFirst = iFalse; | ||
1029 | } | 1171 | } |
1030 | destroy_Widget(pageContent); | 1172 | destroy_Widget(pageContent); |
1173 | addChildFlags_Widget(owner, iClob(new_Widget()), expand_WidgetFlag); | ||
1031 | } | 1174 | } |
1032 | destroyPending_Widget(); | 1175 | destroyPending_Widget(); |
1176 | /* Navbar. */ { | ||
1177 | iWidget *navi = new_Widget(); | ||
1178 | setSize_Widget(navi, init_I2(-1, navBarHeight)); | ||
1179 | setBackgroundColor_Widget(navi, uiBackground_ColorId); | ||
1180 | addChild_Widget(navi, iClob(makePadding_Widget(topSafe))); | ||
1181 | iLabelWidget *back = addChildFlags_Widget(navi, | ||
1182 | iClob(new_LabelWidget(leftAngle_Icon " Back", "panel.close")), | ||
1183 | noBackground_WidgetFlag | frameless_WidgetFlag | | ||
1184 | alignLeft_WidgetFlag | extraPadding_WidgetFlag); | ||
1185 | setId_Widget(as_Widget(back), "panel.back"); | ||
1186 | checkIcon_LabelWidget(back); | ||
1187 | setFont_LabelWidget(back, defaultBig_FontId); | ||
1188 | addChildFlags_Widget(sheet, iClob(navi), | ||
1189 | arrangeHeight_WidgetFlag | resizeWidthOfChildren_WidgetFlag | | ||
1190 | resizeToParentWidth_WidgetFlag | arrangeVertical_WidgetFlag | | ||
1191 | borderBottom_WidgetFlag); | ||
1192 | } | ||
1033 | arrange_Widget(sheet->parent); | 1193 | arrange_Widget(sheet->parent); |
1034 | printTree_Widget(sheet); | 1194 | printTree_Widget(sheet); |
1035 | } | 1195 | } |
@@ -1125,6 +1285,7 @@ iBool valueInputHandler_(iWidget *dlg, const char *cmd) { | |||
1125 | 1285 | ||
1126 | iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) { | 1286 | iWidget *makeDialogButtons_Widget(const iMenuItem *actions, size_t numActions) { |
1127 | iWidget *div = new_Widget(); | 1287 | iWidget *div = new_Widget(); |
1288 | setId_Widget(div, "dialogbuttons"); | ||
1128 | setFlags_Widget(div, | 1289 | setFlags_Widget(div, |
1129 | arrangeHorizontal_WidgetFlag | arrangeHeight_WidgetFlag | | 1290 | arrangeHorizontal_WidgetFlag | arrangeHeight_WidgetFlag | |
1130 | resizeToParentWidth_WidgetFlag | | 1291 | resizeToParentWidth_WidgetFlag | |