LibGUI: Convert GSpinBox to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 16:15:11 +02:00
parent 83b5f6c11a
commit b78225941d
Notes: sideshowbarker 2024-07-19 12:02:00 +09:00
4 changed files with 6 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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: