mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 21:15:07 +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
|
@ -24,12 +24,12 @@ int main(int argc, char** argv)
|
||||||
widget->layout()->set_margins({ 0, 8, 0, 8 });
|
widget->layout()->set_margins({ 0, 8, 0, 8 });
|
||||||
widget->layout()->set_spacing(8);
|
widget->layout()->set_spacing(8);
|
||||||
|
|
||||||
auto* icon_label = new GLabel(widget);
|
auto icon_label = GLabel::construct(widget);
|
||||||
icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/serenity.png"));
|
icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/serenity.png"));
|
||||||
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
icon_label->set_preferred_size(icon_label->icon()->size());
|
icon_label->set_preferred_size(icon_label->icon()->size());
|
||||||
|
|
||||||
auto* label = new GLabel(widget);
|
auto label = GLabel::construct(widget);
|
||||||
label->set_font(Font::default_bold_font());
|
label->set_font(Font::default_bold_font());
|
||||||
label->set_text("Serenity Operating System");
|
label->set_text("Serenity Operating System");
|
||||||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
|
@ -39,7 +39,7 @@ int main(int argc, char** argv)
|
||||||
int rc = uname(&uts);
|
int rc = uname(&uts);
|
||||||
ASSERT(rc == 0);
|
ASSERT(rc == 0);
|
||||||
|
|
||||||
auto* version_label = new GLabel(widget);
|
auto version_label = GLabel::construct(widget);
|
||||||
version_label->set_text(String::format("Version %s", uts.release));
|
version_label->set_text(String::format("Version %s", uts.release));
|
||||||
version_label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
version_label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
version_label->set_preferred_size(0, 11);
|
version_label->set_preferred_size(0, 11);
|
||||||
|
|
|
@ -13,7 +13,7 @@ CalculatorWidget::CalculatorWidget(GWidget* parent)
|
||||||
m_entry->set_relative_rect(5, 5, 244, 26);
|
m_entry->set_relative_rect(5, 5, 244, 26);
|
||||||
m_entry->set_text_alignment(TextAlignment::CenterRight);
|
m_entry->set_text_alignment(TextAlignment::CenterRight);
|
||||||
|
|
||||||
m_label = new GLabel(this);
|
m_label = GLabel::construct(this);
|
||||||
m_label->set_relative_rect(12, 42, 27, 27);
|
m_label->set_relative_rect(12, 42, 27, 27);
|
||||||
m_label->set_foreground_color(Color::NamedColor::Red);
|
m_label->set_foreground_color(Color::NamedColor::Red);
|
||||||
m_label->set_frame_shadow(FrameShadow::Sunken);
|
m_label->set_frame_shadow(FrameShadow::Sunken);
|
||||||
|
|
|
@ -26,5 +26,5 @@ private:
|
||||||
Keypad m_keypad;
|
Keypad m_keypad;
|
||||||
|
|
||||||
GTextBox* m_entry { nullptr };
|
GTextBox* m_entry { nullptr };
|
||||||
GLabel* m_label { nullptr };
|
ObjectPtr<GLabel> m_label;
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,19 +101,19 @@ void DisplayPropertiesWidget::create_frame()
|
||||||
background_content->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
background_content->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
background_content->layout()->set_margins({ 4, 4, 4, 4 });
|
background_content->layout()->set_margins({ 4, 4, 4, 4 });
|
||||||
|
|
||||||
auto* wallpaper_preview = new GLabel(background_splitter);
|
m_wallpaper_preview = GLabel::construct(background_splitter);
|
||||||
|
|
||||||
auto* wallpaper_list = new GListView(background_content);
|
auto* wallpaper_list = new GListView(background_content);
|
||||||
wallpaper_list->set_background_color(Color::White);
|
wallpaper_list->set_background_color(Color::White);
|
||||||
wallpaper_list->set_model(*ItemListModel<AK::String>::create(m_wallpapers));
|
wallpaper_list->set_model(*ItemListModel<AK::String>::create(m_wallpapers));
|
||||||
wallpaper_list->horizontal_scrollbar().set_visible(false);
|
wallpaper_list->horizontal_scrollbar().set_visible(false);
|
||||||
wallpaper_list->on_selection = [this, wallpaper_preview](auto& index) {
|
wallpaper_list->on_selection = [this](auto& index) {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
m_selected_wallpaper = m_wallpapers.at(index.row());
|
m_selected_wallpaper = m_wallpapers.at(index.row());
|
||||||
builder.append("/res/wallpapers/");
|
builder.append("/res/wallpapers/");
|
||||||
builder.append(m_selected_wallpaper);
|
builder.append(m_selected_wallpaper);
|
||||||
wallpaper_preview->set_icon(load_png(builder.to_string()));
|
m_wallpaper_preview->set_icon(load_png(builder.to_string()));
|
||||||
wallpaper_preview->set_should_stretch_icon(true);
|
m_wallpaper_preview->set_should_stretch_icon(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Let's add the settings tab
|
// Let's add the settings tab
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <LibDraw/Color.h>
|
#include <LibDraw/Color.h>
|
||||||
#include <LibDraw/Size.h>
|
#include <LibDraw/Size.h>
|
||||||
#include <LibGUI/GWidget.h>
|
#include <LibGUI/GWidget.h>
|
||||||
|
#include <LibGUI/GLabel.h>
|
||||||
|
|
||||||
class DisplayPropertiesWidget final {
|
class DisplayPropertiesWidget final {
|
||||||
public:
|
public:
|
||||||
|
@ -41,6 +42,7 @@ private:
|
||||||
GWidget* m_root_widget { nullptr };
|
GWidget* m_root_widget { nullptr };
|
||||||
Vector<Size> m_resolutions;
|
Vector<Size> m_resolutions;
|
||||||
Vector<String> m_wallpapers;
|
Vector<String> m_wallpapers;
|
||||||
|
ObjectPtr<GLabel> m_wallpaper_preview;
|
||||||
|
|
||||||
Size m_selected_resolution;
|
Size m_selected_resolution;
|
||||||
String m_selected_wallpaper;
|
String m_selected_wallpaper;
|
||||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
||||||
location_toolbar->layout()->set_margins({ 6, 3, 6, 3 });
|
location_toolbar->layout()->set_margins({ 6, 3, 6, 3 });
|
||||||
location_toolbar->set_preferred_size(0, 25);
|
location_toolbar->set_preferred_size(0, 25);
|
||||||
|
|
||||||
auto* location_label = new GLabel("Location: ", location_toolbar);
|
auto location_label = GLabel::construct("Location: ", location_toolbar);
|
||||||
location_label->size_to_fit();
|
location_label->size_to_fit();
|
||||||
|
|
||||||
auto* location_textbox = new GTextEditor(GTextEditor::SingleLine, location_toolbar);
|
auto* location_textbox = new GTextEditor(GTextEditor::SingleLine, location_toolbar);
|
||||||
|
|
|
@ -22,15 +22,15 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GWidget* parent)
|
||||||
layout()->set_margins({ 0, 8, 0, 0 });
|
layout()->set_margins({ 0, 8, 0, 0 });
|
||||||
layout()->set_spacing(3);
|
layout()->set_spacing(3);
|
||||||
|
|
||||||
auto build_widgets_for_label = [this](const String& description) -> GLabel* {
|
auto build_widgets_for_label = [this](const String& description) -> ObjectPtr<GLabel> {
|
||||||
auto* container = new GWidget(this);
|
auto* container = new GWidget(this);
|
||||||
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||||
container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
container->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
container->set_preferred_size(275, 12);
|
container->set_preferred_size(275, 12);
|
||||||
auto* description_label = new GLabel(description, container);
|
auto description_label = GLabel::construct(description, container);
|
||||||
description_label->set_font(Font::default_bold_font());
|
description_label->set_font(Font::default_bold_font());
|
||||||
description_label->set_text_alignment(TextAlignment::CenterLeft);
|
description_label->set_text_alignment(TextAlignment::CenterLeft);
|
||||||
auto* label = new GLabel(container);
|
auto label = GLabel::construct(container);
|
||||||
label->set_text_alignment(TextAlignment::CenterRight);
|
label->set_text_alignment(TextAlignment::CenterRight);
|
||||||
return label;
|
return label;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,9 +17,9 @@ private:
|
||||||
virtual void timer_event(CTimerEvent&) override;
|
virtual void timer_event(CTimerEvent&) override;
|
||||||
|
|
||||||
GraphWidget& m_graph;
|
GraphWidget& m_graph;
|
||||||
GLabel* m_user_physical_pages_label { nullptr };
|
ObjectPtr<GLabel> m_user_physical_pages_label;
|
||||||
GLabel* m_supervisor_physical_pages_label { nullptr };
|
ObjectPtr<GLabel> m_supervisor_physical_pages_label;
|
||||||
GLabel* m_kmalloc_label { nullptr };
|
ObjectPtr<GLabel> m_kmalloc_label;
|
||||||
GLabel* m_kmalloc_count_label { nullptr };
|
ObjectPtr<GLabel> m_kmalloc_count_label;
|
||||||
CFile m_proc_memstat;
|
CFile m_proc_memstat;
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,7 +69,7 @@ int main(int argc, char** argv)
|
||||||
window->set_resizable(true);
|
window->set_resizable(true);
|
||||||
window->set_rect(window_rect);
|
window->set_rect(window_rect);
|
||||||
|
|
||||||
auto* background = new GLabel;
|
auto background = GLabel::construct();
|
||||||
window->set_main_widget(background);
|
window->set_main_widget(background);
|
||||||
background->set_fill_with_background_color(true);
|
background->set_fill_with_background_color(true);
|
||||||
background->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
background->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
|
@ -83,7 +83,7 @@ int main(int argc, char** argv)
|
||||||
// header
|
// header
|
||||||
//
|
//
|
||||||
|
|
||||||
auto* header = new GLabel(background);
|
auto header = GLabel::construct(background);
|
||||||
header->set_font(Font::default_bold_font());
|
header->set_font(Font::default_bold_font());
|
||||||
header->set_text("Welcome to Serenity");
|
header->set_text("Welcome to Serenity");
|
||||||
header->set_text_alignment(TextAlignment::CenterLeft);
|
header->set_text_alignment(TextAlignment::CenterLeft);
|
||||||
|
@ -117,7 +117,7 @@ int main(int argc, char** argv)
|
||||||
content->layout()->set_spacing(8);
|
content->layout()->set_spacing(8);
|
||||||
content->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
content->set_size_policy(SizePolicy::Fill, SizePolicy::Fill);
|
||||||
|
|
||||||
auto* content_title = new GLabel(content);
|
auto content_title = GLabel::construct(content);
|
||||||
content_title->set_font(Font::default_bold_font());
|
content_title->set_font(Font::default_bold_font());
|
||||||
content_title->set_text(page.title);
|
content_title->set_text(page.title);
|
||||||
content_title->set_text_alignment(TextAlignment::CenterLeft);
|
content_title->set_text_alignment(TextAlignment::CenterLeft);
|
||||||
|
|
|
@ -223,7 +223,7 @@ int main(int argc, char** argv)
|
||||||
auto* fire = new Fire;
|
auto* fire = new Fire;
|
||||||
window->set_main_widget(fire);
|
window->set_main_widget(fire);
|
||||||
|
|
||||||
auto* time = new GLabel(fire);
|
auto time = GLabel::construct(fire);
|
||||||
time->set_relative_rect({ 0, 4, 40, 10 });
|
time->set_relative_rect({ 0, 4, 40, 10 });
|
||||||
time->move_by({ window->width() - time->width(), 0 });
|
time->move_by({ window->width() - time->width(), 0 });
|
||||||
time->set_foreground_color(Color::from_rgb(0x444444));
|
time->set_foreground_color(Color::from_rgb(0x444444));
|
||||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char** argv)
|
||||||
main_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
main_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
main_widget->layout()->set_margins({ 4, 4, 4, 4 });
|
main_widget->layout()->set_margins({ 4, 4, 4, 4 });
|
||||||
|
|
||||||
auto* label = new GLabel(main_widget);
|
auto label = GLabel::construct(main_widget);
|
||||||
label->set_text("Hello\nWorld!");
|
label->set_text("Hello\nWorld!");
|
||||||
|
|
||||||
auto* button = new GButton(main_widget);
|
auto* button = new GButton(main_widget);
|
||||||
|
|
|
@ -50,9 +50,9 @@ int main(int argc, char** argv)
|
||||||
progress1->set_value(progress1->min());
|
progress1->set_value(progress1->min());
|
||||||
});
|
});
|
||||||
|
|
||||||
auto* label1 = new GLabel("GLabel 1", main_widget);
|
auto label1 = GLabel::construct("GLabel 1", main_widget);
|
||||||
(void)label1;
|
(void)label1;
|
||||||
auto* label2 = new GLabel("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 = new GTextBox(main_widget);
|
||||||
|
|
|
@ -78,7 +78,7 @@ static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
|
||||||
case VBWidgetType::GGroupBox:
|
case VBWidgetType::GGroupBox:
|
||||||
return new GGroupBox("groupbox_1", parent);
|
return new GGroupBox("groupbox_1", parent);
|
||||||
case VBWidgetType::GLabel: {
|
case VBWidgetType::GLabel: {
|
||||||
auto* label = new GLabel(parent);
|
auto label = GLabel::construct(parent);
|
||||||
label->set_fill_with_background_color(true);
|
label->set_fill_with_background_color(true);
|
||||||
label->set_text("label_1");
|
label->set_text("label_1");
|
||||||
return label;
|
return label;
|
||||||
|
|
|
@ -29,16 +29,16 @@ int main(int argc, char** argv)
|
||||||
container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
container->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
container->set_preferred_size(0, 36);
|
container->set_preferred_size(0, 36);
|
||||||
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||||
auto* flag_icon_label = new GLabel(container);
|
auto flag_icon_label = GLabel::construct(container);
|
||||||
flag_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/flag.png"));
|
flag_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/flag.png"));
|
||||||
auto* flag_label = new GLabel(container);
|
auto flag_label = GLabel::construct(container);
|
||||||
auto* face_button = new GButton(container);
|
auto* face_button = new GButton(container);
|
||||||
face_button->set_button_style(ButtonStyle::CoolBar);
|
face_button->set_button_style(ButtonStyle::CoolBar);
|
||||||
face_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
face_button->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||||
face_button->set_preferred_size(36, 0);
|
face_button->set_preferred_size(36, 0);
|
||||||
auto* time_icon_label = new GLabel(container);
|
auto time_icon_label = GLabel::construct(container);
|
||||||
time_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/timer.png"));
|
time_icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/minesweeper/timer.png"));
|
||||||
auto* time_label = new GLabel(container);
|
auto time_label = GLabel::construct(container);
|
||||||
auto* field = new Field(*flag_label, *time_label, *face_button, widget, [&](Size size) {
|
auto* field = new Field(*flag_label, *time_label, *face_button, widget, [&](Size size) {
|
||||||
size.set_height(size.height() + container->preferred_size().height());
|
size.set_height(size.height() + container->preferred_size().height());
|
||||||
window->resize(size);
|
window->resize(size);
|
||||||
|
|
|
@ -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_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||||
left_container->set_preferred_size(48, 0);
|
left_container->set_preferred_size(48, 0);
|
||||||
left_container->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
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_icon(m_icon);
|
||||||
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
icon_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
icon_label->set_preferred_size(40, 40);
|
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 });
|
right_container->layout()->set_margins({ 0, 4, 4, 4 });
|
||||||
|
|
||||||
auto make_label = [&](const StringView& text, bool bold = false) {
|
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_text_alignment(TextAlignment::CenterLeft);
|
||||||
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
label->set_preferred_size(0, 14);
|
label->set_preferred_size(0, 14);
|
||||||
|
|
|
@ -75,7 +75,7 @@ public:
|
||||||
TooltipWindow()
|
TooltipWindow()
|
||||||
{
|
{
|
||||||
set_window_type(GWindowType::Tooltip);
|
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_background_color(Color::from_rgb(0xdac7b5));
|
||||||
m_label->set_fill_with_background_color(true);
|
m_label->set_fill_with_background_color(true);
|
||||||
m_label->set_frame_thickness(1);
|
m_label->set_frame_thickness(1);
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
m_label->set_text(tooltip);
|
m_label->set_text(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLabel* m_label { nullptr };
|
ObjectPtr<GLabel> m_label;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GApplication::show_tooltip(const StringView& tooltip, const Point& screen_location)
|
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_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
filename_container->set_preferred_size(0, 20);
|
filename_container->set_preferred_size(0, 20);
|
||||||
filename_container->set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
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_text_alignment(TextAlignment::CenterLeft);
|
||||||
filename_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
filename_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill);
|
||||||
filename_label->set_preferred_size(60, 0);
|
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->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||||
preview_container->layout()->set_margins({ 8, 8, 8, 8 });
|
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_should_stretch_icon(true);
|
||||||
m_preview_image_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
m_preview_image_label->set_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
m_preview_image_label->set_preferred_size(160, 160);
|
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_font(Font::default_bold_font());
|
||||||
m_preview_name_label->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
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_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_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
m_preview_geometry_label->set_preferred_size(0, m_preview_name_label->font().glyph_height());
|
m_preview_geometry_label->set_preferred_size(0, m_preview_name_label->font().glyph_height());
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,8 @@ private:
|
||||||
FileSystemPath m_selected_file;
|
FileSystemPath m_selected_file;
|
||||||
|
|
||||||
GTextBox* m_filename_textbox { nullptr };
|
GTextBox* m_filename_textbox { nullptr };
|
||||||
GLabel* m_preview_image_label { nullptr };
|
ObjectPtr<GLabel> m_preview_image_label;
|
||||||
GLabel* m_preview_name_label { nullptr };
|
ObjectPtr<GLabel> m_preview_name_label;
|
||||||
GLabel* m_preview_geometry_label { nullptr };
|
ObjectPtr<GLabel> m_preview_geometry_label;
|
||||||
Mode m_mode { Mode::Open };
|
Mode m_mode { Mode::Open };
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@ void GInputBox::build()
|
||||||
widget->layout()->set_margins({ 8, 8, 8, 8 });
|
widget->layout()->set_margins({ 8, 8, 8, 8 });
|
||||||
widget->layout()->set_spacing(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_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
label->set_preferred_size(text_width, 16);
|
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_margins({ 8, 0, 8, 0 });
|
||||||
message_container->layout()->set_spacing(8);
|
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_size_policy(SizePolicy::Fixed, SizePolicy::Fixed);
|
||||||
icon_label->set_preferred_size(32, 32);
|
icon_label->set_preferred_size(32, 32);
|
||||||
icon_label->set_icon(icon());
|
icon_label->set_icon(icon());
|
||||||
icon_width = icon_label->icon()->width();
|
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_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||||
label->set_preferred_size(text_width, 16);
|
label->set_preferred_size(text_width, 16);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ GStatusBar::GStatusBar(GWidget* parent)
|
||||||
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||||
layout()->set_margins({ 2, 2, 2, 2 });
|
layout()->set_margins({ 2, 2, 2, 2 });
|
||||||
layout()->set_spacing(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_shadow(FrameShadow::Sunken);
|
||||||
m_label->set_frame_shape(FrameShape::Panel);
|
m_label->set_frame_shape(FrameShape::Panel);
|
||||||
m_label->set_frame_thickness(1);
|
m_label->set_frame_thickness(1);
|
||||||
|
|
|
@ -17,6 +17,6 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual void paint_event(GPaintEvent&) override;
|
virtual void paint_event(GPaintEvent&) override;
|
||||||
|
|
||||||
GLabel* m_label { nullptr };
|
ObjectPtr<GLabel> m_label;
|
||||||
GResizeCorner* m_corner { nullptr };
|
GResizeCorner* m_corner { nullptr };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue