diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-06 11:56:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-06 11:56:38 +0100 |
commit | 11580babbfb1b8ae0acab2400f11d905c35642f5 (patch) | |
tree | 3b26fcd4bf7afe9ff92203468ba7cd95e192d55f /DevTools | |
parent | 939a605334a71dd8b7af91cdcbe9047281f7b5b9 (diff) | |
download | serenity-11580babbfb1b8ae0acab2400f11d905c35642f5.zip |
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
Diffstat (limited to 'DevTools')
22 files changed, 87 insertions, 87 deletions
diff --git a/DevTools/HackStudio/CursorTool.cpp b/DevTools/HackStudio/CursorTool.cpp index bb298c6e1d..6f180bb27e 100644 --- a/DevTools/HackStudio/CursorTool.cpp +++ b/DevTools/HackStudio/CursorTool.cpp @@ -150,7 +150,7 @@ void CursorTool::on_keydown(GUI::KeyEvent& event) } } -void CursorTool::set_rubber_band_position(const Point& position) +void CursorTool::set_rubber_band_position(const Gfx::Point& position) { if (m_rubber_band_position == position) return; diff --git a/DevTools/HackStudio/CursorTool.h b/DevTools/HackStudio/CursorTool.h index 2e31951fb3..b001030dd9 100644 --- a/DevTools/HackStudio/CursorTool.h +++ b/DevTools/HackStudio/CursorTool.h @@ -50,14 +50,14 @@ private: virtual void on_keydown(GUI::KeyEvent&) override; virtual void on_second_paint(GUI::Painter&, GUI::PaintEvent&) override; - void set_rubber_band_position(const Point&); - Rect rubber_band_rect() const; + void set_rubber_band_position(const Gfx::Point&); + Gfx::Rect rubber_band_rect() const; - Point m_drag_origin; + Gfx::Point m_drag_origin; HashMap<GUI::Widget*, Point> m_positions_before_drag; bool m_dragging { false }; bool m_rubber_banding { false }; - Point m_rubber_band_origin; - Point m_rubber_band_position; + Gfx::Point m_rubber_band_origin; + Gfx::Point m_rubber_band_position; }; diff --git a/DevTools/HackStudio/Editor.cpp b/DevTools/HackStudio/Editor.cpp index c034f61652..bc86d763fb 100644 --- a/DevTools/HackStudio/Editor.cpp +++ b/DevTools/HackStudio/Editor.cpp @@ -114,7 +114,7 @@ static HashMap<String, String>& man_paths() return paths; } -void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Point& screen_location) +void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Gfx::Point& screen_location) { auto it = man_paths().find(hovered_token); if (it == man_paths().end()) { diff --git a/DevTools/HackStudio/Editor.h b/DevTools/HackStudio/Editor.h index 9c645b16fb..f7d682f555 100644 --- a/DevTools/HackStudio/Editor.h +++ b/DevTools/HackStudio/Editor.h @@ -50,7 +50,7 @@ private: virtual void mousemove_event(GUI::MouseEvent&) override; virtual void cursor_did_change() override; - void show_documentation_tooltip_if_available(const String&, const Point& screen_location); + void show_documentation_tooltip_if_available(const String&, const Gfx::Point& screen_location); void highlight_matching_token_pair(); explicit Editor(GUI::Widget* parent); diff --git a/DevTools/HackStudio/EditorWrapper.cpp b/DevTools/HackStudio/EditorWrapper.cpp index d767b8ea64..8906af276e 100644 --- a/DevTools/HackStudio/EditorWrapper.cpp +++ b/DevTools/HackStudio/EditorWrapper.cpp @@ -46,12 +46,12 @@ EditorWrapper::EditorWrapper(GUI::Widget* parent) label_wrapper->layout()->set_margins({ 2, 0, 2, 0 }); m_filename_label = GUI::Label::construct("(Untitled)", label_wrapper); - m_filename_label->set_text_alignment(TextAlignment::CenterLeft); + m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_filename_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); m_filename_label->set_preferred_size(0, 14); m_cursor_label = GUI::Label::construct("(Cursor)", label_wrapper); - m_cursor_label->set_text_alignment(TextAlignment::CenterRight); + m_cursor_label->set_text_alignment(Gfx::TextAlignment::CenterRight); m_cursor_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); m_cursor_label->set_preferred_size(0, 14); @@ -75,5 +75,5 @@ EditorWrapper::~EditorWrapper() void EditorWrapper::set_editor_has_focus(Badge<Editor>, bool focus) { - m_filename_label->set_font(focus ? Font::default_bold_font() : Font::default_font()); + m_filename_label->set_font(focus ? Gfx::Font::default_bold_font() : Gfx::Font::default_font()); } diff --git a/DevTools/HackStudio/FindInFilesWidget.cpp b/DevTools/HackStudio/FindInFilesWidget.cpp index ad8d04235f..b41acbe376 100644 --- a/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/DevTools/HackStudio/FindInFilesWidget.cpp @@ -92,7 +92,7 @@ public: virtual ColumnMetadata column_metadata(int column) const override { if (column == Column::MatchedText) { - return { 0, TextAlignment::CenterLeft, &Font::default_fixed_width_font() }; + return { 0, Gfx::TextAlignment::CenterLeft, &Gfx::Font::default_fixed_width_font() }; } return {}; } diff --git a/DevTools/HackStudio/FormEditorWidget.cpp b/DevTools/HackStudio/FormEditorWidget.cpp index 97c1502cb4..070f09a169 100644 --- a/DevTools/HackStudio/FormEditorWidget.cpp +++ b/DevTools/HackStudio/FormEditorWidget.cpp @@ -37,8 +37,8 @@ FormEditorWidget::FormEditorWidget(GUI::Widget* parent) set_fill_with_background_color(true); set_background_color(Color::MidGray); - 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); m_form_widget = FormWidget::construct(*this); diff --git a/DevTools/HackStudio/Locator.cpp b/DevTools/HackStudio/Locator.cpp index 847146da31..87ad26cbaa 100644 --- a/DevTools/HackStudio/Locator.cpp +++ b/DevTools/HackStudio/Locator.cpp @@ -33,9 +33,9 @@ extern RefPtr<Project> g_project; extern void open_file(const String&); -static RefPtr<GraphicsBitmap> s_file_icon; -static RefPtr<GraphicsBitmap> s_cplusplus_icon; -static RefPtr<GraphicsBitmap> s_header_icon; +static RefPtr<Gfx::Bitmap> s_file_icon; +static RefPtr<Gfx::Bitmap> s_cplusplus_icon; +static RefPtr<Gfx::Bitmap> s_header_icon; class LocatorSuggestionModel final : public GUI::Model { public: @@ -102,9 +102,9 @@ Locator::Locator(GUI::Widget* parent) : GUI::Widget(parent) { if (!s_cplusplus_icon) { - s_file_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"); - s_cplusplus_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"); - s_header_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-header.png"); + s_file_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"); + s_cplusplus_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"); + s_header_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png"); } set_layout(make<GUI::VBoxLayout>()); diff --git a/DevTools/HackStudio/ProcessStateWidget.cpp b/DevTools/HackStudio/ProcessStateWidget.cpp index 6f7f2ab820..41df94450b 100644 --- a/DevTools/HackStudio/ProcessStateWidget.cpp +++ b/DevTools/HackStudio/ProcessStateWidget.cpp @@ -41,20 +41,20 @@ ProcessStateWidget::ProcessStateWidget(GUI::Widget* parent) set_layout(make<GUI::HBoxLayout>()); auto pid_label_label = GUI::Label::construct("Process:", this); - pid_label_label->set_font(Font::default_bold_font()); + pid_label_label->set_font(Gfx::Font::default_bold_font()); m_pid_label = GUI::Label::construct("", this); auto state_label_label = GUI::Label::construct("State:", this); - state_label_label->set_font(Font::default_bold_font()); + state_label_label->set_font(Gfx::Font::default_bold_font()); m_state_label = GUI::Label::construct("", this); // FIXME: This should show CPU% instead. auto cpu_label_label = GUI::Label::construct("Times scheduled:", this); - cpu_label_label->set_font(Font::default_bold_font()); + cpu_label_label->set_font(Gfx::Font::default_bold_font()); m_cpu_label = GUI::Label::construct("", this); auto memory_label_label = GUI::Label::construct("Memory (resident):", this); - memory_label_label->set_font(Font::default_bold_font()); + memory_label_label->set_font(Gfx::Font::default_bold_font()); m_memory_label = GUI::Label::construct("", this); m_timer = Core::Timer::construct(500, [this] { diff --git a/DevTools/HackStudio/Project.cpp b/DevTools/HackStudio/Project.cpp index 13af7936b2..a83a81d1f2 100644 --- a/DevTools/HackStudio/Project.cpp +++ b/DevTools/HackStudio/Project.cpp @@ -117,7 +117,7 @@ public: if (role == Role::Font) { extern String g_currently_open_file; if (node->name == g_currently_open_file) - return Font::default_bold_font(); + return Gfx::Font::default_bold_font(); return {}; } return {}; @@ -169,11 +169,11 @@ Project::Project(const String& path, Vector<String>&& filenames) { m_name = FileSystemPath(m_path).basename(); - m_file_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png")); - m_cplusplus_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png")); - m_header_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-header.png")); - m_directory_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-folder.png")); - m_project_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png")); + m_file_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png")); + m_cplusplus_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png")); + m_header_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png")); + m_directory_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-folder.png")); + m_project_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png")); for (auto& filename : filenames) { m_files.append(ProjectFile::construct_with_name(filename)); diff --git a/DevTools/HackStudio/WidgetTreeModel.cpp b/DevTools/HackStudio/WidgetTreeModel.cpp index be87bd67d1..4eb52582fc 100644 --- a/DevTools/HackStudio/WidgetTreeModel.cpp +++ b/DevTools/HackStudio/WidgetTreeModel.cpp @@ -32,7 +32,7 @@ WidgetTreeModel::WidgetTreeModel(GUI::Widget& root) : m_root(root) { - m_widget_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png")); + m_widget_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png")); } WidgetTreeModel::~WidgetTreeModel() diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp index 84b7a77f74..71da528cf0 100644 --- a/DevTools/HackStudio/main.cpp +++ b/DevTools/HackStudio/main.cpp @@ -175,7 +175,7 @@ int main(int argc, char** argv) return files; }; - auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) { + auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) { auto input_box = GUI::InputBox::construct("Enter name of new file:", "Add new file to project", g_window); if (input_box->exec() == GUI::InputBox::ExecCancel) return; @@ -193,7 +193,7 @@ int main(int argc, char** argv) open_file(filename); }); - auto add_existing_file_action = GUI::Action::create("Add existing file to project...", GraphicsBitmap::load_from_file("/res/icons/16x16/open.png"), [&](auto&) { + auto add_existing_file_action = GUI::Action::create("Add existing file to project...", Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"), [&](auto&) { auto result = GUI::FilePicker::get_open_filepath("Add existing file to project"); if (!result.has_value()) return; @@ -273,7 +273,7 @@ int main(int argc, char** argv) GUI::ActionGroup tool_actions; tool_actions.set_exclusive(true); - auto cursor_tool_action = GUI::Action::create("Cursor", GraphicsBitmap::load_from_file("/res/icons/widgets/Cursor.png"), [&](auto&) { + auto cursor_tool_action = GUI::Action::create("Cursor", Gfx::Bitmap::load_from_file("/res/icons/widgets/Cursor.png"), [&](auto&) { g_form_editor_widget->set_tool(make<CursorTool>(*g_form_editor_widget)); }); cursor_tool_action->set_checkable(true); @@ -284,7 +284,7 @@ int main(int argc, char** argv) GUI::WidgetClassRegistration::for_each([&](const GUI::WidgetClassRegistration& reg) { auto icon_path = String::format("/res/icons/widgets/%s.png", reg.class_name().characters()); - auto action = GUI::Action::create(reg.class_name(), GraphicsBitmap::load_from_file(icon_path), [®](auto&) { + auto action = GUI::Action::create(reg.class_name(), Gfx::Bitmap::load_from_file(icon_path), [®](auto&) { g_form_editor_widget->set_tool(make<WidgetTool>(*g_form_editor_widget, reg)); auto widget = reg.construct(&g_form_editor_widget->form_widget()); widget->set_relative_rect(30, 30, 30, 30); @@ -310,8 +310,8 @@ int main(int argc, char** argv) wrapper->set_layout(make<GUI::VBoxLayout>()); auto label = GUI::Label::construct(text, wrapper); label->set_fill_with_background_color(true); - label->set_text_alignment(TextAlignment::CenterLeft); - label->set_font(Font::default_bold_font()); + label->set_text_alignment(Gfx::TextAlignment::CenterLeft); + label->set_font(Gfx::Font::default_bold_font()); label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); label->set_preferred_size(0, 16); wrapper->add_child(pane_widget); @@ -395,7 +395,7 @@ int main(int argc, char** argv) update_actions(); }); - auto save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) { + auto save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) { if (g_currently_open_file.is_empty()) return; current_editor().write_to_file(g_currently_open_file); @@ -476,7 +476,7 @@ int main(int argc, char** argv) })); menubar->add_menu(move(edit_menu)); - auto stop_action = GUI::Action::create("Stop", GraphicsBitmap::load_from_file("/res/icons/16x16/stop.png"), [&](auto&) { + auto stop_action = GUI::Action::create("Stop", Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png"), [&](auto&) { terminal_wrapper->kill_running_command(); }); @@ -485,14 +485,14 @@ int main(int argc, char** argv) stop_action->set_enabled(false); }; - auto build_action = GUI::Action::create("Build", { Mod_Ctrl, Key_B }, GraphicsBitmap::load_from_file("/res/icons/16x16/build.png"), [&](auto&) { + auto build_action = GUI::Action::create("Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::load_from_file("/res/icons/16x16/build.png"), [&](auto&) { reveal_action_tab(terminal_wrapper); build(terminal_wrapper); stop_action->set_enabled(true); }); toolbar->add_action(build_action); - auto run_action = GUI::Action::create("Run", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/play.png"), [&](auto&) { + auto run_action = GUI::Action::create("Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"), [&](auto&) { reveal_action_tab(terminal_wrapper); run(terminal_wrapper); stop_action->set_enabled(true); @@ -514,7 +514,7 @@ int main(int argc, char** argv) view_menu->add_action(remove_current_editor_action); menubar->add_menu(move(view_menu)); - auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"); + auto small_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"); auto help_menu = GUI::Menu::construct("Help"); help_menu->add_action(GUI::Action::create("About", [&](auto&) { @@ -550,16 +550,16 @@ void run(TerminalWrapper& wrapper) struct TextStyle { Color color; - const Font* font { nullptr }; + const Gfx::Font* font { nullptr }; }; static TextStyle style_for_token_type(CppToken::Type type) { switch (type) { case CppToken::Type::Keyword: - return { Color::Black, &Font::default_bold_fixed_width_font() }; + return { Color::Black, &Gfx::Font::default_bold_fixed_width_font() }; case CppToken::Type::KnownType: - return { Color::from_rgb(0x929200), &Font::default_bold_fixed_width_font() }; + return { Color::from_rgb(0x929200), &Gfx::Font::default_bold_fixed_width_font() }; case CppToken::Type::Identifier: return { Color::from_rgb(0x000092) }; case CppToken::Type::DoubleQuotedString: diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index f7bf82957b..2b1995c941 100644 --- a/DevTools/IPCCompiler/main.cpp +++ b/DevTools/IPCCompiler/main.cpp @@ -327,7 +327,7 @@ int main(int argc, char** argv) } else if (parameter.type == "Color") { dbg() << " u32 " << parameter.name << "_rgba = 0;"; dbg() << " stream >> " << parameter.name << "_rgba;"; - dbg() << " " << parameter.name << " = Color::from_rgba(" << parameter.name << "_rgba);"; + dbg() << " " << parameter.name << " = Gfx::Color::from_rgba(" << parameter.name << "_rgba);"; } else if (parameter.type == "Size") { dbg() << " int " << parameter.name << "_width = 0;"; dbg() << " stream >> " << parameter.name << "_width;"; diff --git a/DevTools/Inspector/RemoteObjectGraphModel.cpp b/DevTools/Inspector/RemoteObjectGraphModel.cpp index 28a989f54d..3321183b98 100644 --- a/DevTools/Inspector/RemoteObjectGraphModel.cpp +++ b/DevTools/Inspector/RemoteObjectGraphModel.cpp @@ -36,8 +36,8 @@ RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process) : m_process(process) { - m_object_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/inspector-object.png")); - m_window_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/window.png")); + m_object_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/inspector-object.png")); + m_window_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/window.png")); } RemoteObjectGraphModel::~RemoteObjectGraphModel() diff --git a/DevTools/ProfileViewer/ProfileModel.cpp b/DevTools/ProfileViewer/ProfileModel.cpp index ba2b0f99cb..27fe98cb02 100644 --- a/DevTools/ProfileViewer/ProfileModel.cpp +++ b/DevTools/ProfileViewer/ProfileModel.cpp @@ -33,8 +33,8 @@ ProfileModel::ProfileModel(Profile& profile) : m_profile(profile) { - m_user_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png")); - m_kernel_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object-red.png")); + m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png")); + m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png")); } ProfileModel::~ProfileModel() @@ -109,7 +109,7 @@ String ProfileModel::column_name(int column) const GUI::Model::ColumnMetadata ProfileModel::column_metadata(int column) const { if (column == Column::SampleCount) - return ColumnMetadata { 0, TextAlignment::CenterRight }; + return ColumnMetadata { 0, Gfx::TextAlignment::CenterRight }; return {}; } diff --git a/DevTools/ProfileViewer/ProfileTimelineWidget.cpp b/DevTools/ProfileViewer/ProfileTimelineWidget.cpp index 4132217dc3..852bd84256 100644 --- a/DevTools/ProfileViewer/ProfileTimelineWidget.cpp +++ b/DevTools/ProfileViewer/ProfileTimelineWidget.cpp @@ -33,8 +33,8 @@ ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile, GUI::Widget* pare , m_profile(profile) { 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_background_color(Color::White); set_fill_with_background_color(true); set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); diff --git a/DevTools/VisualBuilder/VBForm.cpp b/DevTools/VisualBuilder/VBForm.cpp index 5f88b4b446..00fa9d04d7 100644 --- a/DevTools/VisualBuilder/VBForm.cpp +++ b/DevTools/VisualBuilder/VBForm.cpp @@ -63,13 +63,13 @@ VBForm::VBForm(const String& name, GUI::Widget* parent) widget->gwidget()->move_to_back(); })); m_context_menu->add_separator(); - m_context_menu->add_action(GUI::Action::create("Lay out horizontally", load_png("/res/icons/16x16/layout-horizontally.png"), [this](auto&) { + m_context_menu->add_action(GUI::Action::create("Lay out horizontally", Gfx::load_png("/res/icons/16x16/layout-horizontally.png"), [this](auto&) { if (auto* widget = single_selected_widget()) { dbg() << "Giving " << *widget->gwidget() << " a horizontal box layout"; widget->gwidget()->set_layout(make<GUI::HBoxLayout>()); } })); - m_context_menu->add_action(GUI::Action::create("Lay out vertically", load_png("/res/icons/16x16/layout-vertically.png"), [this](auto&) { + m_context_menu->add_action(GUI::Action::create("Lay out vertically", Gfx::load_png("/res/icons/16x16/layout-vertically.png"), [this](auto&) { if (auto* widget = single_selected_widget()) { dbg() << "Giving " << *widget->gwidget() << " a vertical box layout"; widget->gwidget()->set_layout(make<GUI::VBoxLayout>()); @@ -138,7 +138,7 @@ bool VBForm::is_selected(const VBWidget& widget) const return m_selected_widgets.contains(const_cast<VBWidget*>(&widget)); } -VBWidget* VBForm::widget_at(const Point& position) +VBWidget* VBForm::widget_at(const Gfx::Point& position) { auto result = hit_test(position, GUI::Widget::ShouldRespectGreediness::No); if (!result.widget) diff --git a/DevTools/VisualBuilder/VBForm.h b/DevTools/VisualBuilder/VBForm.h index 4b49908fbb..dba01dbe12 100644 --- a/DevTools/VisualBuilder/VBForm.h +++ b/DevTools/VisualBuilder/VBForm.h @@ -43,7 +43,7 @@ public: void set_name(const String& name) { m_name = name; } bool is_selected(const VBWidget&) const; - VBWidget* widget_at(const Point&); + VBWidget* widget_at(const Gfx::Point&); void set_should_snap_to_grip(bool snap) { m_should_snap_to_grid = snap; } bool should_snap_to_grid() const { return m_should_snap_to_grid; } @@ -83,8 +83,8 @@ private: NonnullRefPtrVector<VBWidget> m_widgets; HashMap<GUI::Widget*, VBWidget*> m_gwidget_map; HashTable<VBWidget*> m_selected_widgets; - Point m_transform_event_origin; - Point m_next_insertion_position; + Gfx::Point m_transform_event_origin; + Gfx::Point m_next_insertion_position; Direction m_resize_direction { Direction::None }; Direction m_mouse_direction_type { Direction::None }; RefPtr<GUI::Menu> m_context_menu; diff --git a/DevTools/VisualBuilder/VBWidget.cpp b/DevTools/VisualBuilder/VBWidget.cpp index 3cac9cc6da..93cce9648b 100644 --- a/DevTools/VisualBuilder/VBWidget.cpp +++ b/DevTools/VisualBuilder/VBWidget.cpp @@ -64,7 +64,7 @@ Rect VBWidget::rect() const return m_gwidget->window_relative_rect(); } -void VBWidget::set_rect(const Rect& rect) +void VBWidget::set_rect(const Gfx::Rect& rect) { if (rect == m_gwidget->window_relative_rect()) return; @@ -106,7 +106,7 @@ Rect VBWidget::grabber_rect(Direction direction) const } } -Direction VBWidget::grabber_at(const Point& position) const +Direction VBWidget::grabber_at(const Gfx::Point& position) const { Direction found_grabber = Direction::None; for_each_direction([&](Direction direction) { diff --git a/DevTools/VisualBuilder/VBWidget.h b/DevTools/VisualBuilder/VBWidget.h index 1187016187..48bee7f478 100644 --- a/DevTools/VisualBuilder/VBWidget.h +++ b/DevTools/VisualBuilder/VBWidget.h @@ -80,10 +80,10 @@ public: bool is_selected() const; Rect rect() const; - void set_rect(const Rect&); + void set_rect(const Gfx::Rect&); Rect grabber_rect(Direction) const; - Direction grabber_at(const Point&) const; + Direction grabber_at(const Gfx::Point&) const; GUI::Widget* gwidget() { return m_gwidget; } @@ -113,5 +113,5 @@ private: RefPtr<GUI::Widget> m_gwidget; NonnullOwnPtrVector<VBProperty> m_properties; NonnullRefPtr<VBWidgetPropertyModel> m_property_model; - Rect m_transform_origin_rect; + Gfx::Rect m_transform_origin_rect; }; diff --git a/DevTools/VisualBuilder/VBWidgetPropertyModel.cpp b/DevTools/VisualBuilder/VBWidgetPropertyModel.cpp index 4f366ceff5..8acb441694 100644 --- a/DevTools/VisualBuilder/VBWidgetPropertyModel.cpp +++ b/DevTools/VisualBuilder/VBWidgetPropertyModel.cpp @@ -61,8 +61,8 @@ GUI::Model::ColumnMetadata VBWidgetPropertyModel::column_metadata(int column) co { UNUSED_PARAM(column); if (column == Column::Name) - return { 110, TextAlignment::CenterLeft, &Font::default_bold_font() }; - return { 90, TextAlignment::CenterLeft }; + return { 110, Gfx::TextAlignment::CenterLeft, &Gfx::Font::default_bold_font() }; + return { 90, Gfx::TextAlignment::CenterLeft }; } GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, Role role) const diff --git a/DevTools/VisualBuilder/main.cpp b/DevTools/VisualBuilder/main.cpp index 10d707dee8..421de868af 100644 --- a/DevTools/VisualBuilder/main.cpp +++ b/DevTools/VisualBuilder/main.cpp @@ -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("Visual Builder", load_png("/res/icons/32x32/app-visual-builder.png"), window); + GUI::AboutDialog::show("Visual Builder", Gfx::load_png("/res/icons/32x32/app-visual-builder.png"), window); })); menubar->add_menu(move(help_menu)); @@ -113,82 +113,82 @@ RefPtr<GUI::Window> make_toolbox_window() window->set_main_widget(widget); auto label_button = GUI::Button::construct(widget); - label_button->set_button_style(ButtonStyle::CoolBar); + label_button->set_button_style(Gfx::ButtonStyle::CoolBar); label_button->set_tooltip("GLabel"); - label_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/label.png")); + label_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png")); label_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GLabel); }; auto button_button = GUI::Button::construct(widget); - button_button->set_button_style(ButtonStyle::CoolBar); + button_button->set_button_style(Gfx::ButtonStyle::CoolBar); button_button->set_tooltip("GButton"); - button_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/button.png")); + button_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png")); button_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GButton); }; auto spinbox_button = GUI::Button::construct(widget); - spinbox_button->set_button_style(ButtonStyle::CoolBar); + spinbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); spinbox_button->set_tooltip("GSpinBox"); - spinbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/spinbox.png")); + spinbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png")); spinbox_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GSpinBox); }; auto editor_button = GUI::Button::construct(widget); - editor_button->set_button_style(ButtonStyle::CoolBar); + editor_button->set_button_style(Gfx::ButtonStyle::CoolBar); editor_button->set_tooltip("GTextEditor"); - editor_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/textbox.png")); + editor_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png")); editor_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GTextEditor); }; auto progress_bar_button = GUI::Button::construct(widget); - progress_bar_button->set_button_style(ButtonStyle::CoolBar); + progress_bar_button->set_button_style(Gfx::ButtonStyle::CoolBar); progress_bar_button->set_tooltip("GProgressBar"); - progress_bar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/progressbar.png")); + progress_bar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png")); progress_bar_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GProgressBar); }; auto slider_button = GUI::Button::construct(widget); - slider_button->set_button_style(ButtonStyle::CoolBar); + slider_button->set_button_style(Gfx::ButtonStyle::CoolBar); slider_button->set_tooltip("GSlider"); - slider_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/slider.png")); + slider_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png")); slider_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GSlider); }; auto checkbox_button = GUI::Button::construct(widget); - checkbox_button->set_button_style(ButtonStyle::CoolBar); + checkbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); checkbox_button->set_tooltip("GCheckBox"); - checkbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/checkbox.png")); + checkbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png")); checkbox_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GCheckBox); }; auto radiobutton_button = GUI::Button::construct(widget); - radiobutton_button->set_button_style(ButtonStyle::CoolBar); + radiobutton_button->set_button_style(Gfx::ButtonStyle::CoolBar); radiobutton_button->set_tooltip("GRadioButton"); - radiobutton_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/filled-radio-circle.png")); + radiobutton_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png")); radiobutton_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GRadioButton); }; auto scrollbar_button = GUI::Button::construct(widget); - scrollbar_button->set_button_style(ButtonStyle::CoolBar); + scrollbar_button->set_button_style(Gfx::ButtonStyle::CoolBar); scrollbar_button->set_tooltip("GScrollBar"); - scrollbar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png")); + scrollbar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png")); scrollbar_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GScrollBar); }; auto groupbox_button = GUI::Button::construct(widget); - groupbox_button->set_button_style(ButtonStyle::CoolBar); + groupbox_button->set_button_style(Gfx::ButtonStyle::CoolBar); groupbox_button->set_tooltip("GGroupBox"); - groupbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/groupbox.png")); + groupbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png")); groupbox_button->on_click = [](GUI::Button&) { if (auto* form = VBForm::current()) form->insert_widget(VBWidgetType::GGroupBox); |