1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:47:47 +00:00

LibGUI: Convert GSplitter to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 16:11:02 +02:00
parent efb8f9d538
commit 4f4438c04c
7 changed files with 10 additions and 8 deletions

View file

@ -94,7 +94,7 @@ void DisplayPropertiesWidget::create_frame()
auto* tab_widget = new GTabWidget(m_root_widget); auto* tab_widget = new GTabWidget(m_root_widget);
// First, let's create the "Background" tab // First, let's create the "Background" tab
auto* background_splitter = new GSplitter(Orientation::Vertical, nullptr); auto background_splitter = GSplitter::construct(Orientation::Vertical, nullptr);
tab_widget->add_widget("Wallpaper", background_splitter); tab_widget->add_widget("Wallpaper", background_splitter);
auto* background_content = new GWidget(background_splitter); auto* background_content = new GWidget(background_splitter);
@ -117,7 +117,7 @@ void DisplayPropertiesWidget::create_frame()
}; };
// Let's add the settings tab // Let's add the settings tab
auto* settings_splitter = new GSplitter(Orientation::Vertical, nullptr); auto settings_splitter = GSplitter::construct(Orientation::Vertical, nullptr);
tab_widget->add_widget("Settings", settings_splitter); tab_widget->add_widget("Settings", settings_splitter);
auto* settings_content = new GWidget(settings_splitter); auto* settings_content = new GWidget(settings_splitter);

View file

@ -58,7 +58,7 @@ int main(int argc, char** argv)
auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar); auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar);
auto* splitter = new GSplitter(Orientation::Horizontal, widget); auto splitter = GSplitter::construct(Orientation::Horizontal, widget);
auto tree_view = GTreeView::construct(splitter); auto tree_view = GTreeView::construct(splitter);
auto file_system_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly); auto file_system_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly);
tree_view->set_model(file_system_model); tree_view->set_model(file_system_model);

View file

@ -175,7 +175,7 @@ void IRCAppWindow::setup_widgets()
outer_container->set_layout(make<GBoxLayout>(Orientation::Vertical)); outer_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
outer_container->layout()->set_margins({ 2, 0, 2, 2 }); outer_container->layout()->set_margins({ 2, 0, 2, 2 });
auto* horizontal_container = new GSplitter(Orientation::Horizontal, outer_container); auto horizontal_container = GSplitter::construct(Orientation::Horizontal, outer_container);
m_window_list = GTableView::construct(horizontal_container); m_window_list = GTableView::construct(horizontal_container);
m_window_list->set_headers_visible(false); m_window_list->set_headers_visible(false);

View file

@ -19,7 +19,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
set_layout(make<GBoxLayout>(Orientation::Vertical)); set_layout(make<GBoxLayout>(Orientation::Vertical));
// Make a container for the log buffer view + (optional) member list. // Make a container for the log buffer view + (optional) member list.
auto* container = new GSplitter(Orientation::Horizontal, this); auto container = GSplitter::construct(Orientation::Horizontal, this);
m_table_view = GTableView::construct(container); m_table_view = GTableView::construct(container);
m_table_view->set_size_columns_to_fit_content(true); m_table_view->set_size_columns_to_fit_content(true);

View file

@ -55,7 +55,7 @@ int main(int argc, char** argv)
auto* tabwidget = new GTabWidget(keeper); auto* tabwidget = new GTabWidget(keeper);
auto* process_container_splitter = new GSplitter(Orientation::Vertical, nullptr); auto process_container_splitter = GSplitter::construct(Orientation::Vertical, nullptr);
tabwidget->add_widget("Processes", process_container_splitter); tabwidget->add_widget("Processes", process_container_splitter);
auto* process_table_container = new GWidget(process_container_splitter); auto* process_table_container = new GWidget(process_container_splitter);

View file

@ -37,7 +37,7 @@ int main(int argc, char** argv)
widget->set_fill_with_background_color(true); widget->set_fill_with_background_color(true);
widget->set_layout(make<GBoxLayout>(Orientation::Vertical)); widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
auto* splitter = new GSplitter(Orientation::Horizontal, widget); auto splitter = GSplitter::construct(Orientation::Horizontal, widget);
RemoteProcess remote_process(pid); RemoteProcess remote_process(pid);

View file

@ -3,11 +3,13 @@
#include <LibGUI/GFrame.h> #include <LibGUI/GFrame.h>
class GSplitter : public GFrame { class GSplitter : public GFrame {
C_OBJECT(GSplitter)
public: public:
GSplitter(Orientation, GWidget* parent);
virtual ~GSplitter() override; virtual ~GSplitter() override;
protected: protected:
GSplitter(Orientation, GWidget* parent);
virtual void mousedown_event(GMouseEvent&) override; virtual void mousedown_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override; virtual void mousemove_event(GMouseEvent&) override;
virtual void mouseup_event(GMouseEvent&) override; virtual void mouseup_event(GMouseEvent&) override;