summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'Applications')
-rw-r--r--Applications/VisualBuilder/VBWidget.cpp7
-rw-r--r--Applications/VisualBuilder/VBWidgetRegistry.cpp8
-rw-r--r--Applications/VisualBuilder/VBWidgetType.h1
-rw-r--r--Applications/VisualBuilder/main.cpp7
4 files changed, 23 insertions, 0 deletions
diff --git a/Applications/VisualBuilder/VBWidget.cpp b/Applications/VisualBuilder/VBWidget.cpp
index 6341b35cd3..83e92167de 100644
--- a/Applications/VisualBuilder/VBWidget.cpp
+++ b/Applications/VisualBuilder/VBWidget.cpp
@@ -12,6 +12,7 @@
#include <LibGUI/GGroupBox.h>
#include <LibGUI/GCheckBox.h>
#include <LibGUI/GProgressBar.h>
+#include <LibGUI/GSlider.h>
VBWidget::VBWidget(VBWidgetType type, VBForm& form)
: m_type(type)
@@ -148,6 +149,12 @@ void VBWidget::setup_properties()
VB_ADD_PROPERTY(GProgressBar, "value", value, set_value, int);
}
+ if (m_type == VBWidgetType::GSlider) {
+ VB_ADD_PROPERTY(GSlider, "min", min, set_min, int);
+ VB_ADD_PROPERTY(GSlider, "max", max, set_max, int);
+ VB_ADD_PROPERTY(GSlider, "value", value, set_value, int);
+ }
+
if (m_type == VBWidgetType::GTextEditor) {
VB_ADD_PROPERTY(GTextEditor, "text", text, set_text, string);
VB_ADD_PROPERTY(GTextEditor, "ruler_visible", is_ruler_visible, set_ruler_visible, bool);
diff --git a/Applications/VisualBuilder/VBWidgetRegistry.cpp b/Applications/VisualBuilder/VBWidgetRegistry.cpp
index 7aacaddda3..3bde68ec3d 100644
--- a/Applications/VisualBuilder/VBWidgetRegistry.cpp
+++ b/Applications/VisualBuilder/VBWidgetRegistry.cpp
@@ -8,6 +8,7 @@
#include <LibGUI/GCheckBox.h>
#include <LibGUI/GScrollBar.h>
#include <LibGUI/GGroupBox.h>
+#include <LibGUI/GSlider.h>
static String to_class_name(VBWidgetType type)
{
@@ -21,6 +22,7 @@ static String to_class_name(VBWidgetType type)
case VBWidgetType::GCheckBox: return "GCheckBox";
case VBWidgetType::GScrollBar: return "GScrollBar";
case VBWidgetType::GGroupBox: return "GGroupBox";
+ case VBWidgetType::GSlider: return "GSlider";
default: ASSERT_NOT_REACHED();
}
}
@@ -63,6 +65,12 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
bar->set_value(50);
return bar;
}
+ case VBWidgetType::GSlider: {
+ auto* slider = new GSlider(parent);
+ slider->set_range(0, 100);
+ slider->set_value(50);
+ return slider;
+ }
case VBWidgetType::GCheckBox: {
auto* box = new GCheckBox(parent);
box->set_caption("checkbox_1");
diff --git a/Applications/VisualBuilder/VBWidgetType.h b/Applications/VisualBuilder/VBWidgetType.h
index 6ca8a6f4b2..1d0487a478 100644
--- a/Applications/VisualBuilder/VBWidgetType.h
+++ b/Applications/VisualBuilder/VBWidgetType.h
@@ -11,5 +11,6 @@ enum class VBWidgetType {
GCheckBox,
GScrollBar,
GGroupBox,
+ GSlider,
__Count
};
diff --git a/Applications/VisualBuilder/main.cpp b/Applications/VisualBuilder/main.cpp
index b994315a36..0e00ab45c5 100644
--- a/Applications/VisualBuilder/main.cpp
+++ b/Applications/VisualBuilder/main.cpp
@@ -112,6 +112,13 @@ GWindow* make_toolbox_window()
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GProgressBar);
};
+ auto* slider_button = new GButton(widget);
+ slider_button->set_tooltip("GSlider");
+ slider_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/slider.png"));
+ slider_button->on_click = [] (GButton&) {
+ if (auto* form = VBForm::current())
+ form->insert_widget(VBWidgetType::GSlider);
+ };
auto* checkbox_button = new GButton(widget);
checkbox_button->set_tooltip("GCheckBox");
checkbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/checkbox.png"));