From 9ef5cbab9bffae8fc2a39468bea2a263eeadbc36 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sun, 16 Oct 2022 14:38:06 +0300 Subject: [PATCH] change name of box.contains_point and contains_box --- src/Box.cpp | 6 +++--- src/Box.hpp | 6 +++--- src/ListView.cpp | 2 +- src/Widget.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Box.cpp b/src/Box.cpp index a1c581e..c38d91c 100644 --- a/src/Box.cpp +++ b/src/Box.cpp @@ -13,15 +13,15 @@ Box Box::offset(double x, double y) { }; } -bool Box::contains_point(double x, double y) const { +bool Box::contains(double x, double y) const { return x >= m_x && m_x + m_width >= x && y >= m_y && m_y + m_height >= y; } -bool Box::contains_point(const Point &point) const { +bool Box::contains(const Point &point) const { return point.x() >= m_x && m_x + m_width >= point.x() && point.y() >= m_y && m_y + m_height >= point.y(); } -bool Box::contains_box(const Box &other) const { +bool Box::contains(const Box &other) const { double ax1 = m_x; double ax2 = m_x + m_width; double ay1 = m_y; diff --git a/src/Box.hpp b/src/Box.hpp index 12b6ecd..d99c5ca 100644 --- a/src/Box.hpp +++ b/src/Box.hpp @@ -78,9 +78,9 @@ public: void update(); - bool contains_point(double x, double y) const; - bool contains_point(const Point &point) const; - bool contains_box(const Box &other) const; + bool contains(double x, double y) const; + bool contains(const Point &point) const; + bool contains(const Box &other) const; Box offset(double x, double y); Box united(const Box &other); diff --git a/src/ListView.cpp b/src/ListView.cpp index 1a840c6..9c35f4a 100644 --- a/src/ListView.cpp +++ b/src/ListView.cpp @@ -26,7 +26,7 @@ void ListView::set_active_element(unsigned int active_element) { } void ListView::on_mouse_button(MouseButtonEvent &event) { - if (!rect().contains_point(event.point())) { + if (!rect().contains(event.point())) { return; } diff --git a/src/Widget.cpp b/src/Widget.cpp index af165dd..71e55e0 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -134,7 +134,7 @@ void Widget::handle_repaint_rect(RepaintRectEvent &event) { if (!m_did_init || !painter.can_paint()) return; - if (!event.box().contains_box(m_rect)) + if (!event.box().contains(m_rect)) return; // widgets contain their children, thus we don't need to recurse further // using a "group" in cairo reduces flickering @@ -209,7 +209,7 @@ void Widget::handle_relayout_subtree(RelayoutSubtreeEvent &event) { void Widget::handle_mouse_move_event(MouseMoveEvent &event) { bool update_focus_to = true; - if (!m_rect.contains_point(event.point())) { + if (!m_rect.contains(event.point())) { // we just became unfocused update_focus_to = false; } @@ -244,7 +244,7 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) { void Widget::handle_mouse_button_event(MouseButtonEvent &event) { bool update_activation_to = event.was_left_button_pressed(); - if (!m_rect.contains_point(event.point())) { + if (!m_rect.contains(event.point())) { update_activation_to = false; }