From 3f67298dad8150664452d4a99f07ffd36ae58633 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Apr 2019 06:42:07 +0200 Subject: VisualBuilder: Add GScrollBar (and yes, an icon for it, too.) --- Applications/VisualBuilder/VBWidget.cpp | 3 +++ Applications/VisualBuilder/VBWidget.h | 1 + Applications/VisualBuilder/main.cpp | 7 +++++++ 3 files changed, 11 insertions(+) (limited to 'Applications/VisualBuilder') 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 #include #include +#include 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, public Weakable { 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; } -- cgit v1.2.3