diff options
Diffstat (limited to 'Applications')
74 files changed, 316 insertions, 315 deletions
diff --git a/Applications/About/main.cpp b/Applications/About/main.cpp index 0aa5cf42d9..2e8eeba91e 100644 --- a/Applications/About/main.cpp +++ b/Applications/About/main.cpp @@ -69,12 +69,12 @@ int main(int argc, char** argv) widget->layout()->set_spacing(8); auto icon_label = GUI::Label::construct(widget); - icon_label->set_icon(GraphicsBitmap::load_from_file("/res/icons/serenity.png")); + icon_label->set_icon(Gfx::Bitmap::load_from_file("/res/icons/serenity.png")); icon_label->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); icon_label->set_preferred_size(icon_label->icon()->size()); auto label = GUI::Label::construct(widget); - label->set_font(Font::default_bold_font()); + label->set_font(Gfx::Font::default_bold_font()); label->set_text("SerenityOS"); label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); label->set_preferred_size(0, 11); diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp index 52944115e4..5877772f0f 100644 --- a/Applications/Browser/main.cpp +++ b/Applications/Browser/main.cpp @@ -235,13 +235,13 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Browser", GraphicsBitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window); + GUI::AboutDialog::show("Browser", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-html.png"), window); })); menubar->add_menu(move(help_menu)); app.set_menubar(move(menubar)); - window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-html.png")); + window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-html.png")); window->set_title("Browser"); window->set_main_widget(widget); diff --git a/Applications/Calculator/CalculatorWidget.cpp b/Applications/Calculator/CalculatorWidget.cpp index 736cd4ecbf..c04713ba4a 100644 --- a/Applications/Calculator/CalculatorWidget.cpp +++ b/Applications/Calculator/CalculatorWidget.cpp @@ -37,13 +37,13 @@ CalculatorWidget::CalculatorWidget(GUI::Widget* parent) m_entry = GUI::TextBox::construct(this); m_entry->set_relative_rect(5, 5, 244, 26); - m_entry->set_text_alignment(TextAlignment::CenterRight); + m_entry->set_text_alignment(Gfx::TextAlignment::CenterRight); m_label = GUI::Label::construct(this); m_label->set_relative_rect(12, 42, 27, 27); m_label->set_foreground_color(Color::NamedColor::Red); - m_label->set_frame_shadow(FrameShadow::Sunken); - m_label->set_frame_shape(FrameShape::Container); + m_label->set_frame_shadow(Gfx::FrameShadow::Sunken); + m_label->set_frame_shape(Gfx::FrameShape::Container); m_label->set_frame_thickness(2); update_display(); diff --git a/Applications/Calculator/main.cpp b/Applications/Calculator/main.cpp index fb8f035e0b..7f19003c8c 100644 --- a/Applications/Calculator/main.cpp +++ b/Applications/Calculator/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char** argv) window->set_main_widget(calc_widget); window->show(); - window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-calculator.png")); + window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-calculator.png")); auto menubar = make<GUI::MenuBar>(); @@ -76,7 +76,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Calculator", load_png("/res/icons/16x16/app-calculator.png"), window); + GUI::AboutDialog::show("Calculator", Gfx::load_png("/res/icons/16x16/app-calculator.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/ChanViewer/ThreadCatalogModel.cpp b/Applications/ChanViewer/ThreadCatalogModel.cpp index 3ba7ed527c..d0519c4ff2 100644 --- a/Applications/ChanViewer/ThreadCatalogModel.cpp +++ b/Applications/ChanViewer/ThreadCatalogModel.cpp @@ -129,17 +129,17 @@ GUI::Model::ColumnMetadata ThreadCatalogModel::column_metadata(int column) const { switch (column) { case Column::ThreadNumber: - return { 70, TextAlignment::CenterRight }; + return { 70, Gfx::TextAlignment::CenterRight }; case Column::Subject: - return { 170, TextAlignment::CenterLeft }; + return { 170, Gfx::TextAlignment::CenterLeft }; case Column::Text: - return { 270, TextAlignment::CenterLeft }; + return { 270, Gfx::TextAlignment::CenterLeft }; case Column::ReplyCount: - return { 45, TextAlignment::CenterRight }; + return { 45, Gfx::TextAlignment::CenterRight }; case Column::ImageCount: - return { 40, TextAlignment::CenterRight }; + return { 40, Gfx::TextAlignment::CenterRight }; case Column::PostTime: - return { 120, TextAlignment::CenterLeft }; + return { 120, Gfx::TextAlignment::CenterLeft }; default: ASSERT_NOT_REACHED(); } diff --git a/Applications/ChanViewer/main.cpp b/Applications/ChanViewer/main.cpp index 99e1be7cc5..b8ded65910 100644 --- a/Applications/ChanViewer/main.cpp +++ b/Applications/ChanViewer/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); window->set_title("ChanViewer"); window->set_rect(100, 100, 800, 500); - window->set_icon(load_png("/res/icons/16x16/app-chanviewer.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-chanviewer.png")); auto widget = GUI::Widget::construct(); window->set_main_widget(widget); @@ -104,7 +104,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("ChanViewer", load_png("/res/icons/32x32/app-chanviewer.png"), window); + GUI::AboutDialog::show("ChanViewer", Gfx::load_png("/res/icons/32x32/app-chanviewer.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/DisplayProperties/DisplayProperties.cpp b/Applications/DisplayProperties/DisplayProperties.cpp index 4ef21805af..57d5639d71 100644 --- a/Applications/DisplayProperties/DisplayProperties.cpp +++ b/Applications/DisplayProperties/DisplayProperties.cpp @@ -151,7 +151,7 @@ void DisplayPropertiesWidget::create_frame() m_selected_wallpaper = m_wallpapers.at(index.row()); builder.append("/res/wallpapers/"); builder.append(m_selected_wallpaper); - m_wallpaper_preview->set_icon(load_png(builder.to_string())); + m_wallpaper_preview->set_icon(Gfx::load_png(builder.to_string())); m_wallpaper_preview->set_should_stretch_icon(true); }; diff --git a/Applications/DisplayProperties/DisplayProperties.h b/Applications/DisplayProperties/DisplayProperties.h index 1f142d0ef9..0b678ee7d3 100644 --- a/Applications/DisplayProperties/DisplayProperties.h +++ b/Applications/DisplayProperties/DisplayProperties.h @@ -71,6 +71,6 @@ private: Vector<String> m_wallpapers; RefPtr<GUI::Label> m_wallpaper_preview; - Size m_selected_resolution; + Gfx::Size m_selected_resolution; String m_selected_wallpaper; }; diff --git a/Applications/DisplayProperties/ItemListModel.h b/Applications/DisplayProperties/ItemListModel.h index 74cee2c346..8b675c3fa7 100644 --- a/Applications/DisplayProperties/ItemListModel.h +++ b/Applications/DisplayProperties/ItemListModel.h @@ -54,7 +54,7 @@ public: virtual ColumnMetadata column_metadata(int) const override { - return { 70, TextAlignment::CenterLeft }; + return { 70, Gfx::TextAlignment::CenterLeft }; } virtual GUI::Variant data(const GUI::ModelIndex& index, Role role = Role::Display) const override diff --git a/Applications/DisplayProperties/main.cpp b/Applications/DisplayProperties/main.cpp index 409e8f14d5..3dea4c6424 100644 --- a/Applications/DisplayProperties/main.cpp +++ b/Applications/DisplayProperties/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char** argv) window->resize(400, 448); window->set_resizable(false); window->set_main_widget(instance.root_widget()); - window->set_icon(load_png("/res/icons/16x16/app-display-properties.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-display-properties.png")); // Let's create the menubar first auto menubar = make<GUI::MenuBar>(); @@ -71,7 +71,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Display Properties", load_png("/res/icons/32x32/app-display-properties.png"), window); + GUI::AboutDialog::show("Display Properties", Gfx::load_png("/res/icons/32x32/app-display-properties.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/FileManager/PropertiesDialog.cpp b/Applications/FileManager/PropertiesDialog.cpp index 494f53309f..8698ea06f0 100644 --- a/Applications/FileManager/PropertiesDialog.cpp +++ b/Applications/FileManager/PropertiesDialog.cpp @@ -87,7 +87,7 @@ PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, boo } }; - set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png")); + set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png")); make_divider(general_tab); struct stat st; @@ -154,7 +154,7 @@ PropertiesDialog::~PropertiesDialog() {} void PropertiesDialog::update() { - m_icon->set_icon(const_cast<GraphicsBitmap*>(m_model.icon_for_file(m_mode, m_name).bitmap_for_size(32))); + m_icon->set_icon(const_cast<Gfx::Bitmap*>(m_model.icon_for_file(m_mode, m_name).bitmap_for_size(32))); set_title(String::format("Properties of \"%s\"", m_name.characters())); } @@ -219,7 +219,7 @@ void PropertiesDialog::make_permission_checkboxes(NonnullRefPtr<GUI::Widget>& pa widget->layout()->set_spacing(10); auto label = GUI::Label::construct(label_string, widget); - label->set_text_alignment(TextAlignment::CenterLeft); + label->set_text_alignment(Gfx::TextAlignment::CenterLeft); auto box_read = GUI::CheckBox::construct("Read", widget); box_read->set_checked(mode & masks.read); @@ -248,10 +248,10 @@ void PropertiesDialog::make_property_value_pairs(const Vector<PropertyValuePair> label_container->layout()->set_spacing(12); auto label_property = GUI::Label::construct(pair.property, label_container); - label_property->set_text_alignment(TextAlignment::CenterLeft); + label_property->set_text_alignment(Gfx::TextAlignment::CenterLeft); label_property->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); - GUI::Label::construct(pair.value, label_container)->set_text_alignment(TextAlignment::CenterLeft); + GUI::Label::construct(pair.value, label_container)->set_text_alignment(Gfx::TextAlignment::CenterLeft); max_width = max(max_width, label_property->font().width(pair.property)); property_labels.append(label_property); @@ -276,8 +276,8 @@ void PropertiesDialog::make_divider(NonnullRefPtr<GUI::Widget>& parent) auto divider = GUI::Frame::construct(parent.ptr()); divider->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); divider->set_preferred_size({ 0, 2 }); - divider->set_frame_shape(FrameShape::HorizontalLine); - divider->set_frame_shadow(FrameShadow::Sunken); + divider->set_frame_shape(Gfx::FrameShape::HorizontalLine); + divider->set_frame_shadow(Gfx::FrameShadow::Sunken); divider->set_frame_thickness(2); parent->layout()->add_spacer(); diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index cddefb1151..328ad1df1f 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -126,8 +126,8 @@ int main(int argc, char** argv) progressbar->set_caption("Generating thumbnails: "); progressbar->set_format(GUI::ProgressBar::Format::ValueSlashMax); progressbar->set_visible(false); - progressbar->set_frame_shape(FrameShape::Panel); - progressbar->set_frame_shadow(FrameShadow::Sunken); + progressbar->set_frame_shape(Gfx::FrameShape::Panel); + progressbar->set_frame_shadow(Gfx::FrameShadow::Sunken); progressbar->set_frame_thickness(1); location_textbox->on_return_pressed = [&] { @@ -164,11 +164,11 @@ int main(int argc, char** argv) auto tree_view_directory_context_menu = GUI::Menu::construct("Tree View Directory"); auto tree_view_context_menu = GUI::Menu::construct("Tree View"); - auto open_parent_directory_action = GUI::Action::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GUI::Action&) { + auto open_parent_directory_action = GUI::Action::create("Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GUI::Action&) { directory_view->open_parent_directory(); }); - auto mkdir_action = GUI::Action::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) { + auto mkdir_action = GUI::Action::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) { auto input_box = GUI::InputBox::construct("Enter name:", "New directory", window); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) { auto new_dir_path = canonicalized_path( @@ -188,7 +188,7 @@ int main(int argc, char** argv) RefPtr<GUI::Action> view_as_icons_action; RefPtr<GUI::Action> view_as_columns_action; - view_as_table_action = GUI::Action::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) { + view_as_table_action = GUI::Action::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, Gfx::Bitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) { directory_view->set_view_mode(DirectoryView::ViewMode::List); view_as_table_action->set_checked(true); @@ -197,7 +197,7 @@ int main(int argc, char** argv) }, window); view_as_table_action->set_checkable(true); - view_as_icons_action = GUI::Action::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) { + view_as_icons_action = GUI::Action::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, Gfx::Bitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) { directory_view->set_view_mode(DirectoryView::ViewMode::Icon); view_as_icons_action->set_checked(true); @@ -206,7 +206,7 @@ int main(int argc, char** argv) }, window); view_as_icons_action->set_checkable(true); - view_as_columns_action = GUI::Action::create("Columns view", GraphicsBitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) { + view_as_columns_action = GUI::Action::create("Columns view", Gfx::Bitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) { directory_view->set_view_mode(DirectoryView::ViewMode::Columns); view_as_columns_action->set_checked(true); @@ -298,7 +298,7 @@ int main(int argc, char** argv) }; auto properties_action - = GUI::Action::create("Properties...", { Mod_Alt, Key_Return }, GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) { + = GUI::Action::create("Properties...", { Mod_Alt, Key_Return }, Gfx::Bitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) { auto& model = directory_view->model(); String path; Vector<String> selected; @@ -445,7 +445,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window); + GUI::AboutDialog::show("File Manager", Gfx::load_png("/res/icons/32x32/filetype-folder.png"), window); })); menubar->add_menu(move(help_menu)); @@ -502,7 +502,7 @@ int main(int argc, char** argv) delete_action->set_enabled(!view.selection().is_empty()); }; - auto open_in_text_editor_action = GUI::Action::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) { + auto open_in_text_editor_action = GUI::Action::create("Open in TextEditor...", Gfx::Bitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) { for (auto& path : selected_file_paths()) { if (!fork()) { int rc = execl("/bin/TextEditor", "TextEditor", path.characters(), nullptr); @@ -587,7 +587,7 @@ int main(int argc, char** argv) window->set_main_widget(widget); window->show(); - window->set_icon(load_png("/res/icons/16x16/filetype-folder.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/filetype-folder.png")); // Read direcory read mode from config. auto dir_view_mode = config->read_entry("DirectoryView", "ViewMode", "Icon"); diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp index 815ab629d5..dece1538ad 100644 --- a/Applications/FontEditor/FontEditor.cpp +++ b/Applications/FontEditor/FontEditor.cpp @@ -38,7 +38,7 @@ #include <LibGUI/GTextBox.h> #include <stdlib.h> -FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GUI::Widget* parent) +FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edited_font, GUI::Widget* parent) : GUI::Widget(parent) , m_edited_font(move(edited_font)) { @@ -85,7 +85,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_fon exit(0); }; - m_ui->info_label->set_text_alignment(TextAlignment::CenterLeft); + m_ui->info_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_ui->demo_label_1->set_font(m_edited_font); m_ui->demo_label_1->set_text("quick fox jumps nightly above wizard."); diff --git a/Applications/FontEditor/FontEditor.h b/Applications/FontEditor/FontEditor.h index 163ad3efd8..82f609c313 100644 --- a/Applications/FontEditor/FontEditor.h +++ b/Applications/FontEditor/FontEditor.h @@ -40,8 +40,8 @@ public: virtual ~FontEditorWidget() override; private: - FontEditorWidget(const String& path, RefPtr<Font>&&, GUI::Widget* parent = nullptr); - RefPtr<Font> m_edited_font; + FontEditorWidget(const String& path, RefPtr<Gfx::Font>&&, GUI::Widget* parent = nullptr); + RefPtr<Gfx::Font> m_edited_font; GlyphMapWidget* m_glyph_map_widget { nullptr }; GlyphEditorWidget* m_glyph_editor_widget { nullptr }; diff --git a/Applications/FontEditor/GlyphEditorWidget.cpp b/Applications/FontEditor/GlyphEditorWidget.cpp index 44ac553de9..5bb1341423 100644 --- a/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Applications/FontEditor/GlyphEditorWidget.cpp @@ -27,13 +27,13 @@ #include "GlyphEditorWidget.h" #include <LibGUI/GPainter.h> -GlyphEditorWidget::GlyphEditorWidget(Font& mutable_font, GUI::Widget* parent) +GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font, GUI::Widget* parent) : GUI::Frame(parent) , m_font(mutable_font) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); set_relative_rect({ 0, 0, preferred_width(), preferred_height() }); } diff --git a/Applications/FontEditor/GlyphEditorWidget.h b/Applications/FontEditor/GlyphEditorWidget.h index a54258aabd..caf4c79447 100644 --- a/Applications/FontEditor/GlyphEditorWidget.h +++ b/Applications/FontEditor/GlyphEditorWidget.h @@ -38,20 +38,20 @@ public: int preferred_width() const; int preferred_height() const; - Font& font() { return *m_font; } - const Font& font() const { return *m_font; } + Gfx::Font& font() { return *m_font; } + const Gfx::Font& font() const { return *m_font; } Function<void(u8)> on_glyph_altered; private: - GlyphEditorWidget(Font&, GUI::Widget* parent); + GlyphEditorWidget(Gfx::Font&, GUI::Widget* parent); virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; void draw_at_mouse(const GUI::MouseEvent&); - RefPtr<Font> m_font; + RefPtr<Gfx::Font> m_font; u8 m_glyph { 0 }; int m_scale { 10 }; }; diff --git a/Applications/FontEditor/GlyphMapWidget.cpp b/Applications/FontEditor/GlyphMapWidget.cpp index 95ac188514..f79b78f4ae 100644 --- a/Applications/FontEditor/GlyphMapWidget.cpp +++ b/Applications/FontEditor/GlyphMapWidget.cpp @@ -28,13 +28,13 @@ #include <LibDraw/Palette.h> #include <LibGUI/GPainter.h> -GlyphMapWidget::GlyphMapWidget(Font& mutable_font, GUI::Widget* parent) +GlyphMapWidget::GlyphMapWidget(Gfx::Font& mutable_font, GUI::Widget* parent) : GUI::Frame(parent) , m_font(mutable_font) { set_frame_thickness(2); - set_frame_shape(FrameShape::Container); - set_frame_shadow(FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); set_relative_rect({ 0, 0, preferred_width(), preferred_height() }); } diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h index 0ad9884e34..5cee940a9c 100644 --- a/Applications/FontEditor/GlyphMapWidget.h +++ b/Applications/FontEditor/GlyphMapWidget.h @@ -43,21 +43,21 @@ public: int preferred_width() const; int preferred_height() const; - Font& font() { return *m_font; } - const Font& font() const { return *m_font; } + Gfx::Font& font() { return *m_font; } + const Gfx::Font& font() const { return *m_font; } void update_glyph(u8); Function<void(u8)> on_glyph_selected; private: - GlyphMapWidget(Font&, GUI::Widget* parent); + GlyphMapWidget(Gfx::Font&, GUI::Widget* parent); virtual void paint_event(GUI::PaintEvent&) override; virtual void mousedown_event(GUI::MouseEvent&) override; Rect get_outer_rect(u8 glyph) const; - RefPtr<Font> m_font; + RefPtr<Gfx::Font> m_font; int m_rows { 8 }; int m_horizontal_spacing { 2 }; int m_vertical_spacing { 2 }; diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp index 94819dd3cb..a6fb097455 100644 --- a/Applications/FontEditor/main.cpp +++ b/Applications/FontEditor/main.cpp @@ -47,12 +47,12 @@ int main(int argc, char** argv) return 1; } - RefPtr<Font> edited_font; + RefPtr<Gfx::Font> edited_font; String path; if (argc == 2) { path = argv[1]; - edited_font = Font::load_from_file(path); + edited_font = Gfx::Font::load_from_file(path); if (!edited_font) { fprintf(stderr, "Couldn't load font: %s\n", path.characters()); return 1; @@ -62,7 +62,7 @@ int main(int argc, char** argv) if (edited_font) edited_font = edited_font->clone(); else - edited_font = Font::default_font().clone(); + edited_font = Gfx::Font::default_font().clone(); auto window = GUI::Window::construct(); window->set_title("Font Editor"); @@ -71,7 +71,7 @@ int main(int argc, char** argv) auto font_editor = FontEditorWidget::construct(path, move(edited_font)); window->set_main_widget(font_editor); window->show(); - window->set_icon(load_png("/res/icons/16x16/app-font-editor.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-font-editor.png")); auto menubar = make<GUI::MenuBar>(); @@ -84,7 +84,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Font Editor", load_png("/res/icons/FontEditor.png"), window); + GUI::AboutDialog::show("Font Editor", Gfx::load_png("/res/icons/FontEditor.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/Help/ManualModel.cpp b/Applications/Help/ManualModel.cpp index 12fbd31726..302228106c 100644 --- a/Applications/Help/ManualModel.cpp +++ b/Applications/Help/ManualModel.cpp @@ -44,8 +44,8 @@ static ManualSectionNode s_sections[] = { ManualModel::ManualModel() { // FIXME: need some help from the icon fairy ^) - m_section_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/book.png")); - m_page_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/filetype-unknown.png")); + m_section_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/book.png")); + m_page_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/filetype-unknown.png")); } String ManualModel::page_path(const GUI::ModelIndex& index) const diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp index 69e50ed37e..e22f8f03e9 100644 --- a/Applications/Help/main.cpp +++ b/Applications/Help/main.cpp @@ -180,7 +180,7 @@ int main(int argc, char* argv[]) auto app_menu = GUI::Menu::construct("Help"); app_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Help", load_png("/res/icons/16x16/book.png"), window); + GUI::AboutDialog::show("Help", Gfx::load_png("/res/icons/16x16/book.png"), window); })); app_menu->add_separator(); app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) { @@ -199,7 +199,7 @@ int main(int argc, char* argv[]) window->set_focused_widget(tree_view); window->show(); - window->set_icon(load_png("/res/icons/16x16/book.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/book.png")); return app.exec(); } diff --git a/Applications/HexEditor/HexEditor.cpp b/Applications/HexEditor/HexEditor.cpp index a965009484..310187e9fd 100644 --- a/Applications/HexEditor/HexEditor.cpp +++ b/Applications/HexEditor/HexEditor.cpp @@ -44,8 +44,8 @@ HexEditor::HexEditor(GUI::Widget* parent) : ScrollableWidget(parent) { - set_frame_shape(FrameShape::Container); - set_frame_shadow(FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); set_frame_thickness(2); set_scrollbars_enabled(true); set_font(GFontDatabase::the().get_by_name("Csilla Thin")); @@ -544,7 +544,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) } auto line = String::format("%02X", m_buffer[byte_position]); - painter.draw_text(hex_display_rect, line, TextAlignment::TopLeft, text_color); + painter.draw_text(hex_display_rect, line, Gfx::TextAlignment::TopLeft, text_color); Rect text_display_rect { frame_thickness() + offset_margin_width() + (bytes_per_row() * (character_width() * 3)) + (j * character_width()) + 20, @@ -559,7 +559,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) painter.fill_rect(text_display_rect, Color::from_rgb(0xCCCCCC)); } - painter.draw_text(text_display_rect, String::format("%c", isprint(m_buffer[byte_position]) ? m_buffer[byte_position] : '.'), TextAlignment::TopLeft, text_color); + painter.draw_text(text_display_rect, String::format("%c", isprint(m_buffer[byte_position]) ? m_buffer[byte_position] : '.'), Gfx::TextAlignment::TopLeft, text_color); } } } diff --git a/Applications/HexEditor/HexEditorWidget.cpp b/Applications/HexEditor/HexEditorWidget.cpp index eb548ba7b4..e765e3aac1 100644 --- a/Applications/HexEditor/HexEditorWidget.cpp +++ b/Applications/HexEditor/HexEditorWidget.cpp @@ -68,7 +68,7 @@ HexEditorWidget::HexEditorWidget() m_statusbar = GUI::StatusBar::construct(5, this); - m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { + m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { if (m_document_dirty) { auto save_document_first_box = GUI::MessageBox::construct("Save Document First?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel, window()); auto save_document_first_result = save_document_first_box->exec(); @@ -102,7 +102,7 @@ HexEditorWidget::HexEditorWidget() open_file(open_path.value()); }); - m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) { + m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) { if (!m_path.is_empty()) { if (!m_editor->write_to_file(m_path)) { GUI::MessageBox::show("Unable to save file.\n", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window()); @@ -116,7 +116,7 @@ HexEditorWidget::HexEditorWidget() m_save_as_action->activate(); }); - m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) { + m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) { Optional<String> save_path = GUI::FilePicker::get_save_filepath(m_name.is_null() ? "Untitled" : m_name, m_extension.is_null() ? "bin" : m_extension); if (!save_path.has_value()) return; @@ -153,7 +153,7 @@ HexEditorWidget::HexEditorWidget() })); } - m_goto_decimal_offset_action = GUI::Action::create("Go To Offset (Decimal)...", { Mod_Ctrl | Mod_Shift, Key_G }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) { + m_goto_decimal_offset_action = GUI::Action::create("Go To Offset (Decimal)...", { Mod_Ctrl | Mod_Shift, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) { auto input_box = GUI::InputBox::construct("Enter Decimal offset:", "Go To", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) { auto valid = false; @@ -164,7 +164,7 @@ HexEditorWidget::HexEditorWidget() } }); - m_goto_hex_offset_action = GUI::Action::create("Go To Offset (Hex)...", { Mod_Ctrl, Key_G }, GraphicsBitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) { + m_goto_hex_offset_action = GUI::Action::create("Go To Offset (Hex)...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"), [this](const GUI::Action&) { auto input_box = GUI::InputBox::construct("Enter Hex offset:", "Go To", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) { auto new_offset = strtol(input_box->text_value().characters(), nullptr, 16); @@ -202,7 +202,7 @@ HexEditorWidget::HexEditorWidget() auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Hex Editor", load_png("/res/icons/32x32/app-hexeditor.png"), window()); + GUI::AboutDialog::show("Hex Editor", Gfx::load_png("/res/icons/32x32/app-hexeditor.png"), window()); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/HexEditor/main.cpp b/Applications/HexEditor/main.cpp index 38cf4aeb46..f877cdac3d 100644 --- a/Applications/HexEditor/main.cpp +++ b/Applications/HexEditor/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) }; window->show(); - window->set_icon(load_png("/res/icons/16x16/app-hexeditor.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-hexeditor.png")); if (argc >= 2) hex_editor_widget->open_file(argv[1]); diff --git a/Applications/IRCClient/IRCAppWindow.cpp b/Applications/IRCClient/IRCAppWindow.cpp index 5e2bb26c46..ef4e8445ad 100644 --- a/Applications/IRCClient/IRCAppWindow.cpp +++ b/Applications/IRCClient/IRCAppWindow.cpp @@ -55,7 +55,7 @@ IRCAppWindow::IRCAppWindow() ASSERT(!s_the); s_the = this; - set_icon(load_png("/res/icons/16x16/app-irc-client.png")); + set_icon(Gfx::load_png("/res/icons/16x16/app-irc-client.png")); update_title(); set_rect(200, 200, 600, 400); @@ -108,13 +108,13 @@ void IRCAppWindow::setup_client() void IRCAppWindow::setup_actions() { - m_join_action = GUI::Action::create("Join channel", { Mod_Ctrl, Key_J }, GraphicsBitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) { + m_join_action = GUI::Action::create("Join channel", { Mod_Ctrl, Key_J }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-join.png"), [&](auto&) { auto input_box = GUI::InputBox::construct("Enter channel name:", "Join channel", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) m_client.handle_join_action(input_box->text_value()); }); - m_part_action = GUI::Action::create("Part from channel", { Mod_Ctrl, Key_P }, GraphicsBitmap::load_from_file("/res/icons/16x16/irc-part.png"), [this](auto&) { + m_part_action = GUI::Action::create("Part from channel", { Mod_Ctrl, Key_P }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-part.png"), [this](auto&) { auto* window = m_client.current_window(); if (!window || window->type() != IRCWindow::Type::Channel) { // FIXME: Perhaps this action should have been disabled instead of allowing us to activate it. @@ -123,23 +123,23 @@ void IRCAppWindow::setup_actions() m_client.handle_part_action(window->channel().name()); }); - m_whois_action = GUI::Action::create("Whois user", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&](auto&) { + m_whois_action = GUI::Action::create("Whois user", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-whois.png"), [&](auto&) { auto input_box = GUI::InputBox::construct("Enter nickname:", "IRC WHOIS lookup", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) m_client.handle_whois_action(input_box->text_value()); }); - m_open_query_action = GUI::Action::create("Open query", { Mod_Ctrl, Key_O }, GraphicsBitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&](auto&) { + m_open_query_action = GUI::Action::create("Open query", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-open-query.png"), [&](auto&) { auto input_box = GUI::InputBox::construct("Enter nickname:", "Open IRC query with...", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) m_client.handle_open_query_action(input_box->text_value()); }); - m_close_query_action = GUI::Action::create("Close query", { Mod_Ctrl, Key_D }, GraphicsBitmap::load_from_file("/res/icons/16x16/irc-close-query.png"), [](auto&) { + m_close_query_action = GUI::Action::create("Close query", { Mod_Ctrl, Key_D }, Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-close-query.png"), [](auto&) { printf("FIXME: Implement close-query action\n"); }); - m_change_nick_action = GUI::Action::create("Change nickname", GraphicsBitmap::load_from_file("/res/icons/16x16/irc-nick.png"), [this](auto&) { + m_change_nick_action = GUI::Action::create("Change nickname", Gfx::Bitmap::load_from_file("/res/icons/16x16/irc-nick.png"), [this](auto&) { auto input_box = GUI::InputBox::construct("Enter nickname:", "Change nickname", this); if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) m_client.handle_change_nick_action(input_box->text_value()); @@ -170,7 +170,7 @@ void IRCAppWindow::setup_menus() auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [this](const GUI::Action&) { - GUI::AboutDialog::show("IRC Client", load_png("/res/icons/32x32/app-irc-client.png"), this); + GUI::AboutDialog::show("IRC Client", Gfx::load_png("/res/icons/32x32/app-irc-client.png"), this); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/IRCClient/IRCChannelMemberListModel.cpp b/Applications/IRCClient/IRCChannelMemberListModel.cpp index 20b5094d23..aca79040c8 100644 --- a/Applications/IRCClient/IRCChannelMemberListModel.cpp +++ b/Applications/IRCClient/IRCChannelMemberListModel.cpp @@ -61,7 +61,7 @@ GUI::Model::ColumnMetadata IRCChannelMemberListModel::column_metadata(int column { switch (column) { case Column::Name: - return { 70, TextAlignment::CenterLeft }; + return { 70, Gfx::TextAlignment::CenterLeft }; } ASSERT_NOT_REACHED(); } diff --git a/Applications/IRCClient/IRCWindowListModel.cpp b/Applications/IRCClient/IRCWindowListModel.cpp index 152ddfbb46..6b50450203 100644 --- a/Applications/IRCClient/IRCWindowListModel.cpp +++ b/Applications/IRCClient/IRCWindowListModel.cpp @@ -63,7 +63,7 @@ GUI::Model::ColumnMetadata IRCWindowListModel::column_metadata(int column) const { switch (column) { case Column::Name: - return { 70, TextAlignment::CenterLeft }; + return { 70, Gfx::TextAlignment::CenterLeft }; } ASSERT_NOT_REACHED(); } diff --git a/Applications/PaintBrush/BucketTool.cpp b/Applications/PaintBrush/BucketTool.cpp index 19668b5415..135bbd58c1 100644 --- a/Applications/PaintBrush/BucketTool.cpp +++ b/Applications/PaintBrush/BucketTool.cpp @@ -40,7 +40,7 @@ BucketTool::~BucketTool() { } -static void flood_fill(GraphicsBitmap& bitmap, const Point& start_position, Color target_color, Color fill_color) +static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::Point& start_position, Color target_color, Color fill_color) { ASSERT(bitmap.bpp() == 32); @@ -48,13 +48,13 @@ static void flood_fill(GraphicsBitmap& bitmap, const Point& start_position, Colo return; Queue<Point> queue; - queue.enqueue(Point(start_position)); + queue.enqueue(start_position); while (!queue.is_empty()) { auto position = queue.dequeue(); - if (bitmap.get_pixel<GraphicsBitmap::Format::RGB32>(position.x(), position.y()) != target_color) + if (bitmap.get_pixel<Gfx::Bitmap::Format::RGB32>(position.x(), position.y()) != target_color) continue; - bitmap.set_pixel<GraphicsBitmap::Format::RGB32>(position.x(), position.y(), fill_color); + bitmap.set_pixel<Gfx::Bitmap::Format::RGB32>(position.x(), position.y(), fill_color); if (position.x() != 0) queue.enqueue(position.translated(-1, 0)); diff --git a/Applications/PaintBrush/EllipseTool.h b/Applications/PaintBrush/EllipseTool.h index 6c59b1637b..a55b8eb911 100644 --- a/Applications/PaintBrush/EllipseTool.h +++ b/Applications/PaintBrush/EllipseTool.h @@ -57,8 +57,8 @@ private: void draw_using(GUI::Painter& painter); GUI::MouseButton m_drawing_button { GUI::MouseButton::None }; - Point m_ellipse_start_position; - Point m_ellipse_end_position; + Gfx::Point m_ellipse_start_position; + Gfx::Point m_ellipse_end_position; RefPtr<GUI::Menu> m_context_menu; int m_thickness { 1 }; GUI::ActionGroup m_thickness_actions; diff --git a/Applications/PaintBrush/EraseTool.cpp b/Applications/PaintBrush/EraseTool.cpp index 4252508432..b57d013232 100644 --- a/Applications/PaintBrush/EraseTool.cpp +++ b/Applications/PaintBrush/EraseTool.cpp @@ -38,7 +38,7 @@ EraseTool::~EraseTool() { } -Rect EraseTool::build_rect(const Point& pos, const Rect& widget_rect) +Rect EraseTool::build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect) { const int base_eraser_size = 10; const int eraser_size = (base_eraser_size * m_thickness); diff --git a/Applications/PaintBrush/EraseTool.h b/Applications/PaintBrush/EraseTool.h index 576a1f5b46..89ebbbc047 100644 --- a/Applications/PaintBrush/EraseTool.h +++ b/Applications/PaintBrush/EraseTool.h @@ -46,7 +46,7 @@ public: private: Color get_color() const; virtual const char* class_name() const override { return "EraseTool"; } - Rect build_rect(const Point& pos, const Rect& widget_rect); + Rect build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect); RefPtr<GUI::Menu> m_context_menu; bool m_use_secondary_color { true }; diff --git a/Applications/PaintBrush/LineTool.cpp b/Applications/PaintBrush/LineTool.cpp index e3ffaa0bb6..9f1bfef49b 100644 --- a/Applications/PaintBrush/LineTool.cpp +++ b/Applications/PaintBrush/LineTool.cpp @@ -31,7 +31,7 @@ #include <LibGUI/GPainter.h> #include <LibM/math.h> -Point constrain_line_angle(const Point& start_pos, const Point& end_pos, float angle_increment) +Point constrain_line_angle(const Gfx::Point& start_pos, const Gfx::Point& end_pos, float angle_increment) { float current_angle = atan2(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + M_PI * 2.; diff --git a/Applications/PaintBrush/LineTool.h b/Applications/PaintBrush/LineTool.h index 40657ac5b0..42f244b29e 100644 --- a/Applications/PaintBrush/LineTool.h +++ b/Applications/PaintBrush/LineTool.h @@ -51,8 +51,8 @@ private: virtual const char* class_name() const override { return "LineTool"; } GUI::MouseButton m_drawing_button { GUI::MouseButton::None }; - Point m_line_start_position; - Point m_line_end_position; + Gfx::Point m_line_start_position; + Gfx::Point m_line_end_position; RefPtr<GUI::Menu> m_context_menu; GUI::ActionGroup m_thickness_actions; int m_thickness { 1 }; diff --git a/Applications/PaintBrush/PaintableWidget.cpp b/Applications/PaintBrush/PaintableWidget.cpp index 42ac963529..a423b0e9d0 100644 --- a/Applications/PaintBrush/PaintableWidget.cpp +++ b/Applications/PaintBrush/PaintableWidget.cpp @@ -47,7 +47,7 @@ PaintableWidget::PaintableWidget(GUI::Widget* parent) pal.set_color(ColorRole::Window, Color::MidGray); set_palette(pal); set_background_color(Color::MidGray); - m_bitmap = GraphicsBitmap::create(GraphicsBitmap::Format::RGB32, { 600, 400 }); + m_bitmap = Gfx::Bitmap::create(Gfx::Bitmap::Format::RGB32, { 600, 400 }); m_bitmap->fill(Color::White); } @@ -158,7 +158,7 @@ void PaintableWidget::set_secondary_color(Color color) on_secondary_color_change(color); } -void PaintableWidget::set_bitmap(const GraphicsBitmap& bitmap) +void PaintableWidget::set_bitmap(const Gfx::Bitmap& bitmap) { m_bitmap = bitmap; update(); diff --git a/Applications/PaintBrush/PaintableWidget.h b/Applications/PaintBrush/PaintableWidget.h index 1883a4fa57..79300c66da 100644 --- a/Applications/PaintBrush/PaintableWidget.h +++ b/Applications/PaintBrush/PaintableWidget.h @@ -49,10 +49,10 @@ public: Color color_for(const GUI::MouseEvent&) const; Color color_for(GUI::MouseButton) const; - void set_bitmap(const GraphicsBitmap&); + void set_bitmap(const Gfx::Bitmap&); - GraphicsBitmap& bitmap() { return *m_bitmap; } - const GraphicsBitmap& bitmap() const { return *m_bitmap; } + Gfx::Bitmap& bitmap() { return *m_bitmap; } + const Gfx::Bitmap& bitmap() const { return *m_bitmap; } Function<void(Color)> on_primary_color_change; Function<void(Color)> on_secondary_color_change; @@ -67,7 +67,7 @@ private: virtual void keydown_event(GUI::KeyEvent&) override; virtual void keyup_event(GUI::KeyEvent&) override; - RefPtr<GraphicsBitmap> m_bitmap; + RefPtr<Gfx::Bitmap> m_bitmap; Color m_primary_color { Color::Black }; Color m_secondary_color { Color::White }; diff --git a/Applications/PaintBrush/PaletteWidget.cpp b/Applications/PaintBrush/PaletteWidget.cpp index 0760d3074e..9a309699ad 100644 --- a/Applications/PaintBrush/PaletteWidget.cpp +++ b/Applications/PaintBrush/PaletteWidget.cpp @@ -38,8 +38,8 @@ public: , m_color(color) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); } virtual ~ColorWidget() override @@ -75,8 +75,8 @@ PaletteWidget::PaletteWidget(PaintableWidget& paintable_widget, GUI::Widget* par : GUI::Frame(parent) , m_paintable_widget(paintable_widget) { - set_frame_shape(FrameShape::Panel); - set_frame_shadow(FrameShadow::Raised); + set_frame_shape(Gfx::FrameShape::Panel); + set_frame_shadow(Gfx::FrameShadow::Raised); set_frame_thickness(0); set_fill_with_background_color(true); @@ -85,16 +85,16 @@ PaletteWidget::PaletteWidget(PaintableWidget& paintable_widget, GUI::Widget* par m_secondary_color_widget = GUI::Frame::construct(this); m_secondary_color_widget->set_frame_thickness(2); - m_secondary_color_widget->set_frame_shape(FrameShape::Container); - m_secondary_color_widget->set_frame_shadow(FrameShadow::Sunken); + m_secondary_color_widget->set_frame_shape(Gfx::FrameShape::Container); + m_secondary_color_widget->set_frame_shadow(Gfx::FrameShadow::Sunken); m_secondary_color_widget->set_relative_rect({ 2, 2, 60, 31 }); m_secondary_color_widget->set_fill_with_background_color(true); set_secondary_color(paintable_widget.secondary_color()); m_primary_color_widget = GUI::Frame::construct(this); m_primary_color_widget->set_frame_thickness(2); - m_primary_color_widget->set_frame_shape(FrameShape::Container); - m_primary_color_widget->set_frame_shadow(FrameShadow::Sunken); + m_primary_color_widget->set_frame_shape(Gfx::FrameShape::Container); + m_primary_color_widget->set_frame_shadow(Gfx::FrameShadow::Sunken); Rect rect { 0, 0, 38, 15 }; rect.center_within(m_secondary_color_widget->relative_rect()); m_primary_color_widget->set_relative_rect(rect); diff --git a/Applications/PaintBrush/PenTool.h b/Applications/PaintBrush/PenTool.h index c98f58ba0a..52c1f17257 100644 --- a/Applications/PaintBrush/PenTool.h +++ b/Applications/PaintBrush/PenTool.h @@ -47,7 +47,7 @@ public: private: virtual const char* class_name() const override { return "PenTool"; } - Point m_last_drawing_event_position { -1, -1 }; + Gfx::Point m_last_drawing_event_position { -1, -1 }; RefPtr<GUI::Menu> m_context_menu; int m_thickness { 1 }; GUI::ActionGroup m_thickness_actions; diff --git a/Applications/PaintBrush/RectangleTool.h b/Applications/PaintBrush/RectangleTool.h index 2e507acd0d..171c376241 100644 --- a/Applications/PaintBrush/RectangleTool.h +++ b/Applications/PaintBrush/RectangleTool.h @@ -57,8 +57,8 @@ private: void draw_using(GUI::Painter& painter); GUI::MouseButton m_drawing_button { GUI::MouseButton::None }; - Point m_rectangle_start_position; - Point m_rectangle_end_position; + Gfx::Point m_rectangle_start_position; + Gfx::Point m_rectangle_end_position; RefPtr<GUI::Menu> m_context_menu; Mode m_mode { Mode::Outline }; }; diff --git a/Applications/PaintBrush/SprayTool.cpp b/Applications/PaintBrush/SprayTool.cpp index cb07adf262..69083cd1fa 100644 --- a/Applications/PaintBrush/SprayTool.cpp +++ b/Applications/PaintBrush/SprayTool.cpp @@ -70,7 +70,7 @@ void SprayTool::paint_it() continue; if (ypos < 0 || ypos >= bitmap.height()) continue; - bitmap.set_pixel<GraphicsBitmap::Format::RGB32>(xpos, ypos, m_color); + bitmap.set_pixel<Gfx::Bitmap::Format::RGB32>(xpos, ypos, m_color); } } diff --git a/Applications/PaintBrush/SprayTool.h b/Applications/PaintBrush/SprayTool.h index 65bbe7c738..ed517fa777 100644 --- a/Applications/PaintBrush/SprayTool.h +++ b/Applications/PaintBrush/SprayTool.h @@ -49,7 +49,7 @@ private: virtual const char* class_name() const override { return "SprayTool"; } void paint_it(); RefPtr<Core::Timer> m_timer; - Point m_last_pos; + Gfx::Point m_last_pos; Color m_color; RefPtr<GUI::Menu> m_context_menu; GUI::ActionGroup m_thickness_actions; diff --git a/Applications/PaintBrush/ToolboxWidget.cpp b/Applications/PaintBrush/ToolboxWidget.cpp index 3f0708cc68..cf13fa0296 100644 --- a/Applications/PaintBrush/ToolboxWidget.cpp +++ b/Applications/PaintBrush/ToolboxWidget.cpp @@ -67,8 +67,8 @@ ToolboxWidget::ToolboxWidget(GUI::Widget* parent) set_fill_with_background_color(true); set_frame_thickness(1); - set_frame_shape(FrameShape::Panel); - set_frame_shadow(FrameShadow::Raised); + set_frame_shape(Gfx::FrameShape::Panel); + set_frame_shadow(Gfx::FrameShadow::Raised); set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); set_preferred_size(48, 0); @@ -83,7 +83,7 @@ ToolboxWidget::ToolboxWidget(GUI::Widget* parent) button->set_checkable(true); button->set_exclusive(true); - button->set_icon(load_png(String::format("/res/icons/paintbrush/%s.png", String(icon_name).characters()))); + button->set_icon(Gfx::load_png(String::format("/res/icons/paintbrush/%s.png", String(icon_name).characters()))); button->on_checked = [button = button.ptr()](auto checked) { if (checked) diff --git a/Applications/PaintBrush/main.cpp b/Applications/PaintBrush/main.cpp index 9ce2ffc7bc..bf8401a5df 100644 --- a/Applications/PaintBrush/main.cpp +++ b/Applications/PaintBrush/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) auto window = GUI::Window::construct(); window->set_title("PaintBrush"); window->set_rect(100, 100, 640, 480); - window->set_icon(load_png("/res/icons/16x16/app-paintbrush.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-paintbrush.png")); auto horizontal_container = GUI::Widget::construct(); window->set_main_widget(horizontal_container); @@ -84,7 +84,7 @@ int main(int argc, char** argv) if (!open_path.has_value()) return; - auto bitmap = load_png(open_path.value()); + auto bitmap = Gfx::load_png(open_path.value()); if (!bitmap) { GUI::MessageBox::show(String::format("Failed to load '%s'", open_path.value().characters()), "Open failed", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window); return; @@ -104,7 +104,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](auto&) { - GUI::AboutDialog::show("PaintBrush", load_png("/res/icons/32x32/app-paintbrush.png"), window); + GUI::AboutDialog::show("PaintBrush", Gfx::load_png("/res/icons/32x32/app-paintbrush.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/Piano/KeysWidget.cpp b/Applications/Piano/KeysWidget.cpp index 77608e31bc..4f7963de3f 100644 --- a/Applications/Piano/KeysWidget.cpp +++ b/Applications/Piano/KeysWidget.cpp @@ -34,8 +34,8 @@ KeysWidget::KeysWidget(GUI::Widget* parent, AudioEngine& audio_engine) , m_audio_engine(audio_engine) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); set_fill_with_background_color(true); } @@ -188,7 +188,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event) painter.draw_rect(rect, Color::Black); if (i < white_key_labels_count) { rect.set_height(rect.height() * 1.5); - painter.draw_text(rect, StringView(&white_key_labels[i], 1), TextAlignment::Center, Color::Black); + painter.draw_text(rect, StringView(&white_key_labels[i], 1), Gfx::TextAlignment::Center, Color::Black); } note += white_key_note_accumulator[i % white_keys_per_octave]; @@ -210,7 +210,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event) painter.draw_rect(rect, Color::Black); if (i < black_key_labels_count) { rect.set_height(rect.height() * 1.5); - painter.draw_text(rect, StringView(&black_key_labels[i], 1), TextAlignment::Center, Color::White); + painter.draw_text(rect, StringView(&black_key_labels[i], 1), Gfx::TextAlignment::Center, Color::White); } note += black_key_note_accumulator[i % black_keys_per_octave]; @@ -249,11 +249,12 @@ static inline int note_from_white_keys(int white_keys) return note; } -int KeysWidget::note_for_event_position(Point point) const +int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const { - if (!frame_inner_rect().contains(point)) + if (!frame_inner_rect().contains(a_point)) return -1; + auto point = a_point; point.move_by(-frame_thickness(), -frame_thickness()); int white_keys = point.x() / white_key_width; diff --git a/Applications/Piano/KeysWidget.h b/Applications/Piano/KeysWidget.h index a051457b8d..0c44487356 100644 --- a/Applications/Piano/KeysWidget.h +++ b/Applications/Piano/KeysWidget.h @@ -50,7 +50,7 @@ private: virtual void mouseup_event(GUI::MouseEvent&) override; virtual void mousemove_event(GUI::MouseEvent&) override; - int note_for_event_position(Point) const; + int note_for_event_position(const Gfx::Point&) const; AudioEngine& m_audio_engine; diff --git a/Applications/Piano/KnobsWidget.cpp b/Applications/Piano/KnobsWidget.cpp index f35f7869a3..a5cf1ac204 100644 --- a/Applications/Piano/KnobsWidget.cpp +++ b/Applications/Piano/KnobsWidget.cpp @@ -38,8 +38,8 @@ KnobsWidget::KnobsWidget(GUI::Widget* parent, AudioEngine& audio_engine, MainWid , m_main_widget(main_widget) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); set_layout(make<GUI::VBoxLayout>()); set_fill_with_background_color(true); diff --git a/Applications/Piano/RollWidget.cpp b/Applications/Piano/RollWidget.cpp index 325cafe880..e39206788d 100644 --- a/Applications/Piano/RollWidget.cpp +++ b/Applications/Piano/RollWidget.cpp @@ -38,8 +38,8 @@ RollWidget::RollWidget(GUI::Widget* parent, AudioEngine& audio_engine) , m_audio_engine(audio_engine) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); set_should_hide_unnecessary_scrollbars(true); set_content_size({ 0, roll_height }); diff --git a/Applications/Piano/WaveWidget.cpp b/Applications/Piano/WaveWidget.cpp index 5a66c6e08f..817c80b029 100644 --- a/Applications/Piano/WaveWidget.cpp +++ b/Applications/Piano/WaveWidget.cpp @@ -35,8 +35,8 @@ WaveWidget::WaveWidget(GUI::Widget* parent, AudioEngine& audio_engine) , m_audio_engine(audio_engine) { set_frame_thickness(2); - set_frame_shadow(FrameShadow::Sunken); - set_frame_shape(FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); } WaveWidget::~WaveWidget() diff --git a/Applications/Piano/main.cpp b/Applications/Piano/main.cpp index b0d7d3f8f4..25ae0cc817 100644 --- a/Applications/Piano/main.cpp +++ b/Applications/Piano/main.cpp @@ -51,7 +51,7 @@ int main(int argc, char** argv) window->set_main_widget(main_widget); window->set_title("Piano"); window->set_rect(90, 90, 840, 600); - window->set_icon(load_png("/res/icons/16x16/app-piano.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-piano.png")); window->show(); LibThread::Thread audio_thread([&] { @@ -82,7 +82,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Piano", load_png("/res/icons/32x32/app-piano.png"), window); + GUI::AboutDialog::show("Piano", Gfx::load_png("/res/icons/32x32/app-piano.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/QuickShow/QSWidget.cpp b/Applications/QuickShow/QSWidget.cpp index 957e487f28..02c539513d 100644 --- a/Applications/QuickShow/QSWidget.cpp +++ b/Applications/QuickShow/QSWidget.cpp @@ -34,8 +34,8 @@ QSWidget::QSWidget(GUI::Widget* parent) : GUI::Frame(parent) { - set_frame_shape(FrameShape::Container); - set_frame_shadow(FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); set_frame_thickness(2); set_fill_with_background_color(true); @@ -46,7 +46,7 @@ QSWidget::~QSWidget() { } -void QSWidget::set_bitmap(NonnullRefPtr<GraphicsBitmap> bitmap) +void QSWidget::set_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap) { m_bitmap = move(bitmap); } @@ -139,7 +139,7 @@ void QSWidget::drop_event(GUI::DropEvent& event) return; } URL url(lines[0]); - auto bitmap = GraphicsBitmap::load_from_file(url.path()); + auto bitmap = Gfx::Bitmap::load_from_file(url.path()); if (!bitmap) { GUI::MessageBox::show(String::format("Failed to open %s", url.to_string().characters()), "Cannot open image", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window()); return; diff --git a/Applications/QuickShow/QSWidget.h b/Applications/QuickShow/QSWidget.h index 21cd4450df..ba6ca1e90d 100644 --- a/Applications/QuickShow/QSWidget.h +++ b/Applications/QuickShow/QSWidget.h @@ -35,8 +35,8 @@ class QSWidget final : public GUI::Frame { public: virtual ~QSWidget() override; - void set_bitmap(NonnullRefPtr<GraphicsBitmap>); - const GraphicsBitmap* bitmap() const { return m_bitmap.ptr(); } + void set_bitmap(NonnullRefPtr<Gfx::Bitmap>); + const Gfx::Bitmap* bitmap() const { return m_bitmap.ptr(); } void set_path(const String&); const String& path() const { return m_path; } @@ -55,10 +55,10 @@ private: void relayout(); - RefPtr<GraphicsBitmap> m_bitmap; - Rect m_bitmap_rect; + RefPtr<Gfx::Bitmap> m_bitmap; + Gfx::Rect m_bitmap_rect; int m_scale { 100 }; - Point m_pan_origin; - Point m_pan_bitmap_origin; + Gfx::Point m_pan_origin; + Gfx::Point m_pan_bitmap_origin; String m_path; }; diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index c8f3a515cf..9c2873b82f 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -80,7 +80,7 @@ int main(int argc, char** argv) if (argc > 1) path = argv[1]; - auto bitmap = GraphicsBitmap::load_from_file(path); + auto bitmap = Gfx::Bitmap::load_from_file(path); if (!bitmap) { fprintf(stderr, "Failed to load %s\n", path); return 1; diff --git a/Applications/SoundPlayer/SampleWidget.cpp b/Applications/SoundPlayer/SampleWidget.cpp index 0e9c9d3fa0..7b405ce41d 100644 --- a/Applications/SoundPlayer/SampleWidget.cpp +++ b/Applications/SoundPlayer/SampleWidget.cpp @@ -32,8 +32,8 @@ SampleWidget::SampleWidget(GUI::Widget* parent) : GUI::Frame(parent) { - set_frame_shape(FrameShape::Container); - set_frame_shadow(FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); set_frame_thickness(2); } diff --git a/Applications/SoundPlayer/SoundPlayerWidget.cpp b/Applications/SoundPlayer/SoundPlayerWidget.cpp index db017494fd..d3bd9c084f 100644 --- a/Applications/SoundPlayer/SoundPlayerWidget.cpp +++ b/Applications/SoundPlayer/SoundPlayerWidget.cpp @@ -46,8 +46,8 @@ SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::C status_widget->set_layout(make<GUI::HBoxLayout>()); m_elapsed = GUI::Label::construct(status_widget); - m_elapsed->set_frame_shape(FrameShape::Container); - m_elapsed->set_frame_shadow(FrameShadow::Sunken); + m_elapsed->set_frame_shape(Gfx::FrameShape::Container); + m_elapsed->set_frame_shadow(Gfx::FrameShadow::Sunken); m_elapsed->set_frame_thickness(2); m_elapsed->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); m_elapsed->set_preferred_size(80, 0); @@ -59,8 +59,8 @@ SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::C m_sample_widget = SampleWidget::construct(sample_widget_container); m_remaining = GUI::Label::construct(status_widget); - m_remaining->set_frame_shape(FrameShape::Container); - m_remaining->set_frame_shadow(FrameShadow::Sunken); + m_remaining->set_frame_shape(Gfx::FrameShape::Container); + m_remaining->set_frame_shadow(Gfx::FrameShadow::Sunken); m_remaining->set_frame_thickness(2); m_remaining->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); m_remaining->set_preferred_size(80, 0); @@ -87,14 +87,14 @@ SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::C m_stop = GUI::Button::construct(control_widget); m_stop->set_enabled(false); - m_stop->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/stop.png")); + m_stop->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png")); m_stop->on_click = [&](GUI::Button&) { m_manager.stop(); }; m_status = GUI::Label::construct(this); - m_status->set_frame_shape(FrameShape::Box); - m_status->set_frame_shadow(FrameShadow::Raised); + m_status->set_frame_shape(Gfx::FrameShape::Box); + m_status->set_frame_shadow(Gfx::FrameShadow::Raised); m_status->set_frame_thickness(4); - m_status->set_text_alignment(TextAlignment::CenterLeft); + m_status->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_status->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); m_status->set_preferred_size(0, 18); m_status->set_text("No file open!"); diff --git a/Applications/SoundPlayer/SoundPlayerWidget.h b/Applications/SoundPlayer/SoundPlayerWidget.h index 5d7daa9739..8e6ca228d1 100644 --- a/Applications/SoundPlayer/SoundPlayerWidget.h +++ b/Applications/SoundPlayer/SoundPlayerWidget.h @@ -85,8 +85,8 @@ private: RefPtr<GUI::Label> m_remaining; RefPtr<Slider> m_slider; RefPtr<SampleWidget> m_sample_widget; - RefPtr<GraphicsBitmap> m_play_icon { GraphicsBitmap::load_from_file("/res/icons/16x16/play.png") }; - RefPtr<GraphicsBitmap> m_pause_icon { GraphicsBitmap::load_from_file("/res/icons/16x16/pause.png") }; + RefPtr<Gfx::Bitmap> m_play_icon { Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png") }; + RefPtr<Gfx::Bitmap> m_pause_icon { Gfx::Bitmap::load_from_file("/res/icons/16x16/pause.png") }; RefPtr<GUI::Button> m_play; RefPtr<GUI::Button> m_stop; }; diff --git a/Applications/SoundPlayer/main.cpp b/Applications/SoundPlayer/main.cpp index e308c7a0c7..927727751e 100644 --- a/Applications/SoundPlayer/main.cpp +++ b/Applications/SoundPlayer/main.cpp @@ -62,7 +62,7 @@ int main(int argc, char** argv) window->set_title("SoundPlayer"); window->set_resizable(false); window->set_rect(300, 300, 350, 140); - window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-sound-player.png")); + window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-sound-player.png")); auto menubar = make<GUI::MenuBar>(); auto app_menu = GUI::Menu::construct("SoundPlayer"); @@ -94,7 +94,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [](auto&) { - GUI::AboutDialog::show("SoundPlayer", GraphicsBitmap::load_from_file("/res/icons/32x32/app-sound-player.png")); + GUI::AboutDialog::show("SoundPlayer", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-sound-player.png")); })); menubar->add_menu(move(app_menu)); diff --git a/Applications/SystemMonitor/DevicesModel.cpp b/Applications/SystemMonitor/DevicesModel.cpp index 0d50e1d16a..c8f8492cc3 100644 --- a/Applications/SystemMonitor/DevicesModel.cpp +++ b/Applications/SystemMonitor/DevicesModel.cpp @@ -77,15 +77,15 @@ GUI::Model::ColumnMetadata DevicesModel::column_metadata(int column) const { switch (column) { case Column::Device: - return { 70, TextAlignment::CenterLeft }; + return { 70, Gfx::TextAlignment::CenterLeft }; case Column::Major: - return { 32, TextAlignment::CenterRight }; + return { 32, Gfx::TextAlignment::CenterRight }; case Column::Minor: - return { 32, TextAlignment::CenterRight }; + return { 32, Gfx::TextAlignment::CenterRight }; case Column::ClassName: - return { 120, TextAlignment::CenterLeft }; + return { 120, Gfx::TextAlignment::CenterLeft }; case Column::Type: - return { 120, TextAlignment::CenterLeft }; + return { 120, Gfx::TextAlignment::CenterLeft }; default: ASSERT_NOT_REACHED(); } diff --git a/Applications/SystemMonitor/GraphWidget.cpp b/Applications/SystemMonitor/GraphWidget.cpp index 863fede531..05c60def9a 100644 --- a/Applications/SystemMonitor/GraphWidget.cpp +++ b/Applications/SystemMonitor/GraphWidget.cpp @@ -31,8 +31,8 @@ GraphWidget::GraphWidget(GUI::Widget* parent) : GUI::Frame(parent) { set_frame_thickness(2); - set_frame_shape(FrameShape::Container); - set_frame_shadow(FrameShadow::Sunken); + set_frame_shape(Gfx::FrameShape::Container); + set_frame_shadow(Gfx::FrameShadow::Sunken); } GraphWidget::~GraphWidget() @@ -72,7 +72,7 @@ void GraphWidget::paint_event(GUI::PaintEvent& event) Rect text_rect = inner_rect.shrunken(8, 8); text_rect.set_height(font().glyph_height()); auto text = text_formatter(m_values.last(), m_max); - painter.draw_text(text_rect.translated(1, 1), text.characters(), TextAlignment::CenterRight, Color::Black); - painter.draw_text(text_rect, text.characters(), TextAlignment::CenterRight, m_text_color); + painter.draw_text(text_rect.translated(1, 1), text.characters(), Gfx::TextAlignment::CenterRight, Color::Black); + painter.draw_text(text_rect, text.characters(), Gfx::TextAlignment::CenterRight, m_text_color); } } diff --git a/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Applications/SystemMonitor/MemoryStatsWidget.cpp index 1bd39f0c8b..3fff1dc7cb 100644 --- a/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -62,10 +62,10 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph, GUI::Widget* parent) container->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); container->set_preferred_size(275, 12); auto description_label = GUI::Label::construct(description, container); - description_label->set_font(Font::default_bold_font()); - description_label->set_text_alignment(TextAlignment::CenterLeft); + description_label->set_font(Gfx::Font::default_bold_font()); + description_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); auto label = GUI::Label::construct(container); - label->set_text_alignment(TextAlignment::CenterRight); + label->set_text_alignment(Gfx::TextAlignment::CenterRight); return label; }; diff --git a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index f14f071336..f6ae6609b1 100644 --- a/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -48,14 +48,14 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent) m_adapter_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields; - net_adapters_fields.empend("name", "Name", TextAlignment::CenterLeft); - net_adapters_fields.empend("class_name", "Class", TextAlignment::CenterLeft); - net_adapters_fields.empend("mac_address", "MAC", TextAlignment::CenterLeft); - net_adapters_fields.empend("ipv4_address", "IPv4", TextAlignment::CenterLeft); - net_adapters_fields.empend("packets_in", "Pkt In", TextAlignment::CenterRight); - net_adapters_fields.empend("packets_out", "Pkt Out", TextAlignment::CenterRight); - net_adapters_fields.empend("bytes_in", "Bytes In", TextAlignment::CenterRight); - net_adapters_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight); + net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("ipv4_address", "IPv4", Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight); m_adapter_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields))); auto sockets_group_box = GUI::GroupBox::construct("Sockets", this); @@ -68,17 +68,17 @@ NetworkStatisticsWidget::NetworkStatisticsWidget(GUI::Widget* parent) m_socket_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> net_tcp_fields; - net_tcp_fields.empend("peer_address", "Peer", TextAlignment::CenterLeft); - net_tcp_fields.empend("peer_port", "Port", TextAlignment::CenterRight); - net_tcp_fields.empend("local_address", "Local", TextAlignment::CenterLeft); - net_tcp_fields.empend("local_port", "Port", TextAlignment::CenterRight); - net_tcp_fields.empend("state", "State", TextAlignment::CenterLeft); - net_tcp_fields.empend("ack_number", "Ack#", TextAlignment::CenterRight); - net_tcp_fields.empend("sequence_number", "Seq#", TextAlignment::CenterRight); - net_tcp_fields.empend("packets_in", "Pkt In", TextAlignment::CenterRight); - net_tcp_fields.empend("packets_out", "Pkt Out", TextAlignment::CenterRight); - net_tcp_fields.empend("bytes_in", "Bytes In", TextAlignment::CenterRight); - net_tcp_fields.empend("bytes_out", "Bytes Out", TextAlignment::CenterRight); + net_tcp_fields.empend("peer_address", "Peer", Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("peer_port", "Port", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("local_address", "Local", Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("local_port", "Port", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("state", "State", Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("ack_number", "Ack#", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("sequence_number", "Seq#", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight); m_socket_table_view->set_model(GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields))); m_update_timer = Core::Timer::construct( diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index 8529a28881..ffebaff7ac 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -38,23 +38,23 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget(GUI::Widget* pare m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields; - pid_fds_fields.empend("fd", "FD", TextAlignment::CenterRight); - pid_fds_fields.empend("class", "Class", TextAlignment::CenterLeft); - pid_fds_fields.empend("offset", "Offset", TextAlignment::CenterRight); - pid_fds_fields.empend("absolute_path", "Path", TextAlignment::CenterLeft); - pid_fds_fields.empend("Access", TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("fd", "FD", Gfx::TextAlignment::CenterRight); + pid_fds_fields.empend("class", "Class", Gfx::TextAlignment::CenterLeft); + pid_fds_fields.empend("offset", "Offset", Gfx::TextAlignment::CenterRight); + pid_fds_fields.empend("absolute_path", "Path", Gfx::TextAlignment::CenterLeft); + pid_fds_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get("seekable").to_bool() ? "Seekable" : "Sequential"; }); - pid_fds_fields.empend("Blocking", TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Blocking", Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get("blocking").to_bool() ? "Blocking" : "Nonblocking"; }); - pid_fds_fields.empend("On exec", TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("On exec", Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get("cloexec").to_bool() ? "Close" : "Keep"; }); - pid_fds_fields.empend("Can read", TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Can read", Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get("can_read").to_bool() ? "Yes" : "No"; }); - pid_fds_fields.empend("Can write", TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Can write", Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get("can_write").to_bool() ? "Yes" : "No"; }); diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index cc41110f78..36bf4046d0 100644 --- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -39,13 +39,13 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GUI::Widget* parent) m_table_view = GUI::TableView::construct(this); m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields; - pid_vm_fields.empend("Address", TextAlignment::CenterLeft, [](auto& object) { + pid_vm_fields.empend("Address", Gfx::TextAlignment::CenterLeft, [](auto& object) { return String::format("%#x", object.get("address").to_u32()); }); - pid_vm_fields.empend("size", "Size", TextAlignment::CenterRight); - pid_vm_fields.empend("amount_resident", "Resident", TextAlignment::CenterRight); - pid_vm_fields.empend("amount_dirty", "Dirty", TextAlignment::CenterRight); - pid_vm_fields.empend("Access", TextAlignment::CenterLeft, [](auto& object) { + pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("amount_dirty", "Dirty", Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) { StringBuilder builder; if (!object.get("user_accessible").to_bool()) builder.append('K'); @@ -61,15 +61,15 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget(GUI::Widget* parent) builder.append('T'); return builder.to_string(); }); - pid_vm_fields.empend("Purgeable", TextAlignment::CenterLeft, [](auto& object) { + pid_vm_fields.empend("Purgeable", Gfx::TextAlignment::CenterLeft, [](auto& object) { if (!object.get("purgeable").to_bool()) return ""; if (object.get("volatile").to_bool()) return "Volatile"; return "Non-volatile"; }); - pid_vm_fields.empend("cow_pages", "# CoW", TextAlignment::CenterRight); - pid_vm_fields.empend("name", "Name", TextAlignment::CenterLeft); + pid_vm_fields.empend("cow_pages", "# CoW", Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft); m_json_model = GUI::JsonArrayModel::create({}, move(pid_vm_fields)); m_table_view->set_model(GUI::SortingProxyModel::create(*m_json_model)); m_table_view->model()->set_key_column_and_sort_order(0, GUI::SortOrder::Ascending); diff --git a/Applications/SystemMonitor/ProcessModel.cpp b/Applications/SystemMonitor/ProcessModel.cpp index 7fb5a7f8d3..e96ab4b27f 100644 --- a/Applications/SystemMonitor/ProcessModel.cpp +++ b/Applications/SystemMonitor/ProcessModel.cpp @@ -46,10 +46,10 @@ ProcessModel::ProcessModel() { ASSERT(!s_the); s_the = this; - m_generic_process_icon = GraphicsBitmap::load_from_file("/res/icons/gear16.png"); - m_high_priority_icon = GraphicsBitmap::load_from_file("/res/icons/highpriority16.png"); - m_low_priority_icon = GraphicsBitmap::load_from_file("/res/icons/lowpriority16.png"); - m_normal_priority_icon = GraphicsBitmap::load_from_file("/res/icons/normalpriority16.png"); + m_generic_process_icon = Gfx::Bitmap::load_from_file("/res/icons/gear16.png"); + m_high_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/highpriority16.png"); + m_low_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/lowpriority16.png"); + m_normal_priority_icon = Gfx::Bitmap::load_from_file("/res/icons/normalpriority16.png"); } ProcessModel::~ProcessModel() @@ -132,59 +132,59 @@ GUI::Model::ColumnMetadata ProcessModel::column_metadata(int column) const { switch (column) { case Column::Icon: - return { 16, TextAlignment::CenterLeft }; + return { 16, Gfx::TextAlignment::CenterLeft }; case Column::PID: - return { 32, TextAlignment::CenterRight }; + return { 32, Gfx::TextAlignment::CenterRight }; case Column::TID: - return { 32, TextAlignment::CenterRight }; + return { 32, Gfx::TextAlignment::CenterRight }; case Column::State: - return { 75, TextAlignment::CenterLeft }; + return { 75, Gfx::TextAlignment::CenterLeft }; case Column::Priority: - return { 16, TextAlignment::CenterRight }; + return { 16, Gfx::TextAlignment::CenterRight }; case Column::EffectivePriority: - return { 16, TextAlignment::CenterRight }; + return { 16, Gfx::TextAlignment::CenterRight }; case Column::User: - return { 50, TextAlignment::CenterLeft }; + return { 50, Gfx::TextAlignment::CenterLeft }; case Column::Virtual: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::Physical: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::DirtyPrivate: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::CleanInode: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::PurgeableVolatile: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::PurgeableNonvolatile: - return { 65, TextAlignment::CenterRight }; + return { 65, Gfx::TextAlignment::CenterRight }; case Column::CPU: - return { 32, TextAlignment::CenterRight }; + return { 32, Gfx::TextAlignment::CenterRight }; case Column::Name: - return { 140, TextAlignment::CenterLeft }; + return { 140, Gfx::TextAlignment::CenterLeft }; case Column::Syscalls: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::InodeFaults: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::ZeroFaults: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::CowFaults: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::FileReadBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::FileWriteBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::UnixSocketReadBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::UnixSocketWriteBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::IPv4SocketReadBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::IPv4SocketWriteBytes: - return { 60, TextAlignment::CenterRight }; + return { 60, Gfx::TextAlignment::CenterRight }; case Column::Pledge: - return { 60, TextAlignment::CenterLeft }; + return { 60, Gfx::TextAlignment::CenterLeft }; case Column::Veil: - return { 60, TextAlignment::CenterLeft }; + return { 60, Gfx::TextAlignment::CenterLeft }; default: ASSERT_NOT_REACHED(); } @@ -269,7 +269,7 @@ GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, Role role) const if (thread.current_state.icon_id != -1) { auto icon_buffer = SharedBuffer::create_from_shared_buffer_id(thread.current_state.icon_id); if (icon_buffer) { - auto icon_bitmap = GraphicsBitmap::create_with_shared_buffer(GraphicsBitmap::Format::RGBA32, *icon_buffer, { 16, 16 }); + auto icon_bitmap = Gfx::Bitmap::create_with_shared_buffer(Gfx::Bitmap::Format::RGBA32, *icon_buffer, { 16, 16 }); if (icon_bitmap) return *icon_bitmap; } diff --git a/Applications/SystemMonitor/ProcessModel.h b/Applications/SystemMonitor/ProcessModel.h index 232670845d..815fefafa9 100644 --- a/Applications/SystemMonitor/ProcessModel.h +++ b/Applications/SystemMonitor/ProcessModel.h @@ -132,10 +132,10 @@ private: HashMap<uid_t, String> m_usernames; HashMap<PidAndTid, NonnullOwnPtr<Thread>> m_threads; Vector<PidAndTid> m_pids; - RefPtr<GraphicsBitmap> m_generic_process_icon; - RefPtr<GraphicsBitmap> m_high_priority_icon; - RefPtr<GraphicsBitmap> m_low_priority_icon; - RefPtr<GraphicsBitmap> m_normal_priority_icon; + RefPtr<Gfx::Bitmap> m_generic_process_icon; + RefPtr<Gfx::Bitmap> m_high_priority_icon; + RefPtr<Gfx::Bitmap> m_low_priority_icon; + RefPtr<Gfx::Bitmap> m_normal_priority_icon; }; namespace AK { diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index 5c713675bc..292495463d 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -38,8 +38,8 @@ ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget(GUI::Widget* parent) m_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields; - pid_unveil_fields.empend("path", "Path", TextAlignment::CenterLeft); - pid_unveil_fields.empend("permissions", "Permissions", TextAlignment::CenterLeft); + pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft); + pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft); m_table_view->set_model(GUI::JsonArrayModel::create({}, move(pid_unveil_fields))); } diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 26ef36f34a..c6e5ec2988 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -152,19 +152,19 @@ int main(int argc, char** argv) memory_stats_widget->refresh(); }, window); - auto kill_action = GUI::Action::create("Kill process", { Mod_Ctrl, Key_K }, GraphicsBitmap::load_from_file("/res/icons/kill16.png"), [process_table_view](const GUI::Action&) { + auto kill_action = GUI::Action::create("Kill process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/kill16.png"), [process_table_view](const GUI::Action&) { pid_t pid = process_table_view->selected_pid(); if (pid != -1) kill(pid, SIGKILL); }); - auto stop_action = GUI::Action::create("Stop process", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/stop16.png"), [process_table_view](const GUI::Action&) { + auto stop_action = GUI::Action::create("Stop process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/stop16.png"), [process_table_view](const GUI::Action&) { pid_t pid = process_table_view->selected_pid(); if (pid != -1) kill(pid, SIGSTOP); }); - auto continue_action = GUI::Action::create("Continue process", { Mod_Ctrl, Key_C }, GraphicsBitmap::load_from_file("/res/icons/continue16.png"), [process_table_view](const GUI::Action&) { + auto continue_action = GUI::Action::create("Continue process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/continue16.png"), [process_table_view](const GUI::Action&) { pid_t pid = process_table_view->selected_pid(); if (pid != -1) kill(pid, SIGCONT); @@ -222,7 +222,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("System Monitor", load_png("/res/icons/32x32/app-system-monitor.png"), window); + GUI::AboutDialog::show("System Monitor", Gfx::load_png("/res/icons/32x32/app-system-monitor.png"), window); })); menubar->add_menu(move(help_menu)); @@ -251,7 +251,7 @@ int main(int argc, char** argv) window->show(); - window->set_icon(load_png("/res/icons/16x16/app-system-monitor.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-system-monitor.png")); return app.exec(); } @@ -260,7 +260,7 @@ class ProgressBarPaintingDelegate final : public GUI::TableCellPaintingDelegate public: virtual ~ProgressBarPaintingDelegate() override {} - virtual void paint(GUI::Painter& painter, const Rect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override + virtual void paint(GUI::Painter& painter, const Gfx::Rect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override { auto rect = a_rect.shrunken(2, 2); auto percentage = model.data(index, GUI::Model::Role::Custom).to_i32(); @@ -269,7 +269,7 @@ public: String text; if (data.is_string()) text = data.as_string(); - StylePainter::paint_progress_bar(painter, rect, palette, 0, 100, percentage, text); + Gfx::StylePainter::paint_progress_bar(painter, rect, palette, 0, 100, percentage, text); painter.draw_rect(rect, Color::Black); } }; @@ -285,11 +285,11 @@ RefPtr<GUI::Widget> build_file_systems_tab() fs_table_view->set_size_columns_to_fit_content(true); Vector<GUI::JsonArrayModel::FieldSpec> df_fields; - df_fields.empend("mount_point", "Mount point", TextAlignment::CenterLeft); - df_fields.empend("class_name", "Class", TextAlignment::CenterLeft); - df_fields.empend("device", "Device", TextAlignment::CenterLeft); + df_fields.empend("mount_point", "Mount point", Gfx::TextAlignment::CenterLeft); + df_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft); + df_fields.empend("device", "Device", Gfx::TextAlignment::CenterLeft); df_fields.empend( - "Size", TextAlignment::CenterRight, + "Size", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { return human_readable_size(object.get("total_block_count").to_u32() * object.get("block_size").to_u32()); }, @@ -297,7 +297,7 @@ RefPtr<GUI::Widget> build_file_systems_tab() return object.get("total_block_count").to_u32() * object.get("block_size").to_u32(); }); df_fields.empend( - "Used", TextAlignment::CenterRight, + "Used", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { auto total_blocks = object.get("total_block_count").to_u32(); auto free_blocks = object.get("free_block_count").to_u32(); @@ -319,17 +319,17 @@ RefPtr<GUI::Widget> build_file_systems_tab() return percentage; }); df_fields.empend( - "Available", TextAlignment::CenterRight, + "Available", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { return human_readable_size(object.get("free_block_count").to_u32() * object.get("block_size").to_u32()); }, [](const JsonObject& object) { return object.get("free_block_count").to_u32() * object.get("block_size").to_u32(); }); - df_fields.empend("Access", TextAlignment::CenterLeft, [](const JsonObject& object) { + df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { return object.get("readonly").to_bool() ? "Read-only" : "Read/Write"; }); - df_fields.empend("Mount flags", TextAlignment::CenterLeft, [](const JsonObject& object) { + df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { int mount_flags = object.get("mount_flags").to_int(); StringBuilder builder; bool first = true; @@ -349,11 +349,11 @@ RefPtr<GUI::Widget> build_file_systems_tab() return String("defaults"); return builder.to_string(); }); - df_fields.empend("free_block_count", "Free blocks", TextAlignment::CenterRight); - df_fields.empend("total_block_count", "Total blocks", TextAlignment::CenterRight); - df_fields.empend("free_inode_count", "Free inodes", TextAlignment::CenterRight); - df_fields.empend("total_inode_count", "Total inodes", TextAlignment::CenterRight); - df_fields.empend("block_size", "Block size", TextAlignment::CenterRight); + df_fields.empend("free_block_count", "Free blocks", Gfx::TextAlignment::CenterRight); + df_fields.empend("total_block_count", "Total blocks", Gfx::TextAlignment::CenterRight); + df_fields.empend("free_inode_count", "Free inodes", Gfx::TextAlignment::CenterRight); + df_fields.empend("total_inode_count", "Total inodes", Gfx::TextAlignment::CenterRight); + df_fields.empend("block_size", "Block size", Gfx::TextAlignment::CenterRight); fs_table_view->set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/df", move(df_fields)))); fs_table_view->set_cell_painting_delegate(3, make<ProgressBarPaintingDelegate>()); @@ -377,7 +377,7 @@ RefPtr<GUI::Widget> build_pci_devices_tab() Vector<GUI::JsonArrayModel::FieldSpec> pci_fields; pci_fields.empend( - "Address", TextAlignment::CenterLeft, + "Address", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) { auto seg = object.get("seg").to_u32(); auto bus = object.get("bus").to_u32(); @@ -386,21 +386,21 @@ RefPtr<GUI::Widget> build_pci_devices_tab() return String::format("%04x:%02x:%02x.%d", seg, bus, slot, function); }); pci_fields.empend( - "Class", TextAlignment::CenterLeft, + "Class", Gfx::TextAlignment::CenterLeft, [db](const JsonObject& object) { auto class_id = object.get("class").to_u32(); String class_name = db->get_class(class_id); return class_name == "" ? String::format("%04x", class_id) : class_name; }); pci_fields.empend( - "Vendor", TextAlignment::CenterLeft, + "Vendor", Gfx::TextAlignment::CenterLeft, [db](const JsonObject& object) { auto vendor_id = object.get("vendor_id").to_u32(); String vendor_name = db->get_vendor(vendor_id); return vendor_name == "" ? String::format("%02x", vendor_id) : vendor_name; }); pci_fields.empend( - "Device", TextAlignment::CenterLeft, + "Device", Gfx::TextAlignment::CenterLeft, [db](const JsonObject& object) { auto vendor_id = object.get("vendor_id").to_u32(); auto device_id = object.get("device_id").to_u32(); @@ -408,7 +408,7 @@ RefPtr<GUI::Widget> build_pci_devices_tab() return device_name == "" ? String::format("%02x", device_id) : device_name; }); pci_fields.empend( - "Revision", TextAlignment::CenterRight, + "Revision", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { auto revision_id = object.get("revision_id").to_u32(); return String::format("%02x", revision_id); diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp index 3049379d8b..af367d16a6 100644 --- a/Applications/Taskbar/TaskbarWindow.cpp +++ b/Applications/Taskbar/TaskbarWindow.cpp @@ -44,7 +44,7 @@ TaskbarWindow::TaskbarWindow() on_screen_rect_change(GUI::Desktop::the().rect()); - GUI::Desktop::the().on_rect_change = [this](const Rect& rect) { on_screen_rect_change(rect); }; + GUI::Desktop::the().on_rect_change = [this](const Gfx::Rect& rect) { on_screen_rect_change(rect); }; auto widget = GUI::Frame::construct(); widget->set_fill_with_background_color(true); @@ -52,8 +52,8 @@ TaskbarWindow::TaskbarWindow() widget->layout()->set_margins({ 3, 2, 3, 2 }); widget->layout()->set_spacing(3); widget->set_frame_thickness(1); - widget->set_frame_shape(FrameShape::Panel); - widget->set_frame_shadow(FrameShadow::Raised); + widget->set_frame_shape(Gfx::FrameShape::Panel); + widget->set_frame_shadow(Gfx::FrameShadow::Raised); set_main_widget(widget); WindowList::the().aid_create_button = [this](auto& identifier) { @@ -75,8 +75,8 @@ void TaskbarWindow::create_quick_launch_bar() quick_launch_bar->layout()->set_spacing(3); quick_launch_bar->layout()->set_margins({ 3, 0, 3, 0 }); quick_launch_bar->set_frame_thickness(1); - quick_launch_bar->set_frame_shape(FrameShape::Container); - quick_launch_bar->set_frame_shadow(FrameShadow::Raised); + quick_launch_bar->set_frame_shape(Gfx::FrameShape::Container); + quick_launch_bar->set_frame_shadow(Gfx::FrameShadow::Raised); int total_width = 6; bool first = true; @@ -96,9 +96,9 @@ void TaskbarWindow::create_quick_launch_bar() auto button = GUI::Button::construct(quick_launch_bar); button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); button->set_preferred_size(22, 22); - button->set_button_style(ButtonStyle::CoolBar); + button->set_button_style(Gfx::ButtonStyle::CoolBar); - button->set_icon(GraphicsBitmap::load_from_file(app_icon_path)); + button->set_icon(Gfx::Bitmap::load_from_file(app_icon_path)); // FIXME: the tooltip ends up outside the screen rect. button->set_tooltip(name); button->on_click = [app_executable](auto&) { @@ -121,7 +121,7 @@ void TaskbarWindow::create_quick_launch_bar() quick_launch_bar->set_preferred_size(total_width, 22); } -void TaskbarWindow::on_screen_rect_change(const Rect& rect) +void TaskbarWindow::on_screen_rect_change(const Gfx::Rect& rect) { Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() }; set_rect(new_rect); @@ -133,7 +133,7 @@ NonnullRefPtr<GUI::Button> TaskbarWindow::create_button(const WindowIdentifier& button->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fixed); button->set_preferred_size(140, 22); button->set_checkable(true); - button->set_text_alignment(TextAlignment::CenterLeft); + button->set_text_alignment(Gfx::TextAlignment::CenterLeft); return button; } @@ -179,7 +179,7 @@ void TaskbarWindow::wm_event(GUI::WMEvent& event) if (auto* window = WindowList::the().window(identifier)) { auto buffer = SharedBuffer::create_from_shared_buffer_id(changed_event.icon_buffer_id()); ASSERT(buffer); - window->button()->set_icon(GraphicsBitmap::create_with_shared_buffer(GraphicsBitmap::Format::RGBA32, *buffer, changed_event.icon_size())); + window->button()->set_icon(Gfx::Bitmap::create_with_shared_buffer(Gfx::Bitmap::Format::RGBA32, *buffer, changed_event.icon_size())); } break; } diff --git a/Applications/Taskbar/TaskbarWindow.h b/Applications/Taskbar/TaskbarWindow.h index 6e42a6ba38..aec46cddfb 100644 --- a/Applications/Taskbar/TaskbarWindow.h +++ b/Applications/Taskbar/TaskbarWindow.h @@ -38,7 +38,7 @@ public: private: void create_quick_launch_bar(); - void on_screen_rect_change(const Rect&); + void on_screen_rect_change(const Gfx::Rect&); NonnullRefPtr<GUI::Button> create_button(const WindowIdentifier&); virtual void wm_event(GUI::WMEvent&) override; diff --git a/Applications/Taskbar/WindowList.h b/Applications/Taskbar/WindowList.h index 5ea89e5916..38ef9e3409 100644 --- a/Applications/Taskbar/WindowList.h +++ b/Applications/Taskbar/WindowList.h @@ -51,7 +51,7 @@ public: void set_title(const String& title) { m_title = title; } Rect rect() const { return m_rect; } - void set_rect(const Rect& rect) { m_rect = rect; } + void set_rect(const Gfx::Rect& rect) { m_rect = rect; } GUI::Button* button() { return m_button; } void set_button(GUI::Button* button) { m_button = button; } @@ -62,14 +62,14 @@ public: void set_minimized(bool minimized) { m_minimized = minimized; } bool is_minimized() const { return m_minimized; } - const GraphicsBitmap* icon() const { return m_icon.ptr(); } + const Gfx::Bitmap* icon() const { return m_icon.ptr(); } private: WindowIdentifier m_identifier; String m_title; - Rect m_rect; + Gfx::Rect m_rect; RefPtr<GUI::Button> m_button; - RefPtr<GraphicsBitmap> m_icon; + RefPtr<Gfx::Bitmap> m_icon; bool m_active { false }; bool m_minimized { false }; }; diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 7a4f31ab45..4db3cdfea5 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -235,7 +235,7 @@ int main(int argc, char** argv) window->move_to(300, 300); terminal->apply_size_increments_to_window(*window); window->show(); - window->set_icon(load_png("/res/icons/16x16/app-terminal.png")); + window->set_icon(Gfx::load_png("/res/icons/16x16/app-terminal.png")); terminal->set_should_beep(config->read_bool_entry("Window", "AudibleBeep", false)); RefPtr<GUI::Window> settings_window; @@ -247,13 +247,13 @@ int main(int argc, char** argv) auto menubar = make<GUI::MenuBar>(); auto app_menu = GUI::Menu::construct("Terminal"); - app_menu->add_action(GUI::Action::create("Open new terminal", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) { + app_menu->add_action(GUI::Action::create("Open new terminal", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-terminal.png"), [&](auto&) { if (!fork()) { execl("/bin/Terminal", "Terminal", nullptr); exit(1); } })); - app_menu->add_action(GUI::Action::create("Settings...", load_png("/res/icons/gear16.png"), + app_menu->add_action(GUI::Action::create("Settings...", Gfx::load_png("/res/icons/gear16.png"), [&](const GUI::Action&) { if (!settings_window) { settings_window = create_settings_window(*terminal); @@ -300,7 +300,7 @@ int main(int argc, char** argv) auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Terminal", load_png("/res/icons/32x32/app-terminal.png"), window); + GUI::AboutDialog::show("Terminal", Gfx::load_png("/res/icons/32x32/app-terminal.png"), window); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/TextEditor/TextEditorWidget.cpp b/Applications/TextEditor/TextEditorWidget.cpp index 32cd3c6b47..45ae429218 100644 --- a/Applications/TextEditor/TextEditorWidget.cpp +++ b/Applications/TextEditor/TextEditorWidget.cpp @@ -243,7 +243,7 @@ TextEditorWidget::TextEditorWidget() m_editor->set_focus(true); }; - m_find_replace_action = GUI::Action::create("Find/Replace...", { Mod_Ctrl, Key_F }, load_png("/res/icons/16x16/find.png"), [this](auto&) { + m_find_replace_action = GUI::Action::create("Find/Replace...", { Mod_Ctrl, Key_F }, Gfx::load_png("/res/icons/16x16/find.png"), [this](auto&) { m_find_replace_widget->set_visible(true); m_find_widget->set_visible(true); m_replace_widget->set_visible(true); @@ -268,7 +268,7 @@ TextEditorWidget::TextEditorWidget() m_statusbar->set_text(builder.to_string()); }; - m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { + m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GUI::Action&) { if (m_document_dirty) { auto save_document_first_box = GUI::MessageBox::construct("Save Document First?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel, window()); auto save_document_first_result = save_document_first_box->exec(); @@ -301,7 +301,7 @@ TextEditorWidget::TextEditorWidget() open_sesame(open_path.value()); }); - m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) { + m_save_as_action = GUI::Action::create("Save as...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [this](const GUI::Action&) { Optional<String> save_path = GUI::FilePicker::get_save_filepath(m_name.is_null() ? "Untitled" : m_name, m_extension.is_null() ? "txt" : m_extension); if (!save_path.has_value()) return; @@ -316,7 +316,7 @@ TextEditorWidget::TextEditorWidget() dbg() << "Wrote document to " << save_path.value(); }); - m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) { + m_save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](const GUI::Action&) { if (!m_path.is_empty()) { if (!m_editor->write_to_file(m_path)) { GUI::MessageBox::show("Unable to save file.\n", "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window()); @@ -384,7 +384,7 @@ TextEditorWidget::TextEditorWidget() auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { - GUI::AboutDialog::show("Text Editor", load_png("/res/icons/32x32/app-texteditor.png"), window()); + GUI::AboutDialog::show("Text Editor", Gfx::load_png("/res/icons/32x32/app-texteditor.png"), window()); })); menubar->add_menu(move(help_menu)); diff --git a/Applications/TextEditor/main.cpp b/Applications/TextEditor/main.cpp index 7b4b82a96b..6f7f94b055 100644 --- a/Applications/TextEditor/main.cpp +++ b/Applications/TextEditor/main.cpp @@ -61,7 +61,7 @@ int main(int argc, char** argv) text_widget->open_sesame(argv[1]); window->show(); - window->set_icon(load_png("/res/icons/TextEditor16.png")); + window->set_icon(Gfx::load_png("/res/icons/TextEditor16.png")); return app.exec(); } diff --git a/Applications/Welcome/TextWidget.cpp b/Applications/Welcome/TextWidget.cpp index c709478e03..97c687fdf1 100644 --- a/Applications/Welcome/TextWidget.cpp +++ b/Applications/Welcome/TextWidget.cpp @@ -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); } } } diff --git a/Applications/Welcome/TextWidget.h b/Applications/Welcome/TextWidget.h index 153067819f..a8876638b7 100644 --- a/Applications/Welcome/TextWidget.h +++ b/Applications/Welcome/TextWidget.h @@ -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 }; }; diff --git a/Applications/Welcome/main.cpp b/Applications/Welcome/main.cpp index 14855d50ac..47231ee1a0 100644 --- a/Applications/Welcome/main.cpp +++ b/Applications/Welcome/main.cpp @@ -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&) { |