diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-23 09:01:05 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-23 11:10:52 +0100 |
commit | 428582e805a28a9d1a08828443c95d432a3c9349 (patch) | |
tree | 033a1d9868fb954d5a3332f3470562f640000944 /Libraries/LibGUI | |
parent | d9e459293b58ce1c79e7c4b89dd927546a691880 (diff) | |
download | serenity-428582e805a28a9d1a08828443c95d432a3c9349.zip |
LibGUI: Don't require passing a parent to widget constructors
This is a step towards using Core::Object::add<T> more, which takes
care of parenting the newly created child automatically.
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/AbstractButton.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/AbstractTableView.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/AbstractView.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/Button.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/CheckBox.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/GroupBox.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/ItemView.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/ListView.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/ProgressBar.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/RadioButton.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/ResizeCorner.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/ScrollBar.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/ScrollableWidget.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/Slider.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/Splitter.h | 6 | ||||
-rw-r--r-- | Libraries/LibGUI/StackWidget.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/StatusBar.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/TabWidget.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/TableView.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/TextBox.h | 2 | ||||
-rw-r--r-- | Libraries/LibGUI/TextEditor.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/ToolBar.h | 4 | ||||
-rw-r--r-- | Libraries/LibGUI/TreeView.h | 2 |
23 files changed, 35 insertions, 35 deletions
diff --git a/Libraries/LibGUI/AbstractButton.h b/Libraries/LibGUI/AbstractButton.h index b6bdf0ad0d..4e504fd9e8 100644 --- a/Libraries/LibGUI/AbstractButton.h +++ b/Libraries/LibGUI/AbstractButton.h @@ -60,8 +60,8 @@ public: void set_auto_repeat_interval(int interval) { m_auto_repeat_interval = interval; } protected: - explicit AbstractButton(Widget* parent); - AbstractButton(const StringView&, Widget* parent); + explicit AbstractButton(Widget* parent = nullptr); + AbstractButton(const StringView&, Widget* parent = nullptr); virtual void mousedown_event(MouseEvent&) override; virtual void mousemove_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/AbstractTableView.h b/Libraries/LibGUI/AbstractTableView.h index e6320abf8d..19b6bcb16f 100644 --- a/Libraries/LibGUI/AbstractTableView.h +++ b/Libraries/LibGUI/AbstractTableView.h @@ -72,7 +72,7 @@ public: protected: virtual ~AbstractTableView() override; - explicit AbstractTableView(Widget* parent); + explicit AbstractTableView(Widget* parent = nullptr); virtual void did_update_model() override; virtual void mouseup_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/AbstractView.h b/Libraries/LibGUI/AbstractView.h index 3c4a87e586..86564bc289 100644 --- a/Libraries/LibGUI/AbstractView.h +++ b/Libraries/LibGUI/AbstractView.h @@ -73,7 +73,7 @@ public: NonnullRefPtr<Gfx::Font> font_for_index(const ModelIndex&) const; protected: - explicit AbstractView(Widget* parent); + explicit AbstractView(Widget* parent = nullptr); virtual ~AbstractView() override; virtual void mousedown_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/Button.h b/Libraries/LibGUI/Button.h index d11cecd9c6..225c8afc94 100644 --- a/Libraries/LibGUI/Button.h +++ b/Libraries/LibGUI/Button.h @@ -62,8 +62,8 @@ public: void set_focusable(bool b) { m_focusable = b; } protected: - Button(const StringView& text, Widget* parent); - explicit Button(Widget* parent); + Button(const StringView& text, Widget* parent = nullptr); + explicit Button(Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; private: diff --git a/Libraries/LibGUI/CheckBox.h b/Libraries/LibGUI/CheckBox.h index 35ff654445..bee9ccad49 100644 --- a/Libraries/LibGUI/CheckBox.h +++ b/Libraries/LibGUI/CheckBox.h @@ -38,8 +38,8 @@ public: virtual void click() override; private: - CheckBox(const StringView&, Widget* parent); - explicit CheckBox(Widget* parent); + CheckBox(const StringView&, Widget* parent = nullptr); + explicit CheckBox(Widget* parent = nullptr); // These don't make sense for a check box, so hide them. using AbstractButton::auto_repeat_interval; diff --git a/Libraries/LibGUI/GroupBox.h b/Libraries/LibGUI/GroupBox.h index 5d9d38fad0..1e1c6164fe 100644 --- a/Libraries/LibGUI/GroupBox.h +++ b/Libraries/LibGUI/GroupBox.h @@ -39,8 +39,8 @@ public: void set_title(const StringView&); protected: - explicit GroupBox(Widget* parent); - GroupBox(const StringView& title, Widget* parent); + explicit GroupBox(Widget* parent = nullptr); + GroupBox(const StringView& title, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; diff --git a/Libraries/LibGUI/ItemView.h b/Libraries/LibGUI/ItemView.h index e67f23635b..625b7e1b3f 100644 --- a/Libraries/LibGUI/ItemView.h +++ b/Libraries/LibGUI/ItemView.h @@ -48,7 +48,7 @@ public: virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; private: - explicit ItemView(Widget* parent); + explicit ItemView(Widget* parent = nullptr); virtual void did_update_model() override; virtual void paint_event(PaintEvent&) override; diff --git a/Libraries/LibGUI/ListView.h b/Libraries/LibGUI/ListView.h index 1d866401e7..070cc1bf04 100644 --- a/Libraries/LibGUI/ListView.h +++ b/Libraries/LibGUI/ListView.h @@ -33,7 +33,7 @@ namespace GUI { class ListView : public AbstractView { C_OBJECT(ListView) public: - explicit ListView(Widget* parent); + explicit ListView(Widget* parent = nullptr); virtual ~ListView() override; int item_height() const { return 16; } diff --git a/Libraries/LibGUI/ProgressBar.h b/Libraries/LibGUI/ProgressBar.h index 39507bfb7a..02bafeb06e 100644 --- a/Libraries/LibGUI/ProgressBar.h +++ b/Libraries/LibGUI/ProgressBar.h @@ -56,7 +56,7 @@ public: void set_format(Format format) { m_format = format; } protected: - explicit ProgressBar(Widget* parent); + explicit ProgressBar(Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; diff --git a/Libraries/LibGUI/RadioButton.h b/Libraries/LibGUI/RadioButton.h index e22e6ca568..cb03930cea 100644 --- a/Libraries/LibGUI/RadioButton.h +++ b/Libraries/LibGUI/RadioButton.h @@ -38,8 +38,8 @@ public: virtual void click() override; protected: - explicit RadioButton(Widget* parent); - explicit RadioButton(const StringView& text, Widget* parent); + explicit RadioButton(Widget* parent = nullptr); + explicit RadioButton(const StringView& text, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; private: diff --git a/Libraries/LibGUI/ResizeCorner.h b/Libraries/LibGUI/ResizeCorner.h index 2a16d2574b..a91379de5a 100644 --- a/Libraries/LibGUI/ResizeCorner.h +++ b/Libraries/LibGUI/ResizeCorner.h @@ -34,7 +34,7 @@ public: virtual ~ResizeCorner() override; protected: - explicit ResizeCorner(Widget* parent); + explicit ResizeCorner(Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; virtual void mousedown_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/ScrollBar.h b/Libraries/LibGUI/ScrollBar.h index d65d4f6186..556dbff0f2 100644 --- a/Libraries/LibGUI/ScrollBar.h +++ b/Libraries/LibGUI/ScrollBar.h @@ -65,8 +65,8 @@ public: }; private: - explicit ScrollBar(Widget* parent); - explicit ScrollBar(Orientation, Widget* parent); + explicit ScrollBar(Widget* parent = nullptr); + explicit ScrollBar(Orientation, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; virtual void mousedown_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/ScrollableWidget.h b/Libraries/LibGUI/ScrollableWidget.h index 012fc12ed8..923fc6ed68 100644 --- a/Libraries/LibGUI/ScrollableWidget.h +++ b/Libraries/LibGUI/ScrollableWidget.h @@ -71,7 +71,7 @@ public: Gfx::Point to_widget_position(const Gfx::Point& content_position) const; protected: - explicit ScrollableWidget(Widget* parent); + explicit ScrollableWidget(Widget* parent = nullptr); virtual void custom_layout() override; virtual void resize_event(ResizeEvent&) override; virtual void mousewheel_event(MouseEvent&) override; diff --git a/Libraries/LibGUI/Slider.h b/Libraries/LibGUI/Slider.h index 5b26cc6161..60e5a0cc27 100644 --- a/Libraries/LibGUI/Slider.h +++ b/Libraries/LibGUI/Slider.h @@ -106,7 +106,7 @@ public: virtual ~VerticalSlider() override {} private: - explicit VerticalSlider(Widget* parent) + explicit VerticalSlider(Widget* parent = nullptr) : Slider(Orientation::Vertical, parent) { } @@ -118,7 +118,7 @@ public: virtual ~HorizontalSlider() override {} private: - explicit HorizontalSlider(Widget* parent) + explicit HorizontalSlider(Widget* parent = nullptr) : Slider(Orientation::Horizontal, parent) { } diff --git a/Libraries/LibGUI/Splitter.h b/Libraries/LibGUI/Splitter.h index 7f05f0b510..4d05f47526 100644 --- a/Libraries/LibGUI/Splitter.h +++ b/Libraries/LibGUI/Splitter.h @@ -36,7 +36,7 @@ public: virtual ~Splitter() override; protected: - Splitter(Gfx::Orientation, Widget* parent); + Splitter(Gfx::Orientation, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; virtual void resize_event(ResizeEvent&) override; @@ -68,7 +68,7 @@ public: virtual ~VerticalSplitter() override {} private: - explicit VerticalSplitter(Widget* parent) + explicit VerticalSplitter(Widget* parent = nullptr) : Splitter(Gfx::Orientation::Vertical, parent) { } @@ -80,7 +80,7 @@ public: virtual ~HorizontalSplitter() override {} private: - explicit HorizontalSplitter(Widget* parent) + explicit HorizontalSplitter(Widget* parent = nullptr) : Splitter(Gfx::Orientation::Horizontal, parent) { } diff --git a/Libraries/LibGUI/StackWidget.h b/Libraries/LibGUI/StackWidget.h index 7aba7f83b0..d8057c2a18 100644 --- a/Libraries/LibGUI/StackWidget.h +++ b/Libraries/LibGUI/StackWidget.h @@ -42,7 +42,7 @@ public: Function<void(Widget*)> on_active_widget_change; protected: - explicit StackWidget(Widget* parent); + explicit StackWidget(Widget* parent = nullptr); virtual void child_event(Core::ChildEvent&) override; virtual void resize_event(ResizeEvent&) override; diff --git a/Libraries/LibGUI/StatusBar.h b/Libraries/LibGUI/StatusBar.h index eced08550a..70bfc88111 100644 --- a/Libraries/LibGUI/StatusBar.h +++ b/Libraries/LibGUI/StatusBar.h @@ -41,8 +41,8 @@ public: void set_text(int index, const StringView&); protected: - explicit StatusBar(Widget* parent); - explicit StatusBar(int label_count, Widget* parent); + explicit StatusBar(Widget* parent = nullptr); + explicit StatusBar(int label_count, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; private: diff --git a/Libraries/LibGUI/TabWidget.h b/Libraries/LibGUI/TabWidget.h index ad573933d8..24d0583ee2 100644 --- a/Libraries/LibGUI/TabWidget.h +++ b/Libraries/LibGUI/TabWidget.h @@ -38,7 +38,7 @@ public: Bottom, }; - explicit TabWidget(Widget* parent); + explicit TabWidget(Widget* parent = nullptr); virtual ~TabWidget() override; TabPosition tab_position() const { return m_tab_position; } diff --git a/Libraries/LibGUI/TableView.h b/Libraries/LibGUI/TableView.h index b13be77b45..28983a1565 100644 --- a/Libraries/LibGUI/TableView.h +++ b/Libraries/LibGUI/TableView.h @@ -36,7 +36,7 @@ public: virtual ~TableView() override; protected: - explicit TableView(Widget* parent); + explicit TableView(Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; }; diff --git a/Libraries/LibGUI/TextBox.h b/Libraries/LibGUI/TextBox.h index 2d66658d5b..c57d32d9fb 100644 --- a/Libraries/LibGUI/TextBox.h +++ b/Libraries/LibGUI/TextBox.h @@ -33,7 +33,7 @@ namespace GUI { class TextBox : public TextEditor { C_OBJECT(TextBox) public: - explicit TextBox(Widget* parent); + explicit TextBox(Widget* parent = nullptr); virtual ~TextBox() override; }; diff --git a/Libraries/LibGUI/TextEditor.h b/Libraries/LibGUI/TextEditor.h index 1a58833ce7..db42b55998 100644 --- a/Libraries/LibGUI/TextEditor.h +++ b/Libraries/LibGUI/TextEditor.h @@ -130,8 +130,8 @@ public: void set_syntax_highlighter(OwnPtr<SyntaxHighlighter>); protected: - explicit TextEditor(Widget* parent); - explicit TextEditor(Type, Widget* parent); + explicit TextEditor(Widget* parent = nullptr); + explicit TextEditor(Type, Widget* parent = nullptr); virtual void did_change_font() override; virtual void paint_event(PaintEvent&) override; diff --git a/Libraries/LibGUI/ToolBar.h b/Libraries/LibGUI/ToolBar.h index 09e655f2d7..24c5950f9b 100644 --- a/Libraries/LibGUI/ToolBar.h +++ b/Libraries/LibGUI/ToolBar.h @@ -43,8 +43,8 @@ public: void set_has_frame(bool has_frame) { m_has_frame = has_frame; } protected: - explicit ToolBar(Widget* parent); - explicit ToolBar(Orientation, int button_size, Widget* parent); + explicit ToolBar(Widget* parent = nullptr); + explicit ToolBar(Orientation, int button_size, Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; diff --git a/Libraries/LibGUI/TreeView.h b/Libraries/LibGUI/TreeView.h index 05a5b600d2..7a08bf9585 100644 --- a/Libraries/LibGUI/TreeView.h +++ b/Libraries/LibGUI/TreeView.h @@ -41,7 +41,7 @@ public: virtual int item_count() const override; protected: - explicit TreeView(Widget*); + explicit TreeView(Widget* parent = nullptr); virtual void paint_event(PaintEvent&) override; virtual void doubleclick_event(MouseEvent&) override; |