mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename the library to LibGfx. :^)
This commit is contained in:
parent
939a605334
commit
11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue