diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-11 06:42:07 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-11 06:42:07 +0200 |
commit | 3f67298dad8150664452d4a99f07ffd36ae58633 (patch) | |
tree | e6292d073bb360e147b74a08d91a92b57773d900 /Applications/VisualBuilder | |
parent | f25c524f2003c9f26345e6307a52d176172e1cc0 (diff) | |
download | serenity-3f67298dad8150664452d4a99f07ffd36ae58633.zip |
VisualBuilder: Add GScrollBar (and yes, an icon for it, too.)
Diffstat (limited to 'Applications/VisualBuilder')
-rw-r--r-- | Applications/VisualBuilder/VBWidget.cpp | 3 | ||||
-rw-r--r-- | Applications/VisualBuilder/VBWidget.h | 1 | ||||
-rw-r--r-- | Applications/VisualBuilder/main.cpp | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/Applications/VisualBuilder/VBWidget.cpp b/Applications/VisualBuilder/VBWidget.cpp index 4bf5e9b377..2e9cc0c332 100644 --- a/Applications/VisualBuilder/VBWidget.cpp +++ b/Applications/VisualBuilder/VBWidget.cpp @@ -7,12 +7,15 @@ #include <LibGUI/GTextEditor.h> #include <LibGUI/GProgressBar.h> #include <LibGUI/GCheckBox.h> +#include <LibGUI/GScrollBar.h> static GWidget* build_gwidget(WidgetType type, GWidget* parent) { switch (type) { case WidgetType::GWidget: return new GWidget(parent); + case WidgetType::GScrollBar: + return new GScrollBar(Orientation::Vertical, parent); case WidgetType::GLabel: { auto* label = new GLabel(parent); label->set_text("label_1"); diff --git a/Applications/VisualBuilder/VBWidget.h b/Applications/VisualBuilder/VBWidget.h index c88305b5f1..178ba6a725 100644 --- a/Applications/VisualBuilder/VBWidget.h +++ b/Applications/VisualBuilder/VBWidget.h @@ -32,6 +32,7 @@ enum class WidgetType { GTextEditor, GProgressBar, GCheckBox, + GScrollBar, }; class VBWidget : public Retainable<VBWidget>, public Weakable<VBWidget> { diff --git a/Applications/VisualBuilder/main.cpp b/Applications/VisualBuilder/main.cpp index b1ed9ee5fc..c8c56e0139 100644 --- a/Applications/VisualBuilder/main.cpp +++ b/Applications/VisualBuilder/main.cpp @@ -109,5 +109,12 @@ GWindow* make_toolbox_window() if (auto* form = VBForm::current()) form->insert_widget(WidgetType::GCheckBox); }; + auto* scrollbar_button = new GButton(widget); + scrollbar_button->set_tooltip("GScrollBar"); + scrollbar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png")); + scrollbar_button->on_click = [] (GButton&) { + if (auto* form = VBForm::current()) + form->insert_widget(WidgetType::GScrollBar); + }; return window; } |