diff options
Diffstat (limited to 'src/ui/util.c')
-rw-r--r-- | src/ui/util.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/ui/util.c b/src/ui/util.c index 185d37f3..05b3c930 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -168,8 +168,9 @@ iWidget *makeMenu_Widget(iWidget *parent, const iMenuItem *items, size_t n) { | |||
168 | setFrameColor_Widget(menu, black_ColorId); | 168 | setFrameColor_Widget(menu, black_ColorId); |
169 | setBackgroundColor_Widget(menu, gray25_ColorId); | 169 | setBackgroundColor_Widget(menu, gray25_ColorId); |
170 | setFlags_Widget(menu, | 170 | setFlags_Widget(menu, |
171 | keepOnTop_WidgetFlag | hidden_WidgetFlag | arrangeVertical_WidgetFlag | | 171 | keepOnTop_WidgetFlag | collapse_WidgetFlag | hidden_WidgetFlag | |
172 | arrangeSize_WidgetFlag | resizeChildrenToWidestChild_WidgetFlag, | 172 | arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag | |
173 | resizeChildrenToWidestChild_WidgetFlag, | ||
173 | iTrue); | 174 | iTrue); |
174 | for (size_t i = 0; i < n; ++i) { | 175 | for (size_t i = 0; i < n; ++i) { |
175 | const iMenuItem *item = &items[i]; | 176 | const iMenuItem *item = &items[i]; |
@@ -659,10 +660,8 @@ iWidget *makeQuestion_Widget(const char *title, | |||
659 | 660 | ||
660 | void setToggle_Widget(iWidget *d, iBool active) { | 661 | void setToggle_Widget(iWidget *d, iBool active) { |
661 | setFlags_Widget(d, selected_WidgetFlag, active); | 662 | setFlags_Widget(d, selected_WidgetFlag, active); |
662 | updateText_LabelWidget( | 663 | updateText_LabelWidget((iLabelWidget *) d, |
663 | (iLabelWidget *) d, | 664 | collectNewFormat_String("%s", isSelected_Widget(d) ? "YES" : "NO")); |
664 | collectNewFormat_String( | ||
665 | "%s", isSelected_Widget(d) ? "YES" : "NO")); | ||
666 | } | 665 | } |
667 | 666 | ||
668 | static iBool toggleHandler_(iWidget *d, const char *cmd) { | 667 | static iBool toggleHandler_(iWidget *d, const char *cmd) { |
@@ -709,3 +708,38 @@ iWidget *makePreferences_Widget(void) { | |||
709 | centerSheet_Widget(dlg); | 708 | centerSheet_Widget(dlg); |
710 | return dlg; | 709 | return dlg; |
711 | } | 710 | } |
711 | |||
712 | iWidget *makeBookmarkEditor_Widget(void) { | ||
713 | iWidget *dlg = makeSheet_Widget("bmed"); | ||
714 | addChild_Widget(dlg, iClob(new_LabelWidget(cyan_ColorEscape "EDIT BOOKMARK", 0, 0, NULL))); | ||
715 | iWidget *page = new_Widget(); | ||
716 | addChild_Widget(dlg, iClob(page)); | ||
717 | setFlags_Widget(page, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue); | ||
718 | iWidget *headings = addChildFlags_Widget( | ||
719 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); | ||
720 | iWidget *values = addChildFlags_Widget( | ||
721 | page, iClob(new_Widget()), arrangeVertical_WidgetFlag | arrangeSize_WidgetFlag); | ||
722 | iInputWidget *inputs[4]; | ||
723 | addChild_Widget(headings, iClob(makeHeading_Widget("Title:"))); | ||
724 | setId_Widget(addChild_Widget(values, iClob(inputs[0] = new_InputWidget(0))), "bmed.title"); | ||
725 | addChild_Widget(headings, iClob(makeHeading_Widget("URL:"))); | ||
726 | setId_Widget(addChild_Widget(values, iClob(inputs[1] = new_InputWidget(0))), "bmed.url"); | ||
727 | addChild_Widget(headings, iClob(makeHeading_Widget("Tags:"))); | ||
728 | setId_Widget(addChild_Widget(values, iClob(inputs[2] = new_InputWidget(0))), "bmed.tags"); | ||
729 | arrange_Widget(dlg); | ||
730 | for (int i = 0; i < 3; ++i) { | ||
731 | as_Widget(inputs[i])->rect.size.x = dlg->rect.size.x - headings->rect.size.x - 3 * gap_UI; | ||
732 | } | ||
733 | iWidget *div = new_Widget(); { | ||
734 | setFlags_Widget(div, arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag, iTrue); | ||
735 | addChild_Widget(div, iClob(new_LabelWidget("Cancel", SDLK_ESCAPE, 0, "cancel"))); | ||
736 | addChild_Widget( | ||
737 | div, | ||
738 | iClob(new_LabelWidget( | ||
739 | orange_ColorEscape "Save", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept"))); | ||
740 | } | ||
741 | addChild_Widget(dlg, iClob(div)); | ||
742 | addChild_Widget(get_Window()->root, iClob(dlg)); | ||
743 | centerSheet_Widget(dlg); | ||
744 | return dlg; | ||
745 | } | ||