mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibGUI: Convert remaining random little things to ObjectPtr
This commit is contained in:
parent
81a5c4fc56
commit
409494193e
Notes:
sideshowbarker
2024-07-19 12:01:03 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/409494193ea
11 changed files with 15 additions and 13 deletions
|
@ -22,7 +22,7 @@ int main(int argc, char** argv)
|
|||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
|
||||
auto* board_combo = new GComboBox(widget);
|
||||
auto board_combo = GComboBox::construct(widget);
|
||||
board_combo->set_only_allow_values_from_model(true);
|
||||
board_combo->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
board_combo->set_preferred_size(0, 20);
|
||||
|
|
|
@ -23,10 +23,10 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon
|
|||
else
|
||||
m_path = path;
|
||||
|
||||
m_glyph_map_widget = new GlyphMapWidget(*m_edited_font, this);
|
||||
m_glyph_map_widget = GlyphMapWidget::construct(*m_edited_font, this);
|
||||
m_glyph_map_widget->move_to({ 90, 5 });
|
||||
|
||||
m_glyph_editor_widget = new GlyphEditorWidget(*m_edited_font, this);
|
||||
m_glyph_editor_widget = GlyphEditorWidget::construct(*m_edited_font, this);
|
||||
m_glyph_editor_widget->move_to({ 5, 5 });
|
||||
|
||||
m_ui = make<UI_FontEditorBottom>();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include <LibGUI/GFrame.h>
|
||||
|
||||
class GlyphEditorWidget final : public GFrame {
|
||||
C_OBJECT(GlyphEditorWidget)
|
||||
public:
|
||||
GlyphEditorWidget(Font&, GWidget* parent);
|
||||
virtual ~GlyphEditorWidget() override;
|
||||
|
||||
u8 glyph() const { return m_glyph; }
|
||||
|
@ -18,6 +18,7 @@ public:
|
|||
Function<void(u8)> on_glyph_altered;
|
||||
|
||||
private:
|
||||
GlyphEditorWidget(Font&, GWidget* parent);
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
virtual void mousemove_event(GMouseEvent&) override;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#include <LibGUI/GFrame.h>
|
||||
|
||||
class GlyphMapWidget final : public GFrame {
|
||||
C_OBJECT(GlyphMapWidget)
|
||||
public:
|
||||
GlyphMapWidget(Font&, GWidget* parent);
|
||||
virtual ~GlyphMapWidget() override;
|
||||
|
||||
u8 selected_glyph() const { return m_selected_glyph; }
|
||||
|
@ -25,6 +25,7 @@ public:
|
|||
Function<void(u8)> on_glyph_selected;
|
||||
|
||||
private:
|
||||
GlyphMapWidget(Font&, GWidget* parent);
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
virtual void mousedown_event(GMouseEvent&) override;
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ void IRCAppWindow::setup_widgets()
|
|||
set_active_window(m_client.window_at(index.row()));
|
||||
};
|
||||
|
||||
m_container = new GStackWidget(horizontal_container);
|
||||
m_container = GStackWidget::construct(horizontal_container);
|
||||
m_container->on_active_widget_change = [this](auto*) {
|
||||
update_part_action();
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@ private:
|
|||
|
||||
IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name);
|
||||
IRCClient m_client;
|
||||
GStackWidget* m_container { nullptr };
|
||||
ObjectPtr<GStackWidget> m_container;
|
||||
ObjectPtr<GTableView> m_window_list;
|
||||
RefPtr<GAction> m_join_action;
|
||||
RefPtr<GAction> m_part_action;
|
||||
|
|
|
@ -107,7 +107,7 @@ int main(int argc, char** argv)
|
|||
menu->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
menu->set_preferred_size(200, 0);
|
||||
|
||||
auto* stack = new GStackWidget(main_section);
|
||||
auto stack = GStackWidget::construct(main_section);
|
||||
stack->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
||||
|
||||
for (auto& page : pages) {
|
||||
|
|
|
@ -55,9 +55,9 @@ int main(int argc, char** argv)
|
|||
auto label2 = GLabel::construct("GLabel 2", main_widget);
|
||||
label2->set_enabled(false);
|
||||
|
||||
auto textbox1 = new GTextBox(main_widget);
|
||||
auto textbox1 = GTextBox::construct(main_widget);
|
||||
textbox1->set_text("GTextBox 1");
|
||||
auto textbox2 = new GTextBox(main_widget);
|
||||
auto textbox2 = GTextBox::construct(main_widget);
|
||||
textbox2->set_text("GTextBox 2");
|
||||
textbox2->set_enabled(false);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
virtual ObjectPtr<GWidget> create_widget() override
|
||||
{
|
||||
auto* combo = new GComboBox(nullptr);
|
||||
auto combo = GComboBox::construct(nullptr);
|
||||
combo->set_only_allow_values_from_model(true);
|
||||
combo->set_model(adopt(*new BoolValuesModel));
|
||||
combo->on_return_pressed = [this] { commit(); };
|
||||
|
|
|
@ -9,7 +9,6 @@ class GTextEditor;
|
|||
class GComboBox : public GWidget {
|
||||
C_OBJECT(GComboBox)
|
||||
public:
|
||||
explicit GComboBox(GWidget* parent = nullptr);
|
||||
virtual ~GComboBox() override;
|
||||
|
||||
String text() const;
|
||||
|
@ -33,6 +32,7 @@ public:
|
|||
Function<void()> on_return_pressed;
|
||||
|
||||
protected:
|
||||
explicit GComboBox(GWidget* parent = nullptr);
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
class GStackWidget : public GWidget {
|
||||
C_OBJECT(GStackWidget)
|
||||
public:
|
||||
explicit GStackWidget(GWidget* parent);
|
||||
virtual ~GStackWidget() override;
|
||||
|
||||
GWidget* active_widget() { return m_active_widget.ptr(); }
|
||||
|
@ -15,6 +14,7 @@ public:
|
|||
Function<void(GWidget*)> on_active_widget_change;
|
||||
|
||||
protected:
|
||||
explicit GStackWidget(GWidget* parent);
|
||||
virtual void child_event(CChildEvent&) override;
|
||||
virtual void resize_event(GResizeEvent&) override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue