mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:07:35 +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/StylePropertiesModel.h>
|
||||
|
||||
InspectorWidget::InspectorWidget(GUI::Widget* parent)
|
||||
: GUI::Widget(parent)
|
||||
InspectorWidget::InspectorWidget()
|
||||
{
|
||||
set_layout(make<GUI::VerticalBoxLayout>());
|
||||
auto splitter = add<GUI::VerticalSplitter>();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
|
||||
IRCClient& m_client;
|
||||
String m_name;
|
||||
IRCWindow* m_window { nullptr };
|
||||
RefPtr<IRCWindow> m_window;
|
||||
|
||||
NonnullRefPtr<IRCLogBuffer> m_log;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -45,5 +45,5 @@ public:
|
|||
Function<void(pid_t)> on_process_selected;
|
||||
|
||||
private:
|
||||
explicit ProcessTableView(GUI::Widget* parent = nullptr);
|
||||
ProcessTableView();
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
BackgroundWidget::BackgroundWidget(GUI::Widget* parent)
|
||||
: GUI::Frame(parent)
|
||||
BackgroundWidget::BackgroundWidget()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue