diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 16:15:11 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 16:15:11 +0200 |
commit | b78225941d7b49680f02bba3210296334dd4b532 (patch) | |
tree | 7d9c0e57702e10cc740992a7b64970e0c17ceb7e | |
parent | 83b5f6c11a7bd3da5c771b2182b4096e23a75287 (diff) | |
download | serenity-b78225941d7b49680f02bba3210296334dd4b532.zip |
LibGUI: Convert GSpinBox to ObjectPtr
-rw-r--r-- | Applications/PaintBrush/ColorDialog.cpp | 2 | ||||
-rwxr-xr-x | Demos/WidgetGallery/main.cpp | 4 | ||||
-rw-r--r-- | DevTools/VisualBuilder/VBWidgetRegistry.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/GSpinBox.h | 3 |
4 files changed, 6 insertions, 5 deletions
diff --git a/Applications/PaintBrush/ColorDialog.cpp b/Applications/PaintBrush/ColorDialog.cpp index c05c24dd8b..703c2c7fc3 100644 --- a/Applications/PaintBrush/ColorDialog.cpp +++ b/Applications/PaintBrush/ColorDialog.cpp @@ -53,7 +53,7 @@ void ColorDialog::build() }; auto make_spinbox = [&](RGBComponent component, int initial_value) { - auto* spinbox = new GSpinBox(left_vertical_container); + auto spinbox = GSpinBox::construct(left_vertical_container); spinbox->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); spinbox->set_preferred_size(0, 20); spinbox->set_min(0); diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp index f26372ed22..64cbe9657d 100755 --- a/Demos/WidgetGallery/main.cpp +++ b/Demos/WidgetGallery/main.cpp @@ -61,9 +61,9 @@ int main(int argc, char** argv) textbox2->set_text("GTextBox 2"); textbox2->set_enabled(false); - auto* spinbox1 = new GSpinBox(main_widget); + auto spinbox1 = GSpinBox::construct(main_widget); (void)spinbox1; - auto* spinbox2 = new GSpinBox(main_widget); + auto spinbox2 = GSpinBox::construct(main_widget); spinbox2->set_enabled(false); auto* vertical_slider_container = new GWidget(main_widget); diff --git a/DevTools/VisualBuilder/VBWidgetRegistry.cpp b/DevTools/VisualBuilder/VBWidgetRegistry.cpp index 86b68b9159..3852a9b9d9 100644 --- a/DevTools/VisualBuilder/VBWidgetRegistry.cpp +++ b/DevTools/VisualBuilder/VBWidgetRegistry.cpp @@ -89,7 +89,7 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent) return button; } case VBWidgetType::GSpinBox: { - auto* box = new GSpinBox(parent); + auto box = GSpinBox::construct(parent); box->set_range(0, 100); box->set_value(0); return box; diff --git a/Libraries/LibGUI/GSpinBox.h b/Libraries/LibGUI/GSpinBox.h index 476e406cac..009bc99f00 100644 --- a/Libraries/LibGUI/GSpinBox.h +++ b/Libraries/LibGUI/GSpinBox.h @@ -8,7 +8,6 @@ class GTextEditor; class GSpinBox : public GWidget { C_OBJECT(GSpinBox) public: - GSpinBox(GWidget* parent = nullptr); virtual ~GSpinBox() override; int value() const { return m_value; } @@ -23,6 +22,8 @@ public: Function<void(int value)> on_change; protected: + explicit GSpinBox(GWidget* parent = nullptr); + virtual void resize_event(GResizeEvent&) override; private: |