mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	LibGUI: Remove parent parameter to GUI::Widget constructor
This commit is contained in:
		
							parent
							
								
									4ce28c32d1
								
							
						
					
					
						commit
						c5d913970a
					
				
					 114 changed files with 207 additions and 313 deletions
				
			
		|  | @ -35,8 +35,7 @@ | ||||||
| #include <LibHTML/DOMTreeModel.h> | #include <LibHTML/DOMTreeModel.h> | ||||||
| #include <LibHTML/StylePropertiesModel.h> | #include <LibHTML/StylePropertiesModel.h> | ||||||
| 
 | 
 | ||||||
| InspectorWidget::InspectorWidget(GUI::Widget* parent) | InspectorWidget::InspectorWidget() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     auto splitter = add<GUI::VerticalSplitter>(); |     auto splitter = add<GUI::VerticalSplitter>(); | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
|     void set_document(Document*); |     void set_document(Document*); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit InspectorWidget(GUI::Widget* parent); |     InspectorWidget(); | ||||||
| 
 | 
 | ||||||
|     RefPtr<GUI::TreeView> m_dom_tree_view; |     RefPtr<GUI::TreeView> m_dom_tree_view; | ||||||
|     RefPtr<GUI::TableView> m_style_table_view; |     RefPtr<GUI::TableView> m_style_table_view; | ||||||
|  |  | ||||||
|  | @ -200,7 +200,7 @@ int main(int argc, char** argv) | ||||||
|             dom_inspector_window = GUI::Window::construct(); |             dom_inspector_window = GUI::Window::construct(); | ||||||
|             dom_inspector_window->set_rect(100, 100, 300, 500); |             dom_inspector_window->set_rect(100, 100, 300, 500); | ||||||
|             dom_inspector_window->set_title("DOM inspector"); |             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); |             dom_inspector_window->set_main_widget(dom_inspector_widget); | ||||||
|         } |         } | ||||||
|         auto* inspector_widget = static_cast<InspectorWidget*>(dom_inspector_window->main_widget()); |         auto* inspector_widget = static_cast<InspectorWidget*>(dom_inspector_window->main_widget()); | ||||||
|  |  | ||||||
|  | @ -39,9 +39,8 @@ | ||||||
| #include <LibGfx/Font.h> | #include <LibGfx/Font.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| 
 | 
 | ||||||
| FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font, GUI::Widget* parent) | FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font) | ||||||
|     : GUI::Widget(parent) |     : m_edited_font(move(edited_font)) | ||||||
|     , m_edited_font(move(edited_font)) |  | ||||||
| { | { | ||||||
|     set_fill_with_background_color(true); |     set_fill_with_background_color(true); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ public: | ||||||
|     virtual ~FontEditorWidget() override; |     virtual ~FontEditorWidget() override; | ||||||
| 
 | 
 | ||||||
| private: | 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; |     RefPtr<Gfx::Font> m_edited_font; | ||||||
| 
 | 
 | ||||||
|     GlyphMapWidget* m_glyph_map_widget { nullptr }; |     GlyphMapWidget* m_glyph_map_widget { nullptr }; | ||||||
|  |  | ||||||
|  | @ -41,8 +41,7 @@ | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| HexEditor::HexEditor(GUI::Widget* parent) | HexEditor::HexEditor() | ||||||
|     : ScrollableWidget(parent) |  | ||||||
| { | { | ||||||
|     set_scrollbars_enabled(true); |     set_scrollbars_enabled(true); | ||||||
|     set_font(GFontDatabase::the().get_by_name("Csilla Thin")); |     set_font(GFontDatabase::the().get_by_name("Csilla Thin")); | ||||||
|  |  | ||||||
|  | @ -67,7 +67,7 @@ public: | ||||||
|     Function<void()> on_change; |     Function<void()> on_change; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     HexEditor(GUI::Widget* parent); |     HexEditor(); | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(GUI::PaintEvent&) override; |     virtual void paint_event(GUI::PaintEvent&) override; | ||||||
|     virtual void mousedown_event(GUI::MouseEvent&) override; |     virtual void mousedown_event(GUI::MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -49,7 +49,7 @@ HexEditorWidget::HexEditorWidget() | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     layout()->set_spacing(0); |     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_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)); |         m_statusbar->set_text(0, String::format("Offset: %8X", position)); | ||||||
|  | @ -66,7 +66,7 @@ HexEditorWidget::HexEditorWidget() | ||||||
|             update_title(); |             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&) { |     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) { |         if (m_document_dirty) { | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ void IRCAppWindow::update_title() | ||||||
| void IRCAppWindow::setup_client() | void IRCAppWindow::setup_client() | ||||||
| { | { | ||||||
|     m_client->aid_create_window = [this](void* owner, IRCWindow::Type type, const String& name) { |     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] { |     m_client->aid_get_active_window = [this] { | ||||||
|         return static_cast<IRCWindow*>(m_container->active_widget()); |         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); |     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); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -50,7 +50,7 @@ private: | ||||||
|     void update_title(); |     void update_title(); | ||||||
|     void update_part_action(); |     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; |     NonnullRefPtr<IRCClient> m_client; | ||||||
|     RefPtr<GUI::StackWidget> m_container; |     RefPtr<GUI::StackWidget> m_container; | ||||||
|     RefPtr<GUI::TableView> m_window_list; |     RefPtr<GUI::TableView> m_window_list; | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ public: | ||||||
|     Function<void(const String&)> on_nickname_changed; |     Function<void(const String&)> on_nickname_changed; | ||||||
|     Function<void(IRCChannel&)> on_part_from_channel; |     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<IRCWindow*()> aid_get_active_window; | ||||||
|     Function<void()> aid_update_window_list; |     Function<void()> aid_update_window_list; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ private: | ||||||
| 
 | 
 | ||||||
|     IRCClient& m_client; |     IRCClient& m_client; | ||||||
|     String m_name; |     String m_name; | ||||||
|     IRCWindow* m_window { nullptr }; |     RefPtr<IRCWindow> m_window; | ||||||
| 
 | 
 | ||||||
|     NonnullRefPtr<IRCLogBuffer> m_log; |     NonnullRefPtr<IRCLogBuffer> m_log; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -35,9 +35,8 @@ | ||||||
| #include <LibGUI/TextEditor.h> | #include <LibGUI/TextEditor.h> | ||||||
| #include <LibHTML/HtmlView.h> | #include <LibHTML/HtmlView.h> | ||||||
| 
 | 
 | ||||||
| IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name, GUI::Widget* parent) | IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& name) | ||||||
|     : GUI::Widget(parent) |     : m_client(client) | ||||||
|     , m_client(client) |  | ||||||
|     , m_owner(owner) |     , m_owner(owner) | ||||||
|     , m_type(type) |     , m_type(type) | ||||||
|     , m_name(name) |     , m_name(name) | ||||||
|  |  | ||||||
|  | @ -43,7 +43,6 @@ public: | ||||||
|         Query, |         Query, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     IRCWindow(IRCClient&, void* owner, Type, const String& name, GUI::Widget* parent); |  | ||||||
|     virtual ~IRCWindow() override; |     virtual ~IRCWindow() override; | ||||||
| 
 | 
 | ||||||
|     String name() const { return m_name; } |     String name() const { return m_name; } | ||||||
|  | @ -67,6 +66,8 @@ public: | ||||||
|     const IRCQuery& query() const { return *(const IRCQuery*)m_owner; } |     const IRCQuery& query() const { return *(const IRCQuery*)m_owner; } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     IRCWindow(IRCClient&, void* owner, Type, const String& name); | ||||||
|  | 
 | ||||||
|     IRCClient& m_client; |     IRCClient& m_client; | ||||||
|     void* m_owner { nullptr }; |     void* m_owner { nullptr }; | ||||||
|     Type m_type; |     Type m_type; | ||||||
|  |  | ||||||
|  | @ -32,8 +32,7 @@ | ||||||
| #include <LibGUI/Window.h> | #include <LibGUI/Window.h> | ||||||
| #include <LibGfx/Bitmap.h> | #include <LibGfx/Bitmap.h> | ||||||
| 
 | 
 | ||||||
| QSWidget::QSWidget(GUI::Widget* parent) | QSWidget::QSWidget() | ||||||
|     : GUI::Frame(parent) |  | ||||||
| { | { | ||||||
|     set_fill_with_background_color(true); |     set_fill_with_background_color(true); | ||||||
|     set_background_color(Color::Black); |     set_background_color(Color::Black); | ||||||
|  |  | ||||||
|  | @ -44,7 +44,7 @@ public: | ||||||
|     Function<void(int)> on_scale_change; |     Function<void(int)> on_scale_change; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit QSWidget(GUI::Widget* parent = nullptr); |     QSWidget(); | ||||||
|     virtual void paint_event(GUI::PaintEvent&) override; |     virtual void paint_event(GUI::PaintEvent&) override; | ||||||
|     virtual void resize_event(GUI::ResizeEvent&) override; |     virtual void resize_event(GUI::ResizeEvent&) override; | ||||||
|     virtual void mousedown_event(GUI::MouseEvent&) override; |     virtual void mousedown_event(GUI::MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -30,8 +30,7 @@ | ||||||
| #include <LibGUI/JsonArrayModel.h> | #include <LibGUI/JsonArrayModel.h> | ||||||
| #include <LibGUI/TableView.h> | #include <LibGUI/TableView.h> | ||||||
| 
 | 
 | ||||||
| NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent) | NetworkStatisticsWidget::NetworkStatisticsWidget() | ||||||
|     : GUI::LazyWidget(parent) |  | ||||||
| { | { | ||||||
|     on_first_show = [this](auto&) { |     on_first_show = [this](auto&) { | ||||||
|         set_layout(make<GUI::VerticalBoxLayout>()); |         set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ public: | ||||||
|     virtual ~NetworkStatisticsWidget() override; |     virtual ~NetworkStatisticsWidget() override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit NetworkStatisticsWidget(GUI::Widget* parent = nullptr); |     NetworkStatisticsWidget(); | ||||||
|     void update_models(); |     void update_models(); | ||||||
| 
 | 
 | ||||||
|     RefPtr<GUI::TableView> m_adapter_table_view; |     RefPtr<GUI::TableView> m_adapter_table_view; | ||||||
|  |  | ||||||
|  | @ -29,12 +29,11 @@ | ||||||
| #include <LibGUI/JsonArrayModel.h> | #include <LibGUI/JsonArrayModel.h> | ||||||
| #include <LibGUI/TableView.h> | #include <LibGUI/TableView.h> | ||||||
| 
 | 
 | ||||||
| ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GUI::Widget* parent) | ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     layout()->set_margins({ 4, 4, 4, 4 }); |     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); |     m_table_view->set_size_columns_to_fit_content(true); | ||||||
| 
 | 
 | ||||||
|     Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields; |     Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields; | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
|     void set_pid(pid_t); |     void set_pid(pid_t); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ProcessFileDescriptorMapWidget(GUI::Widget* parent); |     ProcessFileDescriptorMapWidget(); | ||||||
| 
 | 
 | ||||||
|     RefPtr<GUI::TableView> m_table_view; |     RefPtr<GUI::TableView> m_table_view; | ||||||
|     pid_t m_pid { -1 }; |     pid_t m_pid { -1 }; | ||||||
|  |  | ||||||
|  | @ -31,8 +31,7 @@ | ||||||
| #include <LibGUI/SortingProxyModel.h> | #include <LibGUI/SortingProxyModel.h> | ||||||
| #include <LibGUI/TableView.h> | #include <LibGUI/TableView.h> | ||||||
| 
 | 
 | ||||||
| ProcessMemoryMapWidget::ProcessMemoryMapWidget(GUI::Widget* parent) | ProcessMemoryMapWidget::ProcessMemoryMapWidget() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     layout()->set_margins({ 4, 4, 4, 4 }); |     layout()->set_margins({ 4, 4, 4, 4 }); | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ public: | ||||||
|     void refresh(); |     void refresh(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ProcessMemoryMapWidget(GUI::Widget* parent); |     ProcessMemoryMapWidget(); | ||||||
|     RefPtr<GUI::TableView> m_table_view; |     RefPtr<GUI::TableView> m_table_view; | ||||||
|     RefPtr<GUI::JsonArrayModel> m_json_model; |     RefPtr<GUI::JsonArrayModel> m_json_model; | ||||||
|     pid_t m_pid { -1 }; |     pid_t m_pid { -1 }; | ||||||
|  |  | ||||||
|  | @ -30,8 +30,7 @@ | ||||||
| #include <LibCore/Timer.h> | #include <LibCore/Timer.h> | ||||||
| #include <LibGUI/BoxLayout.h> | #include <LibGUI/BoxLayout.h> | ||||||
| 
 | 
 | ||||||
| ProcessStacksWidget::ProcessStacksWidget(GUI::Widget* parent) | ProcessStacksWidget::ProcessStacksWidget() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     layout()->set_margins({ 4, 4, 4, 4 }); |     layout()->set_margins({ 4, 4, 4, 4 }); | ||||||
|  |  | ||||||
|  | @ -32,13 +32,14 @@ | ||||||
| class ProcessStacksWidget final : public GUI::Widget { | class ProcessStacksWidget final : public GUI::Widget { | ||||||
|     C_OBJECT(ProcessStacksWidget) |     C_OBJECT(ProcessStacksWidget) | ||||||
| public: | public: | ||||||
|     explicit ProcessStacksWidget(GUI::Widget* parent); |  | ||||||
|     virtual ~ProcessStacksWidget() override; |     virtual ~ProcessStacksWidget() override; | ||||||
| 
 | 
 | ||||||
|     void set_pid(pid_t); |     void set_pid(pid_t); | ||||||
|     void refresh(); |     void refresh(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     ProcessStacksWidget(); | ||||||
|  | 
 | ||||||
|     pid_t m_pid { -1 }; |     pid_t m_pid { -1 }; | ||||||
|     RefPtr<GUI::TextEditor> m_stacks_editor; |     RefPtr<GUI::TextEditor> m_stacks_editor; | ||||||
|     RefPtr<Core::Timer> m_timer; |     RefPtr<Core::Timer> m_timer; | ||||||
|  |  | ||||||
|  | @ -29,8 +29,7 @@ | ||||||
| #include <LibGUI/SortingProxyModel.h> | #include <LibGUI/SortingProxyModel.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| 
 | 
 | ||||||
| ProcessTableView::ProcessTableView(GUI::Widget* parent) | ProcessTableView::ProcessTableView() | ||||||
|     : TableView(parent) |  | ||||||
| { | { | ||||||
|     set_size_columns_to_fit_content(true); |     set_size_columns_to_fit_content(true); | ||||||
|     set_model(GUI::SortingProxyModel::create(ProcessModel::create())); |     set_model(GUI::SortingProxyModel::create(ProcessModel::create())); | ||||||
|  |  | ||||||
|  | @ -45,5 +45,5 @@ public: | ||||||
|     Function<void(pid_t)> on_process_selected; |     Function<void(pid_t)> on_process_selected; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ProcessTableView(GUI::Widget* parent = nullptr); |     ProcessTableView(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -29,12 +29,11 @@ | ||||||
| #include <LibGUI/JsonArrayModel.h> | #include <LibGUI/JsonArrayModel.h> | ||||||
| #include <LibGUI/TableView.h> | #include <LibGUI/TableView.h> | ||||||
| 
 | 
 | ||||||
| ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget(GUI::Widget* parent) | ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_layout(make<GUI::VerticalBoxLayout>()); |     set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
|     layout()->set_margins({ 4, 4, 4, 4 }); |     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); |     m_table_view->set_size_columns_to_fit_content(true); | ||||||
| 
 | 
 | ||||||
|     Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; |     Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
|     void set_pid(pid_t); |     void set_pid(pid_t); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ProcessUnveiledPathsWidget(GUI::Widget* parent); |     ProcessUnveiledPathsWidget(); | ||||||
| 
 | 
 | ||||||
|     RefPtr<GUI::TableView> m_table_view; |     RefPtr<GUI::TableView> m_table_view; | ||||||
|     pid_t m_pid { -1 }; |     pid_t m_pid { -1 }; | ||||||
|  |  | ||||||
|  | @ -123,7 +123,7 @@ int main(int argc, char** argv) | ||||||
| 
 | 
 | ||||||
|     auto tabwidget = keeper->add<GUI::TabWidget>(); |     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); |     tabwidget->add_widget("Processes", process_container_splitter); | ||||||
| 
 | 
 | ||||||
|     auto process_table_container = process_container_splitter->add<GUI::Widget>(); |     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()); |     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); |     tabwidget->add_widget("Network", network_stats_widget); | ||||||
| 
 | 
 | ||||||
|     process_table_container->set_layout(make<GUI::VerticalBoxLayout>()); |     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 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); |     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); |     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); |     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_tab_widget->add_widget("Stacks", stacks_widget); | ||||||
| 
 | 
 | ||||||
|     process_table_view->on_process_selected = [&](pid_t pid) { |     process_table_view->on_process_selected = [&](pid_t pid) { | ||||||
|  |  | ||||||
|  | @ -29,8 +29,7 @@ | ||||||
| #include <LibGfx/Color.h> | #include <LibGfx/Color.h> | ||||||
| #include <LibGfx/Palette.h> | #include <LibGfx/Palette.h> | ||||||
| 
 | 
 | ||||||
| BackgroundWidget::BackgroundWidget(GUI::Widget* parent) | BackgroundWidget::BackgroundWidget() | ||||||
|     : GUI::Frame(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,10 +31,11 @@ | ||||||
| class BackgroundWidget : public GUI::Frame { | class BackgroundWidget : public GUI::Frame { | ||||||
|     C_OBJECT(BackgroundWidget) |     C_OBJECT(BackgroundWidget) | ||||||
| public: | public: | ||||||
|     explicit BackgroundWidget(GUI::Widget* parent = nullptr); |  | ||||||
|     virtual ~BackgroundWidget() override; |     virtual ~BackgroundWidget() override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     BackgroundWidget(); | ||||||
|  | 
 | ||||||
|     virtual void paint_event(GUI::PaintEvent&) override; |     virtual void paint_event(GUI::PaintEvent&) override; | ||||||
|     virtual void resize_event(GUI::ResizeEvent&) override; |     virtual void resize_event(GUI::ResizeEvent&) override; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -33,14 +33,8 @@ | ||||||
| #include <LibGfx/Font.h> | #include <LibGfx/Font.h> | ||||||
| #include <LibGfx/Palette.h> | #include <LibGfx/Palette.h> | ||||||
| 
 | 
 | ||||||
| TextWidget::TextWidget(GUI::Widget* parent) | TextWidget::TextWidget(const StringView& text) | ||||||
|     : GUI::Frame(parent) |     : m_text(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| TextWidget::TextWidget(const StringView& text, GUI::Widget* parent) |  | ||||||
|     : GUI::Frame(parent) |  | ||||||
|     , m_text(text) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,10 +32,9 @@ | ||||||
| #include <LibGfx/TextAlignment.h> | #include <LibGfx/TextAlignment.h> | ||||||
| 
 | 
 | ||||||
| class TextWidget : public GUI::Frame { | class TextWidget : public GUI::Frame { | ||||||
|     C_OBJECT(TextWidget) |     C_OBJECT(TextWidget); | ||||||
|  | 
 | ||||||
| public: | public: | ||||||
|     explicit TextWidget(GUI::Widget* parent = nullptr); |  | ||||||
|     TextWidget(const StringView& text, GUI::Widget* parent = nullptr); |  | ||||||
|     virtual ~TextWidget() override; |     virtual ~TextWidget() override; | ||||||
| 
 | 
 | ||||||
|     String text() const { return m_text; } |     String text() const { return m_text; } | ||||||
|  | @ -53,6 +52,8 @@ public: | ||||||
|     void wrap_and_set_height(); |     void wrap_and_set_height(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     explicit TextWidget(const StringView& text = {}); | ||||||
|  | 
 | ||||||
|     virtual void paint_event(GUI::PaintEvent&) override; |     virtual void paint_event(GUI::PaintEvent&) override; | ||||||
|     virtual void resize_event(GUI::ResizeEvent&) override; |     virtual void resize_event(GUI::ResizeEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -25,12 +25,8 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "UnuncheckableButton.h" | #include "UnuncheckableButton.h" | ||||||
| #include <LibGUI/Painter.h> |  | ||||||
| #include <LibGfx/Color.h> |  | ||||||
| #include <LibGfx/Palette.h> |  | ||||||
| 
 | 
 | ||||||
| UnuncheckableButton::UnuncheckableButton(GUI::Widget* parent) | UnuncheckableButton::UnuncheckableButton() | ||||||
|     : GUI::Button(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,8 +31,10 @@ | ||||||
| class UnuncheckableButton : public GUI::Button { | class UnuncheckableButton : public GUI::Button { | ||||||
|     C_OBJECT(UnuncheckableButton) |     C_OBJECT(UnuncheckableButton) | ||||||
| public: | public: | ||||||
|     explicit UnuncheckableButton(GUI::Widget* parent = nullptr); |  | ||||||
|     virtual ~UnuncheckableButton() override; |     virtual ~UnuncheckableButton() override; | ||||||
| 
 | 
 | ||||||
|     virtual bool is_uncheckable() const override { return false; } |     virtual bool is_uncheckable() const override { return false; } | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     UnuncheckableButton(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ int main(int argc, char** argv) | ||||||
|     dbg() << "UI_" << name << "::UI_" << name << "()"; |     dbg() << "UI_" << name << "::UI_" << name << "()"; | ||||||
|     dbg() << "{"; |     dbg() << "{"; | ||||||
| 
 | 
 | ||||||
|     dbg() << "    main_widget = GUI::Widget::construct(nullptr);"; |     dbg() << "    main_widget = GUI::Widget::construct();"; | ||||||
|     dbg() << "    main_widget->set_fill_with_background_color(true);"; |     dbg() << "    main_widget->set_fill_with_background_color(true);"; | ||||||
| 
 | 
 | ||||||
|     widgets.as_array().for_each([&](auto& value) { |     widgets.as_array().for_each([&](auto& value) { | ||||||
|  | @ -98,7 +98,7 @@ int main(int argc, char** argv) | ||||||
|         const JsonObject& widget_object = value.as_object(); |         const JsonObject& widget_object = value.as_object(); | ||||||
|         auto name = widget_object.get("name").to_string(); |         auto name = widget_object.get("name").to_string(); | ||||||
|         auto class_name = widget_object.get("class").to_string(); |         auto class_name = widget_object.get("class").to_string(); | ||||||
|         dbg() << "    " << name << " = " << class_name << "::construct(main_widget);"; |         dbg() << "    " << name << " = main_widget->add<" << class_name << ">();"; | ||||||
| 
 | 
 | ||||||
|         widget_object.for_each_member([&](auto& property_name, const JsonValue& property_value) { |         widget_object.for_each_member([&](auto& property_name, const JsonValue& property_value) { | ||||||
|             if (property_name == "class") |             if (property_name == "class") | ||||||
|  |  | ||||||
|  | @ -286,7 +286,8 @@ int main(int argc, char** argv) | ||||||
|         auto icon_path = String::format("/res/icons/widgets/G%s.png", reg.class_name().characters()); |         auto icon_path = String::format("/res/icons/widgets/G%s.png", reg.class_name().characters()); | ||||||
|         auto action = GUI::Action::create(reg.class_name(), Gfx::Bitmap::load_from_file(icon_path), [®](auto&) { |         auto action = GUI::Action::create(reg.class_name(), Gfx::Bitmap::load_from_file(icon_path), [®](auto&) { | ||||||
|             g_form_editor_widget->set_tool(make<WidgetTool>(*g_form_editor_widget, reg)); |             g_form_editor_widget->set_tool(make<WidgetTool>(*g_form_editor_widget, reg)); | ||||||
|             auto widget = reg.construct(&g_form_editor_widget->form_widget()); |             auto widget = reg.construct(); | ||||||
|  |             g_form_editor_widget->form_widget().add_child(widget); | ||||||
|             widget->set_relative_rect(30, 30, 30, 30); |             widget->set_relative_rect(30, 30, 30, 30); | ||||||
|             g_form_editor_widget->model().update(); |             g_form_editor_widget->model().update(); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  | @ -28,9 +28,8 @@ | ||||||
| #include "Profile.h" | #include "Profile.h" | ||||||
| #include <LibGUI/Painter.h> | #include <LibGUI/Painter.h> | ||||||
| 
 | 
 | ||||||
| ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile, GUI::Widget* parent) | ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile) | ||||||
|     : GUI::Frame(parent) |     : m_profile(profile) | ||||||
|     , m_profile(profile) |  | ||||||
| { | { | ||||||
|     set_background_color(Color::White); |     set_background_color(Color::White); | ||||||
|     set_fill_with_background_color(true); |     set_fill_with_background_color(true); | ||||||
|  |  | ||||||
|  | @ -39,7 +39,7 @@ private: | ||||||
|     virtual void mousemove_event(GUI::MouseEvent&) override; |     virtual void mousemove_event(GUI::MouseEvent&) override; | ||||||
|     virtual void mouseup_event(GUI::MouseEvent&) override; |     virtual void mouseup_event(GUI::MouseEvent&) override; | ||||||
| 
 | 
 | ||||||
|     ProfileTimelineWidget(Profile&, GUI::Widget* parent); |     explicit ProfileTimelineWidget(Profile&); | ||||||
| 
 | 
 | ||||||
|     u64 timestamp_at_x(int x) const; |     u64 timestamp_at_x(int x) const; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -62,9 +62,9 @@ int main(int argc, char** argv) | ||||||
|     main_widget->set_fill_with_background_color(true); |     main_widget->set_fill_with_background_color(true); | ||||||
|     main_widget->set_layout(make<GUI::VerticalBoxLayout>()); |     main_widget->set_layout(make<GUI::VerticalBoxLayout>()); | ||||||
| 
 | 
 | ||||||
|     auto timeline_widget = ProfileTimelineWidget::construct(*profile, main_widget); |     auto timeline_widget = main_widget->add<ProfileTimelineWidget>(*profile); | ||||||
| 
 | 
 | ||||||
|     auto tree_view = GUI::TreeView::construct(main_widget); |     auto tree_view = main_widget->add<GUI::TreeView>(); | ||||||
|     tree_view->set_headers_visible(true); |     tree_view->set_headers_visible(true); | ||||||
|     tree_view->set_size_columns_to_fit_content(true); |     tree_view->set_size_columns_to_fit_content(true); | ||||||
|     tree_view->set_model(profile->model()); |     tree_view->set_model(profile->model()); | ||||||
|  |  | ||||||
|  | @ -44,9 +44,8 @@ VBForm* VBForm::current() | ||||||
|     return s_current; |     return s_current; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| VBForm::VBForm(const String& name, GUI::Widget* parent) | VBForm::VBForm(const String& name) | ||||||
|     : GUI::Widget(parent) |     : m_name(name) | ||||||
|     , m_name(name) |  | ||||||
| { | { | ||||||
|     s_current = this; |     s_current = this; | ||||||
|     set_fill_with_background_color(true); |     set_fill_with_background_color(true); | ||||||
|  |  | ||||||
|  | @ -33,8 +33,8 @@ | ||||||
| class VBForm : public GUI::Widget { | class VBForm : public GUI::Widget { | ||||||
|     C_OBJECT(VBForm) |     C_OBJECT(VBForm) | ||||||
|     friend class VBWidget; |     friend class VBWidget; | ||||||
|  | 
 | ||||||
| public: | public: | ||||||
|     explicit VBForm(const String& name, GUI::Widget* parent = nullptr); |  | ||||||
|     virtual ~VBForm() override; |     virtual ~VBForm() override; | ||||||
| 
 | 
 | ||||||
|     static VBForm* current(); |     static VBForm* current(); | ||||||
|  | @ -66,6 +66,8 @@ protected: | ||||||
|     virtual void keydown_event(GUI::KeyEvent&) override; |     virtual void keydown_event(GUI::KeyEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     explicit VBForm(const String& name); | ||||||
|  | 
 | ||||||
|     void grabber_mousedown_event(GUI::MouseEvent&, Direction grabber); |     void grabber_mousedown_event(GUI::MouseEvent&, Direction grabber); | ||||||
|     void set_single_selected_widget(VBWidget*); |     void set_single_selected_widget(VBWidget*); | ||||||
|     void add_to_selection(VBWidget&); |     void add_to_selection(VBWidget&); | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     virtual RefPtr<GUI::Widget> create_widget() override |     virtual RefPtr<GUI::Widget> create_widget() override | ||||||
|     { |     { | ||||||
|         auto combo = GUI::ComboBox::construct(nullptr); |         auto combo = GUI::ComboBox::construct(); | ||||||
|         combo->set_only_allow_values_from_model(true); |         combo->set_only_allow_values_from_model(true); | ||||||
|         combo->set_model(adopt(*new BoolValuesModel)); |         combo->set_model(adopt(*new BoolValuesModel)); | ||||||
|         combo->on_return_pressed = [this] { commit(); }; |         combo->on_return_pressed = [this] { commit(); }; | ||||||
|  | @ -87,7 +87,7 @@ VBPropertiesWindow::VBPropertiesWindow() | ||||||
|     widget->layout()->set_margins({ 2, 2, 2, 2 }); |     widget->layout()->set_margins({ 2, 2, 2, 2 }); | ||||||
|     set_main_widget(widget); |     set_main_widget(widget); | ||||||
| 
 | 
 | ||||||
|     m_table_view = GUI::TableView::construct(widget); |     m_table_view = widget->add<GUI::TableView>(); | ||||||
|     m_table_view->set_headers_visible(false); |     m_table_view->set_headers_visible(false); | ||||||
|     m_table_view->set_editable(true); |     m_table_view->set_editable(true); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -112,7 +112,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|     widget->layout()->set_spacing(0); |     widget->layout()->set_spacing(0); | ||||||
|     window->set_main_widget(widget); |     window->set_main_widget(widget); | ||||||
| 
 | 
 | ||||||
|     auto label_button = GUI::Button::construct(widget); |     auto label_button = widget->add<GUI::Button>(); | ||||||
|     label_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     label_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     label_button->set_tooltip("GLabel"); |     label_button->set_tooltip("GLabel"); | ||||||
|     label_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png")); |     label_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png")); | ||||||
|  | @ -121,7 +121,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|             form->insert_widget(VBWidgetType::GLabel); |             form->insert_widget(VBWidgetType::GLabel); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     auto button_button = GUI::Button::construct(widget); |     auto button_button = widget->add<GUI::Button>(); | ||||||
|     button_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     button_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     button_button->set_tooltip("GButton"); |     button_button->set_tooltip("GButton"); | ||||||
|     button_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png")); |     button_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png")); | ||||||
|  | @ -129,7 +129,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GButton); |             form->insert_widget(VBWidgetType::GButton); | ||||||
|     }; |     }; | ||||||
|     auto spinbox_button = GUI::Button::construct(widget); |     auto spinbox_button = widget->add<GUI::Button>(); | ||||||
|     spinbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     spinbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     spinbox_button->set_tooltip("GSpinBox"); |     spinbox_button->set_tooltip("GSpinBox"); | ||||||
|     spinbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png")); |     spinbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png")); | ||||||
|  | @ -137,7 +137,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GSpinBox); |             form->insert_widget(VBWidgetType::GSpinBox); | ||||||
|     }; |     }; | ||||||
|     auto editor_button = GUI::Button::construct(widget); |     auto editor_button = widget->add<GUI::Button>(); | ||||||
|     editor_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     editor_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     editor_button->set_tooltip("GTextEditor"); |     editor_button->set_tooltip("GTextEditor"); | ||||||
|     editor_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png")); |     editor_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png")); | ||||||
|  | @ -145,7 +145,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GTextEditor); |             form->insert_widget(VBWidgetType::GTextEditor); | ||||||
|     }; |     }; | ||||||
|     auto progress_bar_button = GUI::Button::construct(widget); |     auto progress_bar_button = widget->add<GUI::Button>(); | ||||||
|     progress_bar_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     progress_bar_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     progress_bar_button->set_tooltip("GProgressBar"); |     progress_bar_button->set_tooltip("GProgressBar"); | ||||||
|     progress_bar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png")); |     progress_bar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png")); | ||||||
|  | @ -153,7 +153,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GProgressBar); |             form->insert_widget(VBWidgetType::GProgressBar); | ||||||
|     }; |     }; | ||||||
|     auto slider_button = GUI::Button::construct(widget); |     auto slider_button = widget->add<GUI::Button>(); | ||||||
|     slider_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     slider_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     slider_button->set_tooltip("GSlider"); |     slider_button->set_tooltip("GSlider"); | ||||||
|     slider_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png")); |     slider_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png")); | ||||||
|  | @ -161,7 +161,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GSlider); |             form->insert_widget(VBWidgetType::GSlider); | ||||||
|     }; |     }; | ||||||
|     auto checkbox_button = GUI::Button::construct(widget); |     auto checkbox_button = widget->add<GUI::Button>(); | ||||||
|     checkbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     checkbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     checkbox_button->set_tooltip("GCheckBox"); |     checkbox_button->set_tooltip("GCheckBox"); | ||||||
|     checkbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png")); |     checkbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png")); | ||||||
|  | @ -169,7 +169,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GCheckBox); |             form->insert_widget(VBWidgetType::GCheckBox); | ||||||
|     }; |     }; | ||||||
|     auto radiobutton_button = GUI::Button::construct(widget); |     auto radiobutton_button = widget->add<GUI::Button>(); | ||||||
|     radiobutton_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     radiobutton_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     radiobutton_button->set_tooltip("GRadioButton"); |     radiobutton_button->set_tooltip("GRadioButton"); | ||||||
|     radiobutton_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png")); |     radiobutton_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png")); | ||||||
|  | @ -177,7 +177,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GRadioButton); |             form->insert_widget(VBWidgetType::GRadioButton); | ||||||
|     }; |     }; | ||||||
|     auto scrollbar_button = GUI::Button::construct(widget); |     auto scrollbar_button = widget->add<GUI::Button>(); | ||||||
|     scrollbar_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     scrollbar_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     scrollbar_button->set_tooltip("GScrollBar"); |     scrollbar_button->set_tooltip("GScrollBar"); | ||||||
|     scrollbar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png")); |     scrollbar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png")); | ||||||
|  | @ -185,7 +185,7 @@ RefPtr<GUI::Window> make_toolbox_window() | ||||||
|         if (auto* form = VBForm::current()) |         if (auto* form = VBForm::current()) | ||||||
|             form->insert_widget(VBWidgetType::GScrollBar); |             form->insert_widget(VBWidgetType::GScrollBar); | ||||||
|     }; |     }; | ||||||
|     auto groupbox_button = GUI::Button::construct(widget); |     auto groupbox_button = widget->add<GUI::Button>(); | ||||||
|     groupbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); |     groupbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); | ||||||
|     groupbox_button->set_tooltip("GGroupBox"); |     groupbox_button->set_tooltip("GGroupBox"); | ||||||
|     groupbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png")); |     groupbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png")); | ||||||
|  |  | ||||||
|  | @ -36,12 +36,9 @@ | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| class SquareButton final : public GUI::Button { | class SquareButton final : public GUI::Button { | ||||||
| public: |     C_OBJECT(SquareButton); | ||||||
|     SquareButton(GUI::Widget* parent) |  | ||||||
|         : GUI::Button(parent) |  | ||||||
|     { |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|  | public: | ||||||
|     Function<void()> on_right_click; |     Function<void()> on_right_click; | ||||||
|     Function<void()> on_middle_click; |     Function<void()> on_middle_click; | ||||||
| 
 | 
 | ||||||
|  | @ -57,16 +54,15 @@ public: | ||||||
|         } |         } | ||||||
|         GUI::Button::mousedown_event(event); |         GUI::Button::mousedown_event(event); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     SquareButton() {} | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class SquareLabel final : public GUI::Label { | class SquareLabel final : public GUI::Label { | ||||||
| public: |     C_OBJECT(SquareLabel); | ||||||
|     SquareLabel(Square& square, GUI::Widget* parent) |  | ||||||
|         : GUI::Label(parent) |  | ||||||
|         , m_square(square) |  | ||||||
|     { |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|  | public: | ||||||
|     Function<void()> on_chord_click; |     Function<void()> on_chord_click; | ||||||
| 
 | 
 | ||||||
|     virtual void mousedown_event(GUI::MouseEvent& event) override |     virtual void mousedown_event(GUI::MouseEvent& event) override | ||||||
|  | @ -115,6 +111,12 @@ public: | ||||||
|         GUI::Label::mouseup_event(event); |         GUI::Label::mouseup_event(event); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | private: | ||||||
|  |     explicit SquareLabel(Square& square) | ||||||
|  |         : m_square(square) | ||||||
|  |     { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     Square& m_square; |     Square& m_square; | ||||||
|     bool m_chord { false }; |     bool m_chord { false }; | ||||||
| }; | }; | ||||||
|  | @ -243,7 +245,7 @@ void Field::reset() | ||||||
|             square.is_considering = false; |             square.is_considering = false; | ||||||
|             square.is_swept = false; |             square.is_swept = false; | ||||||
|             if (!square.label) { |             if (!square.label) { | ||||||
|                 square.label = new SquareLabel(square, this); |                 square.label = add<SquareLabel>(square); | ||||||
|                 square.label->set_background_color(Color::from_rgb(0xff4040)); |                 square.label->set_background_color(Color::from_rgb(0xff4040)); | ||||||
|             } |             } | ||||||
|             square.label->set_fill_with_background_color(false); |             square.label->set_fill_with_background_color(false); | ||||||
|  | @ -251,7 +253,7 @@ void Field::reset() | ||||||
|             square.label->set_visible(false); |             square.label->set_visible(false); | ||||||
|             square.label->set_icon(square.has_mine ? m_mine_bitmap : nullptr); |             square.label->set_icon(square.has_mine ? m_mine_bitmap : nullptr); | ||||||
|             if (!square.button) { |             if (!square.button) { | ||||||
|                 square.button = new SquareButton(this); |                 square.button = add<SquareButton>(); | ||||||
|                 square.button->on_click = [this, &square](GUI::Button&) { |                 square.button->on_click = [this, &square](GUI::Button&) { | ||||||
|                     on_square_clicked(square); |                     on_square_clicked(square); | ||||||
|                 }; |                 }; | ||||||
|  | @ -513,10 +515,12 @@ void Field::set_single_chording(bool enabled) | ||||||
|     config->write_bool_entry("Minesweeper", "SingleChording", m_single_chording); |     config->write_bool_entry("Minesweeper", "SingleChording", m_single_chording); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | Square::Square() | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
| Square::~Square() | Square::~Square() | ||||||
| { | { | ||||||
|     delete label; |  | ||||||
|     delete button; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<typename Callback> | template<typename Callback> | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ class SquareLabel; | ||||||
| class Square { | class Square { | ||||||
|     AK_MAKE_NONCOPYABLE(Square) |     AK_MAKE_NONCOPYABLE(Square) | ||||||
| public: | public: | ||||||
|     Square() {} |     Square(); | ||||||
|     ~Square(); |     ~Square(); | ||||||
| 
 | 
 | ||||||
|     Field* field { nullptr }; |     Field* field { nullptr }; | ||||||
|  | @ -48,8 +48,8 @@ public: | ||||||
|     int row { 0 }; |     int row { 0 }; | ||||||
|     int column { 0 }; |     int column { 0 }; | ||||||
|     int number { 0 }; |     int number { 0 }; | ||||||
|     SquareButton* button { nullptr }; |     RefPtr<SquareButton> button; | ||||||
|     SquareLabel* label { nullptr }; |     RefPtr<SquareLabel> label; | ||||||
| 
 | 
 | ||||||
|     template<typename Callback> |     template<typename Callback> | ||||||
|     void for_each_neighbor(Callback); |     void for_each_neighbor(Callback); | ||||||
|  |  | ||||||
|  | @ -32,8 +32,7 @@ | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <time.h> | #include <time.h> | ||||||
| 
 | 
 | ||||||
| SnakeGame::SnakeGame(GUI::Widget* parent) | SnakeGame::SnakeGame() | ||||||
|     : GUI::Widget(parent) |  | ||||||
| { | { | ||||||
|     set_font(GFontDatabase::the().get_by_name("Liza Regular")); |     set_font(GFontDatabase::the().get_by_name("Liza Regular")); | ||||||
|     m_fruit_bitmaps.append(*Gfx::Bitmap::load_from_file("/res/icons/snake/paprika.png")); |     m_fruit_bitmaps.append(*Gfx::Bitmap::load_from_file("/res/icons/snake/paprika.png")); | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ public: | ||||||
|     void reset(); |     void reset(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit SnakeGame(GUI::Widget* parent = nullptr); |     SnakeGame(); | ||||||
|     virtual void paint_event(GUI::PaintEvent&) override; |     virtual void paint_event(GUI::PaintEvent&) override; | ||||||
|     virtual void keydown_event(GUI::KeyEvent&) override; |     virtual void keydown_event(GUI::KeyEvent&) override; | ||||||
|     virtual void timer_event(Core::TimerEvent&) override; |     virtual void timer_event(Core::TimerEvent&) override; | ||||||
|  |  | ||||||
|  | @ -31,14 +31,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| AbstractButton::AbstractButton(Widget* parent) | AbstractButton::AbstractButton(const StringView& text) | ||||||
|     : AbstractButton({}, parent) |     : m_text(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| AbstractButton::AbstractButton(const StringView& text, Widget* parent) |  | ||||||
|     : Widget(parent) |  | ||||||
|     , m_text(text) |  | ||||||
| { | { | ||||||
|     m_auto_repeat_timer = add<Core::Timer>(); |     m_auto_repeat_timer = add<Core::Timer>(); | ||||||
|     m_auto_repeat_timer->on_timeout = [this] { |     m_auto_repeat_timer->on_timeout = [this] { | ||||||
|  |  | ||||||
|  | @ -60,8 +60,7 @@ public: | ||||||
|     void set_auto_repeat_interval(int interval) { m_auto_repeat_interval = interval; } |     void set_auto_repeat_interval(int interval) { m_auto_repeat_interval = interval; } | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit AbstractButton(Widget* parent = nullptr); |     explicit AbstractButton(const StringView& = {}); | ||||||
|     AbstractButton(const StringView&, Widget* parent = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     virtual void mousedown_event(MouseEvent&) override; |     virtual void mousedown_event(MouseEvent&) override; | ||||||
|     virtual void mousemove_event(MouseEvent&) override; |     virtual void mousemove_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -39,8 +39,7 @@ namespace GUI { | ||||||
| 
 | 
 | ||||||
| static const int minimum_column_width = 2; | static const int minimum_column_width = 2; | ||||||
| 
 | 
 | ||||||
| AbstractTableView::AbstractTableView(Widget* parent) | AbstractTableView::AbstractTableView() | ||||||
|     : AbstractView(parent) |  | ||||||
| { | { | ||||||
|     set_should_hide_unnecessary_scrollbars(true); |     set_should_hide_unnecessary_scrollbars(true); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ public: | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     virtual ~AbstractTableView() override; |     virtual ~AbstractTableView() override; | ||||||
|     explicit AbstractTableView(Widget* parent = nullptr); |     AbstractTableView(); | ||||||
| 
 | 
 | ||||||
|     virtual void did_update_model() override; |     virtual void did_update_model() override; | ||||||
|     virtual void mouseup_event(MouseEvent&) override; |     virtual void mouseup_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -37,9 +37,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| AbstractView::AbstractView(Widget* parent) | AbstractView::AbstractView() | ||||||
|     : ScrollableWidget(parent) |     : m_selection(*this) | ||||||
|     , m_selection(*this) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -73,7 +73,7 @@ public: | ||||||
|     NonnullRefPtr<Gfx::Font> font_for_index(const ModelIndex&) const; |     NonnullRefPtr<Gfx::Font> font_for_index(const ModelIndex&) const; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit AbstractView(Widget* parent = nullptr); |     AbstractView(); | ||||||
|     virtual ~AbstractView() override; |     virtual ~AbstractView() override; | ||||||
| 
 | 
 | ||||||
|     virtual void mousedown_event(MouseEvent&) override; |     virtual void mousedown_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -36,13 +36,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| Button::Button(Widget* parent) | Button::Button(const StringView& text) | ||||||
|     : AbstractButton(parent) |     : AbstractButton(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Button::Button(const StringView& text, Widget* parent) |  | ||||||
|     : AbstractButton(text, parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -62,8 +62,7 @@ public: | ||||||
|     void set_focusable(bool b) { m_focusable = b; } |     void set_focusable(bool b) { m_focusable = b; } | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     Button(const StringView& text, Widget* parent = nullptr); |     explicit Button(const StringView& text = {}); | ||||||
|     explicit Button(Widget* parent = nullptr); |  | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |  | ||||||
|  | @ -52,13 +52,8 @@ static const int s_checked_bitmap_height = 9; | ||||||
| static const int s_box_width = 13; | static const int s_box_width = 13; | ||||||
| static const int s_box_height = 13; | static const int s_box_height = 13; | ||||||
| 
 | 
 | ||||||
| CheckBox::CheckBox(Widget* parent) | CheckBox::CheckBox(const StringView& text) | ||||||
|     : AbstractButton(parent) |     : AbstractButton(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| CheckBox::CheckBox(const StringView& text, Widget* parent) |  | ||||||
|     : AbstractButton(text, parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,8 +38,7 @@ public: | ||||||
|     virtual void click() override; |     virtual void click() override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     CheckBox(const StringView&, Widget* parent = nullptr); |     explicit CheckBox(const StringView& = {}); | ||||||
|     explicit CheckBox(Widget* parent = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     // These don't make sense for a check box, so hide them.
 |     // These don't make sense for a check box, so hide them.
 | ||||||
|     using AbstractButton::auto_repeat_interval; |     using AbstractButton::auto_repeat_interval; | ||||||
|  |  | ||||||
|  | @ -47,8 +47,7 @@ static const char* s_arrow_bitmap_data = { | ||||||
| static const int s_arrow_bitmap_width = 9; | static const int s_arrow_bitmap_width = 9; | ||||||
| static const int s_arrow_bitmap_height = 9; | static const int s_arrow_bitmap_height = 9; | ||||||
| 
 | 
 | ||||||
| ColumnsView::ColumnsView(Widget* parent) | ColumnsView::ColumnsView() | ||||||
|     : AbstractView(parent) |  | ||||||
| { | { | ||||||
|     set_fill_with_background_color(true); |     set_fill_with_background_color(true); | ||||||
|     set_background_role(ColorRole::Base); |     set_background_role(ColorRole::Base); | ||||||
|  |  | ||||||
|  | @ -40,8 +40,8 @@ public: | ||||||
|     virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; |     virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     ColumnsView(Widget* parent = nullptr); |     ColumnsView(); | ||||||
|     virtual ~ColumnsView(); |     virtual ~ColumnsView() override; | ||||||
|     void push_column(ModelIndex& parent_index); |     void push_column(ModelIndex& parent_index); | ||||||
|     void update_column_sizes(); |     void update_column_sizes(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,8 +35,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| ComboBox::ComboBox(Widget* parent) | ComboBox::ComboBox() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
|     m_editor = add<TextBox>(); |     m_editor = add<TextBox>(); | ||||||
|     m_editor->on_change = [this] { |     m_editor->on_change = [this] { | ||||||
|  | @ -57,11 +56,11 @@ ComboBox::ComboBox(Widget* parent) | ||||||
|             open(); |             open(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_list_window = Window::construct(this); |     m_list_window = add<Window>(); | ||||||
|     // FIXME: This is obviously not a tooltip window, but it's the closest thing to what we want atm.
 |     // FIXME: This is obviously not a tooltip window, but it's the closest thing to what we want atm.
 | ||||||
|     m_list_window->set_window_type(WindowType::Tooltip); |     m_list_window->set_window_type(WindowType::Tooltip); | ||||||
| 
 | 
 | ||||||
|     m_list_view = ListView::construct(nullptr); |     m_list_view = ListView::construct(); | ||||||
|     m_list_view->horizontal_scrollbar().set_visible(false); |     m_list_view->horizontal_scrollbar().set_visible(false); | ||||||
|     m_list_window->set_main_widget(m_list_view); |     m_list_window->set_main_widget(m_list_view); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -56,7 +56,7 @@ public: | ||||||
|     Function<void()> on_return_pressed; |     Function<void()> on_return_pressed; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit ComboBox(Widget* parent = nullptr); |     ComboBox(); | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |  | ||||||
|  | @ -31,8 +31,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| Frame::Frame(Widget* parent) | Frame::Frame() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
|     set_frame_thickness(2); |     set_frame_thickness(2); | ||||||
|     set_frame_shape(Gfx::FrameShape::Container); |     set_frame_shape(Gfx::FrameShape::Container); | ||||||
|  |  | ||||||
|  | @ -49,7 +49,7 @@ public: | ||||||
|     Gfx::Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); } |     Gfx::Rect frame_inner_rect() const { return frame_inner_rect_for_size(size()); } | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit Frame(Widget* parent = nullptr); |     Frame(); | ||||||
|     void paint_event(PaintEvent&) override; |     void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |  | ||||||
|  | @ -32,14 +32,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| GroupBox::GroupBox(Widget* parent) | GroupBox::GroupBox(const StringView& title) | ||||||
|     : GroupBox({}, parent) |     : m_title(title) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| GroupBox::GroupBox(const StringView& title, Widget* parent) |  | ||||||
|     : Widget(parent) |  | ||||||
|     , m_title(title) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -39,8 +39,7 @@ public: | ||||||
|     void set_title(const StringView&); |     void set_title(const StringView&); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit GroupBox(Widget* parent = nullptr); |     explicit GroupBox(const StringView& title = {}); | ||||||
|     GroupBox(const StringView& title, Widget* parent = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -37,8 +37,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| ItemView::ItemView(Widget* parent) | ItemView::ItemView() | ||||||
|     : AbstractView(parent) |  | ||||||
| { | { | ||||||
|     set_background_role(ColorRole::Base); |     set_background_role(ColorRole::Base); | ||||||
|     set_foreground_role(ColorRole::BaseText); |     set_foreground_role(ColorRole::BaseText); | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ public: | ||||||
|     virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; |     virtual ModelIndex index_at_event_position(const Gfx::Point&) const override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ItemView(Widget* parent = nullptr); |     ItemView(); | ||||||
| 
 | 
 | ||||||
|     virtual void did_update_model() override; |     virtual void did_update_model() override; | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|  |  | ||||||
|  | @ -32,14 +32,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| Label::Label(Widget* parent) | Label::Label(const StringView& text) | ||||||
|     : Label({}, parent) |     : m_text(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Label::Label(const StringView& text, Widget* parent) |  | ||||||
|     : Frame(parent) |  | ||||||
|     , m_text(text) |  | ||||||
| { | { | ||||||
|     set_frame_thickness(0); |     set_frame_thickness(0); | ||||||
|     set_frame_shadow(Gfx::FrameShadow::Plain); |     set_frame_shadow(Gfx::FrameShadow::Plain); | ||||||
|  |  | ||||||
|  | @ -52,8 +52,7 @@ public: | ||||||
|     void size_to_fit(); |     void size_to_fit(); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit Label(Widget* parent = nullptr); |     explicit Label(const StringView& text = {}); | ||||||
|     Label(const StringView& text, Widget* parent = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -28,8 +28,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| LazyWidget::LazyWidget(Widget* parent) | LazyWidget::LazyWidget() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ public: | ||||||
|     Function<void(LazyWidget&)> on_first_show; |     Function<void(LazyWidget&)> on_first_show; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit LazyWidget(Widget* parent = nullptr); |     LazyWidget(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     virtual void show_event(ShowEvent&) override; |     virtual void show_event(ShowEvent&) override; | ||||||
|  |  | ||||||
|  | @ -33,8 +33,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| ListView::ListView(Widget* parent) | ListView::ListView() | ||||||
|     : AbstractView(parent) |  | ||||||
| { | { | ||||||
|     set_background_role(ColorRole::Base); |     set_background_role(ColorRole::Base); | ||||||
|     set_foreground_role(ColorRole::BaseText); |     set_foreground_role(ColorRole::BaseText); | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ namespace GUI { | ||||||
| class ListView : public AbstractView { | class ListView : public AbstractView { | ||||||
|     C_OBJECT(ListView) |     C_OBJECT(ListView) | ||||||
| public: | public: | ||||||
|     explicit ListView(Widget* parent = nullptr); |  | ||||||
|     virtual ~ListView() override; |     virtual ~ListView() override; | ||||||
| 
 | 
 | ||||||
|     int item_height() const { return 16; } |     int item_height() const { return 16; } | ||||||
|  | @ -54,6 +53,8 @@ public: | ||||||
|     void set_model_column(int column) { m_model_column = column; } |     void set_model_column(int column) { m_model_column = column; } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |     ListView(); | ||||||
|  | 
 | ||||||
|     virtual void did_update_model() override; |     virtual void did_update_model() override; | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void doubleclick_event(MouseEvent&) override; |     virtual void doubleclick_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -77,7 +77,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     virtual RefPtr<Widget> create_widget() override |     virtual RefPtr<Widget> create_widget() override | ||||||
|     { |     { | ||||||
|         auto textbox = TextBox::construct(nullptr); |         auto textbox = TextBox::construct(); | ||||||
|         textbox->on_return_pressed = [this] { |         textbox->on_return_pressed = [this] { | ||||||
|             commit(); |             commit(); | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  | @ -32,8 +32,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| ProgressBar::ProgressBar(Widget* parent) | ProgressBar::ProgressBar() | ||||||
|     : Frame(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -56,7 +56,7 @@ public: | ||||||
|     void set_format(Format format) { m_format = format; } |     void set_format(Format format) { m_format = format; } | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit ProgressBar(Widget* parent = nullptr); |     ProgressBar(); | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,13 +33,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| RadioButton::RadioButton(Widget* parent) | RadioButton::RadioButton(const StringView& text) | ||||||
|     : RadioButton({}, parent) |     : AbstractButton(text) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| RadioButton::RadioButton(const StringView& text, Widget* parent) |  | ||||||
|     : AbstractButton(text, parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,8 +38,7 @@ public: | ||||||
|     virtual void click() override; |     virtual void click() override; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit RadioButton(Widget* parent = nullptr); |     explicit RadioButton(const StringView& text = {}); | ||||||
|     explicit RadioButton(const StringView& text, Widget* parent = nullptr); |  | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |  | ||||||
|  | @ -75,8 +75,7 @@ static Gfx::CharacterBitmap* s_resize_corner_highlights_bitmap; | ||||||
| static const int s_resize_corner_bitmap_width = 16; | static const int s_resize_corner_bitmap_width = 16; | ||||||
| static const int s_resize_corner_bitmap_height = 16; | static const int s_resize_corner_bitmap_height = 16; | ||||||
| 
 | 
 | ||||||
| ResizeCorner::ResizeCorner(Widget* parent) | ResizeCorner::ResizeCorner() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
|     set_background_role(ColorRole::Button); |     set_background_role(ColorRole::Button); | ||||||
|     set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed); |     set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed); | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ public: | ||||||
|     virtual ~ResizeCorner() override; |     virtual ~ResizeCorner() override; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit ResizeCorner(Widget* parent = nullptr); |     ResizeCorner(); | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void mousedown_event(MouseEvent&) override; |     virtual void mousedown_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -86,14 +86,8 @@ static Gfx::CharacterBitmap* s_down_arrow_bitmap; | ||||||
| static Gfx::CharacterBitmap* s_left_arrow_bitmap; | static Gfx::CharacterBitmap* s_left_arrow_bitmap; | ||||||
| static Gfx::CharacterBitmap* s_right_arrow_bitmap; | static Gfx::CharacterBitmap* s_right_arrow_bitmap; | ||||||
| 
 | 
 | ||||||
| ScrollBar::ScrollBar(Widget* parent) | ScrollBar::ScrollBar(Orientation orientation) | ||||||
|     : ScrollBar(Orientation::Vertical, parent) |     : m_orientation(orientation) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ScrollBar::ScrollBar(Orientation orientation, Widget* parent) |  | ||||||
|     : Widget(parent) |  | ||||||
|     , m_orientation(orientation) |  | ||||||
| { | { | ||||||
|     m_automatic_scrolling_timer = add<Core::Timer>(); |     m_automatic_scrolling_timer = add<Core::Timer>(); | ||||||
|     if (!s_up_arrow_bitmap) |     if (!s_up_arrow_bitmap) | ||||||
|  |  | ||||||
|  | @ -65,8 +65,7 @@ public: | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit ScrollBar(Widget* parent = nullptr); |     explicit ScrollBar(Gfx::Orientation = Gfx::Orientation::Vertical); | ||||||
|     explicit ScrollBar(Orientation, Widget* parent = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void mousedown_event(MouseEvent&) override; |     virtual void mousedown_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -29,17 +29,16 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| ScrollableWidget::ScrollableWidget(Widget* parent) | ScrollableWidget::ScrollableWidget() | ||||||
|     : Frame(parent) |  | ||||||
| { | { | ||||||
|     m_vertical_scrollbar = ScrollBar::construct(Orientation::Vertical, this); |     m_vertical_scrollbar = add<ScrollBar>(Orientation::Vertical); | ||||||
|     m_vertical_scrollbar->set_step(4); |     m_vertical_scrollbar->set_step(4); | ||||||
|     m_vertical_scrollbar->on_change = [this](int) { |     m_vertical_scrollbar->on_change = [this](int) { | ||||||
|         did_scroll(); |         did_scroll(); | ||||||
|         update(); |         update(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_horizontal_scrollbar = ScrollBar::construct(Orientation::Horizontal, this); |     m_horizontal_scrollbar = add<ScrollBar>(Orientation::Horizontal); | ||||||
|     m_horizontal_scrollbar->set_step(4); |     m_horizontal_scrollbar->set_step(4); | ||||||
|     m_horizontal_scrollbar->set_big_step(30); |     m_horizontal_scrollbar->set_big_step(30); | ||||||
|     m_horizontal_scrollbar->on_change = [this](int) { |     m_horizontal_scrollbar->on_change = [this](int) { | ||||||
|  | @ -47,7 +46,7 @@ ScrollableWidget::ScrollableWidget(Widget* parent) | ||||||
|         update(); |         update(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_corner_widget = Widget::construct(this); |     m_corner_widget = add<Widget>(); | ||||||
|     m_corner_widget->set_fill_with_background_color(true); |     m_corner_widget->set_fill_with_background_color(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -71,7 +71,7 @@ public: | ||||||
|     Gfx::Point to_widget_position(const Gfx::Point& content_position) const; |     Gfx::Point to_widget_position(const Gfx::Point& content_position) const; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit ScrollableWidget(Widget* parent = nullptr); |     ScrollableWidget(); | ||||||
|     virtual void custom_layout() override; |     virtual void custom_layout() override; | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
|     virtual void mousewheel_event(MouseEvent&) override; |     virtual void mousewheel_event(MouseEvent&) override; | ||||||
|  |  | ||||||
|  | @ -33,14 +33,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| Slider::Slider(Widget* parent) | Slider::Slider(Orientation orientation) | ||||||
|     : Slider(Orientation::Horizontal, parent) |     : m_orientation(orientation) | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| Slider::Slider(Orientation orientation, Widget* parent) |  | ||||||
|     : Widget(parent) |  | ||||||
|     , m_orientation(orientation) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -74,8 +74,7 @@ public: | ||||||
|     Function<void(int)> on_value_changed; |     Function<void(int)> on_value_changed; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit Slider(Widget* = nullptr); |     explicit Slider(Orientation = Orientation::Vertical); | ||||||
|     explicit Slider(Orientation, Widget* = nullptr); |  | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void mousedown_event(MouseEvent&) override; |     virtual void mousedown_event(MouseEvent&) override; | ||||||
|  | @ -106,8 +105,8 @@ public: | ||||||
|     virtual ~VerticalSlider() override {} |     virtual ~VerticalSlider() override {} | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit VerticalSlider(Widget* parent = nullptr) |     VerticalSlider() | ||||||
|         : Slider(Orientation::Vertical, parent) |         : Slider(Orientation::Vertical) | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|  | @ -118,8 +117,8 @@ public: | ||||||
|     virtual ~HorizontalSlider() override {} |     virtual ~HorizontalSlider() override {} | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit HorizontalSlider(Widget* parent = nullptr) |     HorizontalSlider() | ||||||
|         : Slider(Orientation::Horizontal, parent) |         : Slider(Orientation::Horizontal) | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -30,8 +30,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| SpinBox::SpinBox(Widget* parent) | SpinBox::SpinBox() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
|     m_editor = add<TextBox>(); |     m_editor = add<TextBox>(); | ||||||
|     m_editor->set_text("0"); |     m_editor->set_text("0"); | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ public: | ||||||
|     Function<void(int value)> on_change; |     Function<void(int value)> on_change; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit SpinBox(Widget* parent = nullptr); |     SpinBox(); | ||||||
| 
 | 
 | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -32,9 +32,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| Splitter::Splitter(Orientation orientation, Widget* parent) | Splitter::Splitter(Orientation orientation) | ||||||
|     : Frame(parent) |     : m_orientation(orientation) | ||||||
|     , m_orientation(orientation) |  | ||||||
| { | { | ||||||
|     set_background_role(ColorRole::Button); |     set_background_role(ColorRole::Button); | ||||||
|     set_layout(make<BoxLayout>(orientation)); |     set_layout(make<BoxLayout>(orientation)); | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
|     virtual ~Splitter() override; |     virtual ~Splitter() override; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     Splitter(Gfx::Orientation, Widget* parent = nullptr); |     explicit Splitter(Gfx::Orientation); | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
|  | @ -68,8 +68,8 @@ public: | ||||||
|     virtual ~VerticalSplitter() override {} |     virtual ~VerticalSplitter() override {} | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit VerticalSplitter(Widget* parent = nullptr) |     VerticalSplitter() | ||||||
|         : Splitter(Gfx::Orientation::Vertical, parent) |         : Splitter(Gfx::Orientation::Vertical) | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|  | @ -80,8 +80,8 @@ public: | ||||||
|     virtual ~HorizontalSplitter() override {} |     virtual ~HorizontalSplitter() override {} | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     explicit HorizontalSplitter(Widget* parent = nullptr) |     HorizontalSplitter() | ||||||
|         : Splitter(Gfx::Orientation::Horizontal, parent) |         : Splitter(Gfx::Orientation::Horizontal) | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -29,8 +29,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| StackWidget::StackWidget(Widget* parent) | StackWidget::StackWidget() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ public: | ||||||
|     Function<void(Widget*)> on_active_widget_change; |     Function<void(Widget*)> on_active_widget_change; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit StackWidget(Widget* parent = nullptr); |     StackWidget(); | ||||||
|     virtual void child_event(Core::ChildEvent&) override; |     virtual void child_event(Core::ChildEvent&) override; | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,13 +34,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| StatusBar::StatusBar(Widget* parent) | StatusBar::StatusBar(int label_count) | ||||||
|     : StatusBar(1, parent) |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| StatusBar::StatusBar(int label_count, Widget* parent) |  | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
|     set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); |     set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); | ||||||
|     set_preferred_size(0, 20); |     set_preferred_size(0, 20); | ||||||
|  | @ -54,7 +48,7 @@ StatusBar::StatusBar(int label_count, Widget* parent) | ||||||
|     for (auto i = 0; i < label_count; i++) |     for (auto i = 0; i < label_count; i++) | ||||||
|         m_labels.append(create_label()); |         m_labels.append(create_label()); | ||||||
| 
 | 
 | ||||||
|     m_corner = ResizeCorner::construct(this); |     m_corner = add<ResizeCorner>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| StatusBar::~StatusBar() | StatusBar::~StatusBar() | ||||||
|  | @ -63,7 +57,7 @@ StatusBar::~StatusBar() | ||||||
| 
 | 
 | ||||||
| NonnullRefPtr<Label> StatusBar::create_label() | NonnullRefPtr<Label> StatusBar::create_label() | ||||||
| { | { | ||||||
|     auto label = Label::construct(this); |     auto label = add<Label>(); | ||||||
|     label->set_frame_shadow(Gfx::FrameShadow::Sunken); |     label->set_frame_shadow(Gfx::FrameShadow::Sunken); | ||||||
|     label->set_frame_shape(Gfx::FrameShape::Panel); |     label->set_frame_shape(Gfx::FrameShape::Panel); | ||||||
|     label->set_frame_thickness(1); |     label->set_frame_thickness(1); | ||||||
|  |  | ||||||
|  | @ -41,8 +41,7 @@ public: | ||||||
|     void set_text(int index, const StringView&); |     void set_text(int index, const StringView&); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit StatusBar(Widget* parent = nullptr); |     explicit StatusBar(int label_count = 1); | ||||||
|     explicit StatusBar(int label_count, Widget* parent = nullptr); |  | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  |  | ||||||
|  | @ -33,8 +33,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| TabWidget::TabWidget(Widget* parent) | TabWidget::TabWidget() | ||||||
|     : Widget(parent) |  | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,7 +38,6 @@ public: | ||||||
|         Bottom, |         Bottom, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     explicit TabWidget(Widget* parent = nullptr); |  | ||||||
|     virtual ~TabWidget() override; |     virtual ~TabWidget() override; | ||||||
| 
 | 
 | ||||||
|     TabPosition tab_position() const { return m_tab_position; } |     TabPosition tab_position() const { return m_tab_position; } | ||||||
|  | @ -56,6 +55,8 @@ public: | ||||||
|     void add_widget(const StringView&, Widget*); |     void add_widget(const StringView&, Widget*); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|  |     TabWidget(); | ||||||
|  | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
|     virtual void child_event(Core::ChildEvent&) override; |     virtual void child_event(Core::ChildEvent&) override; | ||||||
|     virtual void resize_event(ResizeEvent&) override; |     virtual void resize_event(ResizeEvent&) override; | ||||||
|  |  | ||||||
|  | @ -38,8 +38,7 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| TableView::TableView(Widget* parent) | TableView::TableView() | ||||||
|     : AbstractTableView(parent) |  | ||||||
| { | { | ||||||
|     set_background_role(ColorRole::Base); |     set_background_role(ColorRole::Base); | ||||||
|     set_foreground_role(ColorRole::BaseText); |     set_foreground_role(ColorRole::BaseText); | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ public: | ||||||
|     virtual ~TableView() override; |     virtual ~TableView() override; | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit TableView(Widget* parent = nullptr); |     TableView(); | ||||||
| 
 | 
 | ||||||
|     virtual void paint_event(PaintEvent&) override; |     virtual void paint_event(PaintEvent&) override; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -28,8 +28,8 @@ | ||||||
| 
 | 
 | ||||||
| namespace GUI { | namespace GUI { | ||||||
| 
 | 
 | ||||||
| TextBox::TextBox(Widget* parent) | TextBox::TextBox() | ||||||
|     : TextEditor(TextEditor::SingleLine, parent) |     : TextEditor(TextEditor::SingleLine) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling