1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:47:34 +00:00

LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize

This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
This commit is contained in:
Andreas Kling 2020-06-10 10:57:59 +02:00
parent 656b01eb0f
commit 116cf92156
212 changed files with 1144 additions and 1144 deletions

View file

@ -57,13 +57,13 @@ void TaskbarButton::resize_event(GUI::ResizeEvent& event)
return GUI::Button::resize_event(event);
}
static void paint_custom_progress_bar(GUI::Painter& painter, const Gfx::Rect& rect, const Gfx::Rect& text_rect, const Palette& palette, int min, int max, int value, const StringView& text, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
static void paint_custom_progress_bar(GUI::Painter& painter, const Gfx::IntRect& rect, const Gfx::IntRect& text_rect, const Palette& palette, int min, int max, int value, const StringView& text, const Gfx::Font& font, Gfx::TextAlignment text_alignment)
{
float range_size = max - min;
float progress = (value - min) / range_size;
float progress_width = progress * rect.width();
Gfx::Rect progress_rect { rect.x(), rect.y(), (int)progress_width, rect.height() };
Gfx::IntRect progress_rect { rect.x(), rect.y(), (int)progress_width, rect.height() };
{
Gfx::PainterStateSaver saver(painter);
@ -79,7 +79,7 @@ static void paint_custom_progress_bar(GUI::Painter& painter, const Gfx::Rect& re
}
}
Gfx::Rect hole_rect { (int)progress_width, 0, (int)(rect.width() - progress_width), rect.height() };
Gfx::IntRect hole_rect { (int)progress_width, 0, (int)(rect.width() - progress_width), rect.height() };
hole_rect.move_by(rect.location());
hole_rect.set_right_without_resize(rect.right());
Gfx::PainterStateSaver saver(painter);
@ -115,7 +115,7 @@ void TaskbarButton::paint_event(GUI::PaintEvent& event)
content_rect.set_width(content_rect.width() - icon.width() - 4);
}
Gfx::Rect text_rect { 0, 0, font.width(text()), font.glyph_height() };
Gfx::IntRect text_rect { 0, 0, font.width(text()), font.glyph_height() };
if (text_rect.width() > content_rect.width())
text_rect.set_width(content_rect.width());
text_rect.align_within(content_rect, text_alignment());

View file

@ -65,7 +65,7 @@ TaskbarWindow::TaskbarWindow()
on_screen_rect_change(GUI::Desktop::the().rect());
GUI::Desktop::the().on_rect_change = [this](const Gfx::Rect& rect) { on_screen_rect_change(rect); };
GUI::Desktop::the().on_rect_change = [this](const Gfx::IntRect& rect) { on_screen_rect_change(rect); };
auto& widget = set_main_widget<TaskbarWidget>();
widget.set_layout<GUI::HorizontalBoxLayout>();
@ -140,9 +140,9 @@ void TaskbarWindow::create_quick_launch_bar()
quick_launch_bar.set_preferred_size(total_width, 22);
}
void TaskbarWindow::on_screen_rect_change(const Gfx::Rect& rect)
void TaskbarWindow::on_screen_rect_change(const Gfx::IntRect& rect)
{
Gfx::Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() };
Gfx::IntRect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() };
set_rect(new_rect);
}

View file

@ -40,7 +40,7 @@ public:
private:
void create_quick_launch_bar();
void on_screen_rect_change(const Gfx::Rect&);
void on_screen_rect_change(const Gfx::IntRect&);
NonnullRefPtr<GUI::Button> create_button(const WindowIdentifier&);
virtual void wm_event(GUI::WMEvent&) override;

View file

@ -50,8 +50,8 @@ public:
String title() const { return m_title; }
void set_title(const String& title) { m_title = title; }
Gfx::Rect rect() const { return m_rect; }
void set_rect(const Gfx::Rect& rect) { m_rect = rect; }
Gfx::IntRect rect() const { return m_rect; }
void set_rect(const Gfx::IntRect& rect) { m_rect = rect; }
GUI::Button* button() { return m_button; }
void set_button(GUI::Button* button) { m_button = button; }
@ -77,7 +77,7 @@ public:
private:
WindowIdentifier m_identifier;
String m_title;
Gfx::Rect m_rect;
Gfx::IntRect m_rect;
RefPtr<GUI::Button> m_button;
RefPtr<Gfx::Bitmap> m_icon;
bool m_active { false };