1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +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

@ -88,7 +88,7 @@ void VBForm::insert_widget(VBWidgetType type)
{
auto* insertion_parent = single_selected_widget();
auto widget = VBWidget::create(type, *this, insertion_parent);
Gfx::Point insertion_position = m_next_insertion_position;
Gfx::IntPoint insertion_position = m_next_insertion_position;
if (insertion_parent)
insertion_position.move_by(insertion_parent->gwidget()->window_relative_rect().location());
widget->set_rect({ insertion_position, { m_grid_size * 10 + 1, m_grid_size * 5 + 1 } });
@ -136,7 +136,7 @@ bool VBForm::is_selected(const VBWidget& widget) const
return m_selected_widgets.contains(const_cast<VBWidget*>(&widget));
}
VBWidget* VBForm::widget_at(const Gfx::Point& position)
VBWidget* VBForm::widget_at(const Gfx::IntPoint& position)
{
auto result = hit_test(position, GUI::Widget::ShouldRespectGreediness::No);
if (!result.widget)
@ -354,7 +354,7 @@ void VBForm::mousemove_event(GUI::MouseEvent& event)
if (widget.is_in_layout())
return;
auto new_rect = widget.transform_origin_rect();
Gfx::Size minimum_size { 5, 5 };
Gfx::IntSize minimum_size { 5, 5 };
new_rect.set_x(new_rect.x() + change_x);
new_rect.set_y(new_rect.y() + change_y);
new_rect.set_width(max(minimum_size.width(), new_rect.width() + change_w));

View file

@ -43,7 +43,7 @@ public:
void set_name(const String& name) { m_name = name; }
bool is_selected(const VBWidget&) const;
VBWidget* widget_at(const Gfx::Point&);
VBWidget* widget_at(const Gfx::IntPoint&);
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; }
@ -85,8 +85,8 @@ private:
NonnullRefPtrVector<VBWidget> m_widgets;
HashMap<GUI::Widget*, VBWidget*> m_gwidget_map;
HashTable<VBWidget*> m_selected_widgets;
Gfx::Point m_transform_event_origin;
Gfx::Point m_next_insertion_position;
Gfx::IntPoint m_transform_event_origin;
Gfx::IntPoint m_next_insertion_position;
Direction m_resize_direction { Direction::None };
Direction m_mouse_direction_type { Direction::None };
RefPtr<GUI::Menu> m_context_menu;

View file

@ -59,12 +59,12 @@ VBWidget::~VBWidget()
m_gwidget->parent()->remove_child(*m_gwidget);
}
Gfx::Rect VBWidget::rect() const
Gfx::IntRect VBWidget::rect() const
{
return m_gwidget->window_relative_rect();
}
void VBWidget::set_rect(const Gfx::Rect& rect)
void VBWidget::set_rect(const Gfx::IntRect& rect)
{
if (rect == m_gwidget->window_relative_rect())
return;
@ -80,7 +80,7 @@ bool VBWidget::is_selected() const
return m_form.is_selected(*this);
}
Gfx::Rect VBWidget::grabber_rect(Direction direction) const
Gfx::IntRect VBWidget::grabber_rect(Direction direction) const
{
int grabber_size = 5;
int half_grabber_size = grabber_size / 2;
@ -106,7 +106,7 @@ Gfx::Rect VBWidget::grabber_rect(Direction direction) const
}
}
Direction VBWidget::grabber_at(const Gfx::Point& position) const
Direction VBWidget::grabber_at(const Gfx::IntPoint& position) const
{
Direction found_grabber = Direction::None;
for_each_direction([&](Direction direction) {

View file

@ -74,11 +74,11 @@ public:
bool is_selected() const;
Gfx::Rect rect() const;
void set_rect(const Gfx::Rect&);
Gfx::IntRect rect() const;
void set_rect(const Gfx::IntRect&);
Gfx::Rect grabber_rect(Direction) const;
Direction grabber_at(const Gfx::Point&) const;
Gfx::IntRect grabber_rect(Direction) const;
Direction grabber_at(const Gfx::IntPoint&) const;
GUI::Widget* gwidget() { return m_gwidget; }
@ -93,7 +93,7 @@ public:
void property_did_change();
Gfx::Rect transform_origin_rect() const { return m_transform_origin_rect; }
Gfx::IntRect transform_origin_rect() const { return m_transform_origin_rect; }
void capture_transform_origin_rect();
bool is_in_layout() const;
@ -108,5 +108,5 @@ private:
RefPtr<GUI::Widget> m_gwidget;
NonnullOwnPtrVector<VBProperty> m_properties;
NonnullRefPtr<VBWidgetPropertyModel> m_property_model;
Gfx::Rect m_transform_origin_rect;
Gfx::IntRect m_transform_origin_rect;
};