mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibGfx: Unpublish Gfx::Point from global namespace
This commit is contained in:
parent
20cfd2a6bf
commit
9b87843af1
34 changed files with 51 additions and 53 deletions
|
@ -545,7 +545,7 @@ Gfx::Rect AbstractTableView::row_rect(int item_index) const
|
|||
return { 0, header_height() + (item_index * item_height()), max(content_size().width(), width()), item_height() };
|
||||
}
|
||||
|
||||
Point AbstractTableView::adjusted_position(const Gfx::Point& position) const
|
||||
Gfx::Point AbstractTableView::adjusted_position(const Gfx::Point& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
int horizontal_padding() const { return m_horizontal_padding; }
|
||||
|
||||
Point adjusted_position(const Gfx::Point&) const;
|
||||
Gfx::Point adjusted_position(const Gfx::Point&) const;
|
||||
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const override;
|
||||
Gfx::Rect content_rect(int row, int column) const;
|
||||
|
|
|
@ -140,7 +140,7 @@ void Application::show_tooltip(const StringView& tooltip, const Gfx::Point& scre
|
|||
Gfx::Rect desktop_rect = Desktop::the().rect();
|
||||
|
||||
const int margin = 30;
|
||||
Point adjusted_pos = screen_location;
|
||||
Gfx::Point adjusted_pos = screen_location;
|
||||
if (adjusted_pos.x() + m_tooltip_window->width() >= desktop_rect.width() - margin) {
|
||||
adjusted_pos = adjusted_pos.translated(-m_tooltip_window->width(), 0);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void Button::paint_event(PaintEvent& event)
|
|||
return;
|
||||
|
||||
auto content_rect = rect().shrunken(8, 2);
|
||||
auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Point();
|
||||
auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Gfx::Point();
|
||||
if (m_icon && !text().is_empty())
|
||||
icon_location.set_x(content_rect.x());
|
||||
if (is_being_pressed() || is_checked())
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Point position() const { return m_position; }
|
||||
Gfx::Point position() const { return m_position; }
|
||||
int x() const { return m_position.x(); }
|
||||
int y() const { return m_position.y(); }
|
||||
MouseButton button() const { return m_button; }
|
||||
|
|
|
@ -99,7 +99,7 @@ ModelIndex ListView::index_at_event_position(const Gfx::Point& point) const
|
|||
return {};
|
||||
}
|
||||
|
||||
Point ListView::adjusted_position(const Gfx::Point& position) const
|
||||
Gfx::Point ListView::adjusted_position(const Gfx::Point& position) const
|
||||
{
|
||||
return position.translated(horizontal_scrollbar().value() - frame_thickness(), vertical_scrollbar().value() - frame_thickness());
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
void scroll_into_view(const ModelIndex&, Orientation);
|
||||
|
||||
Point adjusted_position(const Gfx::Point&) const;
|
||||
Gfx::Point adjusted_position(const Gfx::Point&) const;
|
||||
|
||||
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
|
||||
virtual Gfx::Rect content_rect(const ModelIndex&) const override;
|
||||
|
|
|
@ -209,7 +209,7 @@ Gfx::Rect ScrollableWidget::widget_inner_rect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
Point ScrollableWidget::to_content_position(const Gfx::Point& widget_position) const
|
||||
Gfx::Point ScrollableWidget::to_content_position(const Gfx::Point& widget_position) const
|
||||
{
|
||||
auto content_position = widget_position;
|
||||
content_position.move_by(horizontal_scrollbar().value(), vertical_scrollbar().value());
|
||||
|
@ -217,7 +217,7 @@ Point ScrollableWidget::to_content_position(const Gfx::Point& widget_position) c
|
|||
return content_position;
|
||||
}
|
||||
|
||||
Point ScrollableWidget::to_widget_position(const Gfx::Point& content_position) const
|
||||
Gfx::Point ScrollableWidget::to_widget_position(const Gfx::Point& content_position) const
|
||||
{
|
||||
auto widget_position = content_position;
|
||||
widget_position.move_by(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
|
||||
|
|
|
@ -69,8 +69,8 @@ public:
|
|||
void set_should_hide_unnecessary_scrollbars(bool b) { m_should_hide_unnecessary_scrollbars = b; }
|
||||
bool should_hide_unnecessary_scrollbars() const { return m_should_hide_unnecessary_scrollbars; }
|
||||
|
||||
Point to_content_position(const Gfx::Point& widget_position) const;
|
||||
Point to_widget_position(const Gfx::Point& content_position) const;
|
||||
Gfx::Point to_content_position(const Gfx::Point& widget_position) const;
|
||||
Gfx::Point to_widget_position(const Gfx::Point& content_position) const;
|
||||
|
||||
protected:
|
||||
explicit ScrollableWidget(Widget* parent);
|
||||
|
|
|
@ -281,16 +281,16 @@ void TreeView::paint_event(PaintEvent& event)
|
|||
for (int i = indent_level; i > 0; --i) {
|
||||
auto parent_of_index_at_indent = index_at_indent.parent();
|
||||
bool index_at_indent_is_last_in_parent = index_at_indent.row() == model.row_count(parent_of_index_at_indent) - 1;
|
||||
Point a { tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * i - icon_size() / 2, rect.y() - 2 };
|
||||
Point b { a.x(), a.y() + item_height() - 1 };
|
||||
Gfx::Point a { tree_column_x_offset + horizontal_padding() + indent_width_in_pixels() * i - icon_size() / 2, rect.y() - 2 };
|
||||
Gfx::Point b { a.x(), a.y() + item_height() - 1 };
|
||||
if (index_at_indent_is_last_in_parent)
|
||||
b.set_y(rect.center().y());
|
||||
if (!(i != indent_level && index_at_indent_is_last_in_parent))
|
||||
painter.draw_line(a, b, Color::MidGray);
|
||||
|
||||
if (i == indent_level) {
|
||||
Point c { a.x(), rect.center().y() };
|
||||
Point d { c.x() + icon_size() / 2, c.y() };
|
||||
Gfx::Point c { a.x(), rect.center().y() };
|
||||
Gfx::Point d { c.x() + icon_size() / 2, c.y() };
|
||||
painter.draw_line(c, d, Color::MidGray);
|
||||
}
|
||||
index_at_indent = parent_of_index_at_indent;
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
return m_value.as_float;
|
||||
}
|
||||
|
||||
Point as_point() const
|
||||
Gfx::Point as_point() const
|
||||
{
|
||||
return { m_value.as_point.x, m_value.as_point.y };
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public:
|
|||
virtual void second_paint_event(PaintEvent&);
|
||||
|
||||
Gfx::Rect relative_rect() const { return m_relative_rect; }
|
||||
Point relative_position() const { return m_relative_rect.location(); }
|
||||
Gfx::Point relative_position() const { return m_relative_rect.location(); }
|
||||
|
||||
Gfx::Rect window_relative_rect() const;
|
||||
Gfx::Rect screen_relative_rect() const;
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
Yes };
|
||||
struct HitTestResult {
|
||||
Widget* widget { nullptr };
|
||||
Point local_position;
|
||||
Gfx::Point local_position;
|
||||
};
|
||||
HitTestResult hit_test(const Gfx::Point&, ShouldRespectGreediness = ShouldRespectGreediness::Yes);
|
||||
Widget* child_at(const Gfx::Point&) const;
|
||||
|
|
|
@ -197,14 +197,14 @@ void Window::event(Core::Event& event)
|
|||
auto& mouse_event = static_cast<MouseEvent&>(event);
|
||||
if (m_global_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_global_cursor_tracking_widget->window_relative_rect();
|
||||
Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
Gfx::Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
|
||||
m_global_cursor_tracking_widget->dispatch_event(*local_event, this);
|
||||
return;
|
||||
}
|
||||
if (m_automatic_cursor_tracking_widget) {
|
||||
auto window_relative_rect = m_automatic_cursor_tracking_widget->window_relative_rect();
|
||||
Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
Gfx::Point local_point { mouse_event.x() - window_relative_rect.x(), mouse_event.y() - window_relative_rect.y() };
|
||||
auto local_event = make<MouseEvent>((Event::Type)event.type(), local_point, mouse_event.buttons(), mouse_event.button(), mouse_event.modifiers(), mouse_event.wheel_delta());
|
||||
m_automatic_cursor_tracking_widget->dispatch_event(*local_event, this);
|
||||
if (mouse_event.buttons() == 0)
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
void set_rect(const Gfx::Rect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
|
||||
Point position() const { return rect().location(); }
|
||||
Gfx::Point position() const { return rect().location(); }
|
||||
|
||||
void move_to(int x, int y) { move_to({ x, y }); }
|
||||
void move_to(const Gfx::Point& point) { set_rect({ point, size() }); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue