mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:27:43 +00:00
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename the library to LibGfx. :^)
This commit is contained in:
parent
939a605334
commit
11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -75,10 +75,10 @@ void TextWidget::paint_event(GUI::PaintEvent& event)
|
|||
text_rect.set_width(text_rect.width() - indent * 2);
|
||||
|
||||
if (is_enabled()) {
|
||||
painter.draw_text(text_rect, line, m_text_alignment, palette().color(foreground_role()), TextElision::None);
|
||||
painter.draw_text(text_rect, line, m_text_alignment, palette().color(foreground_role()), Gfx::TextElision::None);
|
||||
} else {
|
||||
painter.draw_text(text_rect.translated(1, 1), line, font(), text_alignment(), Color::White, TextElision::Right);
|
||||
painter.draw_text(text_rect, line, font(), text_alignment(), Color::from_rgb(0x808080), TextElision::Right);
|
||||
painter.draw_text(text_rect.translated(1, 1), line, font(), text_alignment(), Color::White, Gfx::TextElision::Right);
|
||||
painter.draw_text(text_rect, line, font(), text_alignment(), Color::from_rgb(0x808080), Gfx::TextElision::Right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public:
|
|||
String text() const { return m_text; }
|
||||
void set_text(const StringView&);
|
||||
|
||||
TextAlignment text_alignment() const { return m_text_alignment; }
|
||||
void set_text_alignment(TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
||||
Gfx::TextAlignment text_alignment() const { return m_text_alignment; }
|
||||
void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; }
|
||||
|
||||
bool should_wrap() const { return m_should_wrap; }
|
||||
void set_should_wrap(bool should_wrap) { m_should_wrap = should_wrap; }
|
||||
|
@ -58,7 +58,7 @@ private:
|
|||
|
||||
String m_text;
|
||||
Vector<String> m_lines;
|
||||
TextAlignment m_text_alignment { TextAlignment::Center };
|
||||
Gfx::TextAlignment m_text_alignment { Gfx::TextAlignment::Center };
|
||||
bool m_should_wrap { false };
|
||||
int m_line_height { 0 };
|
||||
};
|
||||
|
|
|
@ -101,7 +101,7 @@ int main(int argc, char** argv)
|
|||
background->set_layout(make<GUI::VBoxLayout>());
|
||||
background->layout()->set_margins({ 8, 8, 8, 8 });
|
||||
background->layout()->set_spacing(8);
|
||||
background->set_icon(load_png_from_memory((const u8*)&_binary_background_png_start, (size_t)&_binary_background_png_size));
|
||||
background->set_icon(Gfx::load_png_from_memory((const u8*)&_binary_background_png_start, (size_t)&_binary_background_png_size));
|
||||
background->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
background->set_preferred_size(background->icon()->size());
|
||||
|
||||
|
@ -110,9 +110,9 @@ int main(int argc, char** argv)
|
|||
//
|
||||
|
||||
auto header = GUI::Label::construct(background.ptr());
|
||||
header->set_font(Font::default_bold_font());
|
||||
header->set_font(Gfx::Font::default_bold_font());
|
||||
header->set_text("Welcome to Serenity");
|
||||
header->set_text_alignment(TextAlignment::CenterLeft);
|
||||
header->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
header->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
header->set_preferred_size(0, 30);
|
||||
|
||||
|
@ -144,25 +144,25 @@ int main(int argc, char** argv)
|
|||
content->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
|
||||
auto content_title = GUI::Label::construct(content);
|
||||
content_title->set_font(Font::default_bold_font());
|
||||
content_title->set_font(Gfx::Font::default_bold_font());
|
||||
content_title->set_text(page.title);
|
||||
content_title->set_text_alignment(TextAlignment::CenterLeft);
|
||||
content_title->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
content_title->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
content_title->set_preferred_size(0, 10);
|
||||
|
||||
for (auto& paragraph : page.content) {
|
||||
auto content_text = TextWidget::construct(content);
|
||||
content_text->set_font(Font::default_font());
|
||||
content_text->set_font(Gfx::Font::default_font());
|
||||
content_text->set_text(paragraph);
|
||||
content_text->set_text_alignment(TextAlignment::TopLeft);
|
||||
content_text->set_text_alignment(Gfx::TextAlignment::TopLeft);
|
||||
content_text->set_line_height(12);
|
||||
content_text->wrap_and_set_height();
|
||||
}
|
||||
|
||||
auto menu_option = GUI::Button::construct(menu);
|
||||
menu_option->set_font(Font::default_font());
|
||||
menu_option->set_font(Gfx::Font::default_font());
|
||||
menu_option->set_text(page.menu_name);
|
||||
menu_option->set_text_alignment(TextAlignment::CenterLeft);
|
||||
menu_option->set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
menu_option->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
menu_option->set_preferred_size(0, 20);
|
||||
menu_option->on_click = [content = content.ptr(), &stack](auto&) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue