mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibGUI: Convert GLabel to ObjectPtr
This commit is contained in:
parent
6b347747f2
commit
c7437f9caa
22 changed files with 47 additions and 45 deletions
|
@ -22,7 +22,7 @@ GAboutDialog::GAboutDialog(const StringView& name, const GraphicsBitmap* icon, C
|
|||
left_container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
left_container->set_preferred_size(48, 0);
|
||||
left_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
auto* icon_label = new GLabel(left_container);
|
||||
auto icon_label = GLabel::construct(left_container);
|
||||
icon_label->set_icon(m_icon);
|
||||
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
icon_label->set_preferred_size(40, 40);
|
||||
|
@ -33,7 +33,7 @@ GAboutDialog::GAboutDialog(const StringView& name, const GraphicsBitmap* icon, C
|
|||
right_container->layout()->set_margins({ 0, 4, 4, 4 });
|
||||
|
||||
auto make_label = [&](const StringView& text, bool bold = false) {
|
||||
auto* label = new GLabel(text, right_container);
|
||||
auto label = GLabel::construct(text, right_container);
|
||||
label->set_text_alignment(TextAlignment::CenterLeft);
|
||||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
label->set_preferred_size(0, 14);
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
TooltipWindow()
|
||||
{
|
||||
set_window_type(GWindowType::Tooltip);
|
||||
m_label = new GLabel;
|
||||
m_label = GLabel::construct();
|
||||
m_label->set_background_color(Color::from_rgb(0xdac7b5));
|
||||
m_label->set_fill_with_background_color(true);
|
||||
m_label->set_frame_thickness(1);
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
m_label->set_text(tooltip);
|
||||
}
|
||||
|
||||
GLabel* m_label { nullptr };
|
||||
ObjectPtr<GLabel> m_label;
|
||||
};
|
||||
|
||||
void GApplication::show_tooltip(const StringView& tooltip, const Point& screen_location)
|
||||
|
|
|
@ -128,7 +128,7 @@ GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringVie
|
|||
filename_container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
filename_container->set_preferred_size(0, 20);
|
||||
filename_container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
auto* filename_label = new GLabel("File name:", filename_container);
|
||||
auto filename_label = GLabel::construct("File name:", filename_container);
|
||||
filename_label->set_text_alignment(TextAlignment::CenterLeft);
|
||||
filename_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||
filename_label->set_preferred_size(60, 0);
|
||||
|
@ -201,17 +201,17 @@ GFilePicker::GFilePicker(Mode mode, const StringView& file_name, const StringVie
|
|||
preview_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
preview_container->layout()->set_margins({ 8, 8, 8, 8 });
|
||||
|
||||
m_preview_image_label = new GLabel(preview_container);
|
||||
m_preview_image_label = GLabel::construct(preview_container);
|
||||
m_preview_image_label->set_should_stretch_icon(true);
|
||||
m_preview_image_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
m_preview_image_label->set_preferred_size(160, 160);
|
||||
|
||||
m_preview_name_label = new GLabel(preview_container);
|
||||
m_preview_name_label = GLabel::construct(preview_container);
|
||||
m_preview_name_label->set_font(Font::default_bold_font());
|
||||
m_preview_name_label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_preview_name_label->set_preferred_size(0, m_preview_name_label->font().glyph_height());
|
||||
|
||||
m_preview_geometry_label = new GLabel(preview_container);
|
||||
m_preview_geometry_label = GLabel::construct(preview_container);
|
||||
m_preview_geometry_label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_preview_geometry_label->set_preferred_size(0, m_preview_name_label->font().glyph_height());
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ private:
|
|||
FileSystemPath m_selected_file;
|
||||
|
||||
GTextBox* m_filename_textbox { nullptr };
|
||||
GLabel* m_preview_image_label { nullptr };
|
||||
GLabel* m_preview_name_label { nullptr };
|
||||
GLabel* m_preview_geometry_label { nullptr };
|
||||
ObjectPtr<GLabel> m_preview_image_label;
|
||||
ObjectPtr<GLabel> m_preview_name_label;
|
||||
ObjectPtr<GLabel> m_preview_geometry_label;
|
||||
Mode m_mode { Mode::Open };
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ void GInputBox::build()
|
|||
widget->layout()->set_margins({ 8, 8, 8, 8 });
|
||||
widget->layout()->set_spacing(8);
|
||||
|
||||
auto* label = new GLabel(m_prompt, widget);
|
||||
auto label = GLabel::construct(m_prompt, widget);
|
||||
label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
label->set_preferred_size(text_width, 16);
|
||||
|
||||
|
|
|
@ -69,14 +69,14 @@ void GMessageBox::build()
|
|||
message_container->layout()->set_margins({ 8, 0, 8, 0 });
|
||||
message_container->layout()->set_spacing(8);
|
||||
|
||||
auto* icon_label = new GLabel(message_container);
|
||||
auto icon_label = GLabel::construct(message_container);
|
||||
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||
icon_label->set_preferred_size(32, 32);
|
||||
icon_label->set_icon(icon());
|
||||
icon_width = icon_label->icon()->width();
|
||||
}
|
||||
|
||||
auto* label = new GLabel(m_text, message_container);
|
||||
auto label = GLabel::construct(m_text, message_container);
|
||||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
label->set_preferred_size(text_width, 16);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ GStatusBar::GStatusBar(GWidget* parent)
|
|||
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
layout()->set_margins({ 2, 2, 2, 2 });
|
||||
layout()->set_spacing(2);
|
||||
m_label = new GLabel(this);
|
||||
m_label = GLabel::construct(this);
|
||||
m_label->set_frame_shadow(FrameShadow::Sunken);
|
||||
m_label->set_frame_shape(FrameShape::Panel);
|
||||
m_label->set_frame_thickness(1);
|
||||
|
|
|
@ -17,6 +17,6 @@ public:
|
|||
private:
|
||||
virtual void paint_event(GPaintEvent&) override;
|
||||
|
||||
GLabel* m_label { nullptr };
|
||||
ObjectPtr<GLabel> m_label;
|
||||
GResizeCorner* m_corner { nullptr };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue