mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibGUI: Convert remaining random little things to ObjectPtr
This commit is contained in:
parent
81a5c4fc56
commit
409494193e
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_fill_with_background_color(true);
|
||||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
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_only_allow_values_from_model(true);
|
||||||
board_combo->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
board_combo->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
board_combo->set_preferred_size(0, 20);
|
board_combo->set_preferred_size(0, 20);
|
||||||
|
|
|
@ -23,10 +23,10 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon
|
||||||
else
|
else
|
||||||
m_path = path;
|
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_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_glyph_editor_widget->move_to({ 5, 5 });
|
||||||
|
|
||||||
m_ui = make<UI_FontEditorBottom>();
|
m_ui = make<UI_FontEditorBottom>();
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#include <LibGUI/GFrame.h>
|
#include <LibGUI/GFrame.h>
|
||||||
|
|
||||||
class GlyphEditorWidget final : public GFrame {
|
class GlyphEditorWidget final : public GFrame {
|
||||||
|
C_OBJECT(GlyphEditorWidget)
|
||||||
public:
|
public:
|
||||||
GlyphEditorWidget(Font&, GWidget* parent);
|
|
||||||
virtual ~GlyphEditorWidget() override;
|
virtual ~GlyphEditorWidget() override;
|
||||||
|
|
||||||
u8 glyph() const { return m_glyph; }
|
u8 glyph() const { return m_glyph; }
|
||||||
|
@ -18,6 +18,7 @@ public:
|
||||||
Function<void(u8)> on_glyph_altered;
|
Function<void(u8)> on_glyph_altered;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
GlyphEditorWidget(Font&, GWidget* parent);
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
virtual void mousemove_event(GMouseEvent&) override;
|
virtual void mousemove_event(GMouseEvent&) override;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <LibGUI/GFrame.h>
|
#include <LibGUI/GFrame.h>
|
||||||
|
|
||||||
class GlyphMapWidget final : public GFrame {
|
class GlyphMapWidget final : public GFrame {
|
||||||
|
C_OBJECT(GlyphMapWidget)
|
||||||
public:
|
public:
|
||||||
GlyphMapWidget(Font&, GWidget* parent);
|
|
||||||
virtual ~GlyphMapWidget() override;
|
virtual ~GlyphMapWidget() override;
|
||||||
|
|
||||||
u8 selected_glyph() const { return m_selected_glyph; }
|
u8 selected_glyph() const { return m_selected_glyph; }
|
||||||
|
@ -25,6 +25,7 @@ public:
|
||||||
Function<void(u8)> on_glyph_selected;
|
Function<void(u8)> on_glyph_selected;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
GlyphMapWidget(Font&, GWidget* parent);
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
virtual void mousedown_event(GMouseEvent&) override;
|
virtual void mousedown_event(GMouseEvent&) override;
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ void IRCAppWindow::setup_widgets()
|
||||||
set_active_window(m_client.window_at(index.row()));
|
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*) {
|
m_container->on_active_widget_change = [this](auto*) {
|
||||||
update_part_action();
|
update_part_action();
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@ private:
|
||||||
|
|
||||||
IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name);
|
IRCWindow& create_window(void* owner, IRCWindow::Type, const String& name);
|
||||||
IRCClient m_client;
|
IRCClient m_client;
|
||||||
GStackWidget* m_container { nullptr };
|
ObjectPtr<GStackWidget> m_container;
|
||||||
ObjectPtr<GTableView> m_window_list;
|
ObjectPtr<GTableView> m_window_list;
|
||||||
RefPtr<GAction> m_join_action;
|
RefPtr<GAction> m_join_action;
|
||||||
RefPtr<GAction> m_part_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_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||||
menu->set_preferred_size(200, 0);
|
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);
|
stack->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
||||||
|
|
||||||
for (auto& page : pages) {
|
for (auto& page : pages) {
|
||||||
|
|
|
@ -55,9 +55,9 @@ int main(int argc, char** argv)
|
||||||
auto label2 = GLabel::construct("GLabel 2", main_widget);
|
auto label2 = GLabel::construct("GLabel 2", main_widget);
|
||||||
label2->set_enabled(false);
|
label2->set_enabled(false);
|
||||||
|
|
||||||
auto textbox1 = new GTextBox(main_widget);
|
auto textbox1 = GTextBox::construct(main_widget);
|
||||||
textbox1->set_text("GTextBox 1");
|
textbox1->set_text("GTextBox 1");
|
||||||
auto textbox2 = new GTextBox(main_widget);
|
auto textbox2 = GTextBox::construct(main_widget);
|
||||||
textbox2->set_text("GTextBox 2");
|
textbox2->set_text("GTextBox 2");
|
||||||
textbox2->set_enabled(false);
|
textbox2->set_enabled(false);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
|
|
||||||
virtual ObjectPtr<GWidget> create_widget() override
|
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_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(); };
|
||||||
|
|
|
@ -9,7 +9,6 @@ class GTextEditor;
|
||||||
class GComboBox : public GWidget {
|
class GComboBox : public GWidget {
|
||||||
C_OBJECT(GComboBox)
|
C_OBJECT(GComboBox)
|
||||||
public:
|
public:
|
||||||
explicit GComboBox(GWidget* parent = nullptr);
|
|
||||||
virtual ~GComboBox() override;
|
virtual ~GComboBox() override;
|
||||||
|
|
||||||
String text() const;
|
String text() const;
|
||||||
|
@ -33,6 +32,7 @@ public:
|
||||||
Function<void()> on_return_pressed;
|
Function<void()> on_return_pressed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
explicit GComboBox(GWidget* parent = nullptr);
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
class GStackWidget : public GWidget {
|
class GStackWidget : public GWidget {
|
||||||
C_OBJECT(GStackWidget)
|
C_OBJECT(GStackWidget)
|
||||||
public:
|
public:
|
||||||
explicit GStackWidget(GWidget* parent);
|
|
||||||
virtual ~GStackWidget() override;
|
virtual ~GStackWidget() override;
|
||||||
|
|
||||||
GWidget* active_widget() { return m_active_widget.ptr(); }
|
GWidget* active_widget() { return m_active_widget.ptr(); }
|
||||||
|
@ -15,6 +14,7 @@ public:
|
||||||
Function<void(GWidget*)> on_active_widget_change;
|
Function<void(GWidget*)> on_active_widget_change;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
explicit GStackWidget(GWidget* parent);
|
||||||
virtual void child_event(CChildEvent&) override;
|
virtual void child_event(CChildEvent&) override;
|
||||||
virtual void resize_event(GResizeEvent&) override;
|
virtual void resize_event(GResizeEvent&) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue