diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-23 12:07:13 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-23 12:27:53 +0100 |
commit | c5d913970ab122cdeaf23aea24e65efa6b425ab0 (patch) | |
tree | 07ef4cb2d039521ec7b1931c707b5196b7ea1628 /Applications | |
parent | 4ce28c32d1813b043758c0d15d5efc17452c2b77 (diff) | |
download | serenity-c5d913970ab122cdeaf23aea24e65efa6b425ab0.zip |
LibGUI: Remove parent parameter to GUI::Widget constructor
Diffstat (limited to 'Applications')
35 files changed, 56 insertions, 72 deletions
diff --git a/Applications/Browser/InspectorWidget.cpp b/Applications/Browser/InspectorWidget.cpp index 70cd9bc3e9..d2d87b7264 100644 --- a/Applications/Browser/InspectorWidget.cpp +++ b/Applications/Browser/InspectorWidget.cpp @@ -35,8 +35,7 @@ #include <LibHTML/DOMTreeModel.h> #include <LibHTML/StylePropertiesModel.h> -InspectorWidget::InspectorWidget(GUI::Widget* parent) - : GUI::Widget(parent) +InspectorWidget::InspectorWidget() { set_layout(make<GUI::VerticalBoxLayout>()); auto splitter = add<GUI::VerticalSplitter>(); diff --git a/Applications/Browser/InspectorWidget.h b/Applications/Browser/InspectorWidget.h index 7296e36f01..571b3acab1 100644 --- a/Applications/Browser/InspectorWidget.h +++ b/Applications/Browser/InspectorWidget.h @@ -36,7 +36,7 @@ public: void set_document(Document*); private: - explicit InspectorWidget(GUI::Widget* parent); + InspectorWidget(); RefPtr<GUI::TreeView> m_dom_tree_view; RefPtr<GUI::TableView> m_style_table_view; diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index d7554eed85..e38824896c 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -200,7 +200,7 @@ int main(int argc, char** argv) dom_inspector_window = GUI::Window::construct(); dom_inspector_window->set_rect(100, 100, 300, 500); dom_inspector_window->set_title("DOM inspector"); - auto dom_inspector_widget = InspectorWidget::construct(nullptr); + auto dom_inspector_widget = InspectorWidget::construct(); dom_inspector_window->set_main_widget(dom_inspector_widget); } auto* inspector_widget = static_cast<InspectorWidget*>(dom_inspector_window->main_widget()); diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 1dfa4f2c0a..06775daabe 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -39,9 +39,8 @@ #include <LibGfx/Font.h> #include <stdlib.h> -FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font, GUI::Widget* parent) - : GUI::Widget(parent) - , m_edited_font(move(edited_font)) +FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font) + : m_edited_font(move(edited_font)) { set_fill_with_background_color(true); diff --git a/Applications/FontEditor/FontEditor.h b/Applications/FontEditor/FontEditor.h index 002d8969c1..f6e9bf87fc 100644 --- a/Applications/FontEditor/FontEditor.h +++ b/Applications/FontEditor/FontEditor.h @@ -40,7 +40,7 @@ public: virtual ~FontEditorWidget() override; private: - FontEditorWidget(const String& path, RefPtr<Gfx::Font>&&, GUI::Widget* parent = nullptr); + FontEditorWidget(const String& path, RefPtr<Gfx::Font>&&); RefPtr<Gfx::Font> m_edited_font; GlyphMapWidget* m_glyph_map_widget { nullptr }; diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index 6914cb1760..269d73cb26 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -41,8 +41,7 @@ #include <stdio.h> #include <unistd.h> -HexEditor::HexEditor(GUI::Widget* parent) - : ScrollableWidget(parent) +HexEditor::HexEditor() { set_scrollbars_enabled(true); set_font(GFontDatabase::the().get_by_name("Csilla Thin")); diff --git a/Applications/HexEditor/HexEditor.h b/Applications/HexEditor/HexEditor.h index 25469cfc0a..d01e40abf3 100644 --- a/Applications/HexEditor/HexEditor.h +++ b/Applications/HexEditor/HexEditor.h @@ -67,7 +67,7 @@ public: Function<void()> on_change; protected: - HexEditor(GUI::Widget* parent); + HexEditor(); virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; diff --git a/Applications/HexEditor/HexEditorWidget.cpp b/Applications/HexEditor/HexEditorWidget.cpp index 0f77a32b76..17ac674b09 100644 --- a/Applications/HexEditor/HexEditorWidget.cpp +++ b/Applications/HexEditor/HexEditorWidget.cpp @@ -49,7 +49,7 @@ HexEditorWidget::HexEditorWidget() set_layout(make<GUI::VerticalBoxLayout>()); layout()->set_spacing(0); - m_editor = HexEditor::construct(this); + m_editor = add<HexEditor>(); m_editor->on_status_change = [this](int position, HexEditor::EditMode edit_mode, int selection_start, int selection_end) { m_statusbar->set_text(0, String::format("Offset: %8X", position)); @@ -66,7 +66,7 @@ HexEditorWidget::HexEditorWidget() update_title(); }; - m_statusbar = GUI::StatusBar::construct(5, this); + m_statusbar = add<GUI::StatusBar>(5); m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { if (m_document_dirty) { diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp index 0662fb0670..0993d3ab9a 100644 --- a/Applications/IRCClient/IRCAppWindow.cpp +++ b/Applications/IRCClient/IRCAppWindow.cpp @@ -78,7 +78,7 @@ void IRCAppWindow::update_title() void IRCAppWindow::setup_client() { m_client->aid_create_window = [this](void* owner, IRCWindow::Type type, const String& name) { - return &create_window(owner, type, name); + return create_window(owner, type, name); }; m_client->aid_get_active_window = [this] { return static_cast<IRCWindow*>(m_container->active_widget()); @@ -237,7 +237,7 @@ void IRCAppWindow::update_part_action() m_part_action->set_enabled(is_open_channel); } -IRCWindow& IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name) +NonnullRefPtr<IRCWindow> IRCAppWindow::create_window(void* owner, IRCWindow::Type type, const String& name) { - return *new IRCWindow(m_client, owner, type, name, m_container); + return m_container->add<IRCWindow>(m_client, owner, type, name); } diff --git a/Applications/IRCClient/IRCAppWindow.h b/Applications/IRCClient/IRCAppWindow.h index 1acb1886bd..72c73dd11d 100644 --- a/Applications/IRCClient/IRCAppWindow.h +++ b/Applications/IRCClient/IRCAppWindow.h @@ -50,7 +50,7 @@ private: void update_title(); void update_part_action(); - IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name); + NonnullRefPtr<IRCWindow> create_window(void* owner, IRCWindow::Type, const String& name); NonnullRefPtr<IRCClient> m_client; RefPtr<GUI::StackWidget> m_container; RefPtr<GUI::TableView> m_window_list; diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h index 71dc41cea4..99f48342c3 100644 --- a/Applications/IRCClient/IRCClient.h +++ b/Applications/IRCClient/IRCClient.h @@ -70,7 +70,7 @@ public: Function<void(const String&)> on_nickname_changed; Function<void(IRCChannel&)> on_part_from_channel; - Function<IRCWindow*(void*, IRCWindow::Type, const String&)> aid_create_window; + Function<NonnullRefPtr<IRCWindow>(void*, IRCWindow::Type, const String&)> aid_create_window; Function<IRCWindow*()> aid_get_active_window; Function<void()> aid_update_window_list; diff --git a/Applications/IRCClient/IRCQuery.h b/Applications/IRCClient/IRCQuery.h index f783f5294d..26625e490a 100644 --- a/Applications/IRCClient/IRCQuery.h +++ b/Applications/IRCClient/IRCQuery.h @@ -59,7 +59,7 @@ private: IRCClient& m_client; String m_name; - IRCWindow* m_window { nullptr }; + RefPtr<IRCWindow> m_window; NonnullRefPtr<IRCLogBuffer> m_log; }; diff --git a/Applications/IRCClient/IRCWindow.cpp b/Applications/IRCClient/IRCWindow.cpp index 83ba78148a..e151bea4af 100644 --- a/Applications/IRCClient/IRCWindow.cpp +++ b/Applications/IRCClient/IRCWindow.cpp @@ -35,9 +35,8 @@ #include <LibGUI/TextEditor.h> #include <LibHTML/HtmlView.h> -IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GUI::Widget* parent) - : GUI::Widget(parent) - , m_client(client) +IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name) + : m_client(client) , m_owner(owner) , m_type(type) , m_name(name) diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h index 31e4c7f3cb..319184dd85 100644 --- a/Applications/IRCClient/IRCWindow.h +++ b/Applications/IRCClient/IRCWindow.h @@ -43,7 +43,6 @@ public: Query, }; - IRCWindow(IRCClient&, void* owner, Type, const String& name, GUI::Widget* parent); virtual ~IRCWindow() override; String name() const { return m_name; } @@ -67,6 +66,8 @@ public: const IRCQuery& query() const { return *(const IRCQuery*)m_owner; } private: + IRCWindow(IRCClient&, void* owner, Type, const String& name); + IRCClient& m_client; void* m_owner { nullptr }; Type m_type; diff --git a/Applications/QuickShow/QSWidget.cpp b/Applications/QuickShow/QSWidget.cpp index 9adc2766e1..ca8e206e77 100644 --- a/Applications/QuickShow/QSWidget.cpp +++ b/Applications/QuickShow/QSWidget.cpp @@ -32,8 +32,7 @@ #include <LibGUI/Window.h> #include <LibGfx/Bitmap.h> -QSWidget::QSWidget(GUI::Widget* parent) - : GUI::Frame(parent) +QSWidget::QSWidget() { set_fill_with_background_color(true); set_background_color(Color::Black); diff --git a/Applications/QuickShow/QSWidget.h b/Applications/QuickShow/QSWidget.h index 7ed6f8689e..46bf310fcc 100644 --- a/Applications/QuickShow/QSWidget.h +++ b/Applications/QuickShow/QSWidget.h @@ -44,7 +44,7 @@ public: Function<void(int)> on_scale_change; private: - explicit QSWidget(GUI::Widget* parent = nullptr); + QSWidget(); virtual void paint_event(GUI::PaintEvent&) override; virtual void resize_event(GUI::ResizeEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index 591d10a5b5..039758bb6d 100644 --- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -30,8 +30,7 @@ #include <LibGUI/JsonArrayModel.h> #include <LibGUI/TableView.h> -NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent) - : GUI::LazyWidget(parent) +NetworkStatisticsWidget::NetworkStatisticsWidget() { on_first_show = [this](auto&) { set_layout(make<GUI::VerticalBoxLayout>()); diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.h b/Applications/SystemMonitor/NetworkStatisticsWidget.h index f7bf1df99a..554bd255f0 100644 --- a/Applications/SystemMonitor/NetworkStatisticsWidget.h +++ b/Applications/SystemMonitor/NetworkStatisticsWidget.h @@ -35,7 +35,7 @@ public: virtual ~NetworkStatisticsWidget() override; private: - explicit NetworkStatisticsWidget(GUI::Widget* parent = nullptr); + NetworkStatisticsWidget(); void update_models(); RefPtr<GUI::TableView> m_adapter_table_view; diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index 7fd8b0c021..133f4a7d86 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -29,12 +29,11 @@ #include <LibGUI/JsonArrayModel.h> #include <LibGUI/TableView.h> -ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GUI::Widget* parent) - : GUI::Widget(parent) +ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() { set_layout(make<GUI::VerticalBoxLayout>()); layout()->set_margins({ 4, 4, 4, 4 }); - m_table_view = GUI::TableView::construct(this); + m_table_view = add<GUI::TableView>(); m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields; diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h index 2937fa4b0a..a03bf7d1cf 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.h @@ -36,7 +36,7 @@ public: void set_pid(pid_t); private: - explicit ProcessFileDescriptorMapWidget(GUI::Widget* parent); + ProcessFileDescriptorMapWidget(); RefPtr<GUI::TableView> m_table_view; pid_t m_pid { -1 }; diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 9f5e5c3346..5f957e5ceb 100644 --- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -31,8 +31,7 @@ #include <LibGUI/SortingProxyModel.h> #include <LibGUI/TableView.h> -ProcessMemoryMapWidget::ProcessMemoryMapWidget(GUI::Widget* parent) - : GUI::Widget(parent) +ProcessMemoryMapWidget::ProcessMemoryMapWidget() { set_layout(make<GUI::VerticalBoxLayout>()); layout()->set_margins({ 4, 4, 4, 4 }); diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.h b/Applications/SystemMonitor/ProcessMemoryMapWidget.h index d8094f69f7..71a554fe51 100644 --- a/Applications/SystemMonitor/ProcessMemoryMapWidget.h +++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.h @@ -38,7 +38,7 @@ public: void refresh(); private: - explicit ProcessMemoryMapWidget(GUI::Widget* parent); + ProcessMemoryMapWidget(); RefPtr<GUI::TableView> m_table_view; RefPtr<GUI::JsonArrayModel> m_json_model; pid_t m_pid { -1 }; diff --git a/Applications/SystemMonitor/ProcessStacksWidget.cpp b/Applications/SystemMonitor/ProcessStacksWidget.cpp index fdbcae184c..f096878a0b 100644 --- a/Applications/SystemMonitor/ProcessStacksWidget.cpp +++ b/Applications/SystemMonitor/ProcessStacksWidget.cpp @@ -30,8 +30,7 @@ #include <LibCore/Timer.h> #include <LibGUI/BoxLayout.h> -ProcessStacksWidget::ProcessStacksWidget(GUI::Widget* parent) - : GUI::Widget(parent) +ProcessStacksWidget::ProcessStacksWidget() { set_layout(make<GUI::VerticalBoxLayout>()); layout()->set_margins({ 4, 4, 4, 4 }); diff --git a/Applications/SystemMonitor/ProcessStacksWidget.h b/Applications/SystemMonitor/ProcessStacksWidget.h index 1dc3c4bbaf..a9a76b304a 100644 --- a/Applications/SystemMonitor/ProcessStacksWidget.h +++ b/Applications/SystemMonitor/ProcessStacksWidget.h @@ -32,13 +32,14 @@ class ProcessStacksWidget final : public GUI::Widget { C_OBJECT(ProcessStacksWidget) public: - explicit ProcessStacksWidget(GUI::Widget* parent); virtual ~ProcessStacksWidget() override; void set_pid(pid_t); void refresh(); private: + ProcessStacksWidget(); + pid_t m_pid { -1 }; RefPtr<GUI::TextEditor> m_stacks_editor; RefPtr<Core::Timer> m_timer; diff --git a/Applications/SystemMonitor/ProcessTableView.cpp b/Applications/SystemMonitor/ProcessTableView.cpp index 9e9062b54e..f8cf68955b 100644 --- a/Applications/SystemMonitor/ProcessTableView.cpp +++ b/Applications/SystemMonitor/ProcessTableView.cpp @@ -29,8 +29,7 @@ #include <LibGUI/SortingProxyModel.h> #include <stdio.h> -ProcessTableView::ProcessTableView(GUI::Widget* parent) - : TableView(parent) +ProcessTableView::ProcessTableView() { set_size_columns_to_fit_content(true); set_model(GUI::SortingProxyModel::create(ProcessModel::create())); diff --git a/Applications/SystemMonitor/ProcessTableView.h b/Applications/SystemMonitor/ProcessTableView.h index a352fbfb85..0fe294c98e 100644 --- a/Applications/SystemMonitor/ProcessTableView.h +++ b/Applications/SystemMonitor/ProcessTableView.h @@ -45,5 +45,5 @@ public: Function<void(pid_t)> on_process_selected; private: - explicit ProcessTableView(GUI::Widget* parent = nullptr); + ProcessTableView(); }; diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index 8e6102dde6..d10222bc08 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -29,12 +29,11 @@ #include <LibGUI/JsonArrayModel.h> #include <LibGUI/TableView.h> -ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget(GUI::Widget* parent) - : GUI::Widget(parent) +ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() { set_layout(make<GUI::VerticalBoxLayout>()); layout()->set_margins({ 4, 4, 4, 4 }); - m_table_view = GUI::TableView::construct(this); + m_table_view = add<GUI::TableView>(); m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h index bbc7536194..99eb84055a 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.h @@ -36,7 +36,7 @@ public: void set_pid(pid_t); private: - explicit ProcessUnveiledPathsWidget(GUI::Widget* parent); + ProcessUnveiledPathsWidget(); RefPtr<GUI::TableView> m_table_view; pid_t m_pid { -1 }; diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 3b85ef0e10..12d1803588 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -123,7 +123,7 @@ int main(int argc, char** argv) auto tabwidget = keeper->add<GUI::TabWidget>(); - auto process_container_splitter = GUI::VerticalSplitter::construct(nullptr); + auto process_container_splitter = GUI::VerticalSplitter::construct(); tabwidget->add_widget("Processes", process_container_splitter); auto process_table_container = process_container_splitter->add<GUI::Widget>(); @@ -136,7 +136,7 @@ int main(int argc, char** argv) tabwidget->add_widget("Devices", build_devices_tab()); - auto network_stats_widget = NetworkStatisticsWidget::construct(nullptr); + auto network_stats_widget = NetworkStatisticsWidget::construct(); tabwidget->add_widget("Network", network_stats_widget); process_table_container->set_layout(make<GUI::VerticalBoxLayout>()); @@ -232,16 +232,16 @@ int main(int argc, char** argv) auto process_tab_widget = process_container_splitter->add<GUI::TabWidget>(); - auto memory_map_widget = ProcessMemoryMapWidget::construct(nullptr); + auto memory_map_widget = ProcessMemoryMapWidget::construct(); process_tab_widget->add_widget("Memory map", memory_map_widget); - auto open_files_widget = ProcessFileDescriptorMapWidget::construct(nullptr); + auto open_files_widget = ProcessFileDescriptorMapWidget::construct(); process_tab_widget->add_widget("Open files", open_files_widget); - auto unveiled_paths_widget = ProcessUnveiledPathsWidget::construct(nullptr); + auto unveiled_paths_widget = ProcessUnveiledPathsWidget::construct(); process_tab_widget->add_widget("Unveiled paths", unveiled_paths_widget); - auto stacks_widget = ProcessStacksWidget::construct(nullptr); + auto stacks_widget = ProcessStacksWidget::construct(); process_tab_widget->add_widget("Stacks", stacks_widget); process_table_view->on_process_selected = [&](pid_t pid) { diff --git a/Applications/Welcome/BackgroundWidget.cpp b/Applications/Welcome/BackgroundWidget.cpp index 9e7963a70c..c64f2fc93b 100644 --- a/Applications/Welcome/BackgroundWidget.cpp +++ b/Applications/Welcome/BackgroundWidget.cpp @@ -29,8 +29,7 @@ #include <LibGfx/Color.h> #include <LibGfx/Palette.h> -BackgroundWidget::BackgroundWidget(GUI::Widget* parent) - : GUI::Frame(parent) +BackgroundWidget::BackgroundWidget() { } diff --git a/Applications/Welcome/BackgroundWidget.h b/Applications/Welcome/BackgroundWidget.h index bc8bbf6970..fea3871edc 100644 --- a/Applications/Welcome/BackgroundWidget.h +++ b/Applications/Welcome/BackgroundWidget.h @@ -31,10 +31,11 @@ class BackgroundWidget : public GUI::Frame { C_OBJECT(BackgroundWidget) public: - explicit BackgroundWidget(GUI::Widget* parent = nullptr); virtual ~BackgroundWidget() override; private: + BackgroundWidget(); + virtual void paint_event(GUI::PaintEvent&) override; virtual void resize_event(GUI::ResizeEvent&) override; }; diff --git a/Applications/Welcome/TextWidget.cpp b/Applications/Welcome/TextWidget.cpp index 42fc489720..8d4bad08d0 100644 --- a/Applications/Welcome/TextWidget.cpp +++ b/Applications/Welcome/TextWidget.cpp @@ -33,14 +33,8 @@ #include <LibGfx/Font.h> #include <LibGfx/Palette.h> -TextWidget::TextWidget(GUI::Widget* parent) - : GUI::Frame(parent) -{ -} - -TextWidget::TextWidget(const StringView& text, GUI::Widget* parent) - : GUI::Frame(parent) - , m_text(text) +TextWidget::TextWidget(const StringView& text) + : m_text(text) { } diff --git a/Applications/Welcome/TextWidget.h b/Applications/Welcome/TextWidget.h index f4c71e8cd5..c4353096ff 100644 --- a/Applications/Welcome/TextWidget.h +++ b/Applications/Welcome/TextWidget.h @@ -32,10 +32,9 @@ #include <LibGfx/TextAlignment.h> class TextWidget : public GUI::Frame { - C_OBJECT(TextWidget) + C_OBJECT(TextWidget); + public: - explicit TextWidget(GUI::Widget* parent = nullptr); - TextWidget(const StringView& text, GUI::Widget* parent = nullptr); virtual ~TextWidget() override; String text() const { return m_text; } @@ -53,6 +52,8 @@ public: void wrap_and_set_height(); private: + explicit TextWidget(const StringView& text = {}); + virtual void paint_event(GUI::PaintEvent&) override; virtual void resize_event(GUI::ResizeEvent&) override; diff --git a/Applications/Welcome/UnuncheckableButton.cpp b/Applications/Welcome/UnuncheckableButton.cpp index 41a09f89c5..29194fff81 100644 --- a/Applications/Welcome/UnuncheckableButton.cpp +++ b/Applications/Welcome/UnuncheckableButton.cpp @@ -25,12 +25,8 @@ */ #include "UnuncheckableButton.h" -#include <LibGUI/Painter.h> -#include <LibGfx/Color.h> -#include <LibGfx/Palette.h> -UnuncheckableButton::UnuncheckableButton(GUI::Widget* parent) - : GUI::Button(parent) +UnuncheckableButton::UnuncheckableButton() { } diff --git a/Applications/Welcome/UnuncheckableButton.h b/Applications/Welcome/UnuncheckableButton.h index 5a57bd510c..b91a41ef9c 100644 --- a/Applications/Welcome/UnuncheckableButton.h +++ b/Applications/Welcome/UnuncheckableButton.h @@ -31,8 +31,10 @@ class UnuncheckableButton : public GUI::Button { C_OBJECT(UnuncheckableButton) public: - explicit UnuncheckableButton(GUI::Widget* parent = nullptr); virtual ~UnuncheckableButton() override; virtual bool is_uncheckable() const override { return false; } + +private: + UnuncheckableButton(); }; |