change name of box.contains_point and contains_box
This commit is contained in:
parent
7cd8169622
commit
9ef5cbab9b
4 changed files with 10 additions and 10 deletions
|
@ -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;
|
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();
|
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 ax1 = m_x;
|
||||||
double ax2 = m_x + m_width;
|
double ax2 = m_x + m_width;
|
||||||
double ay1 = m_y;
|
double ay1 = m_y;
|
||||||
|
|
|
@ -78,9 +78,9 @@ public:
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
bool contains_point(double x, double y) const;
|
bool contains(double x, double y) const;
|
||||||
bool contains_point(const Point &point) const;
|
bool contains(const Point &point) const;
|
||||||
bool contains_box(const Box &other) const;
|
bool contains(const Box &other) const;
|
||||||
|
|
||||||
Box offset(double x, double y);
|
Box offset(double x, double y);
|
||||||
Box united(const Box &other);
|
Box united(const Box &other);
|
||||||
|
|
|
@ -26,7 +26,7 @@ void ListView::set_active_element(unsigned int active_element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::on_mouse_button(MouseButtonEvent &event) {
|
void ListView::on_mouse_button(MouseButtonEvent &event) {
|
||||||
if (!rect().contains_point(event.point())) {
|
if (!rect().contains(event.point())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ void Widget::handle_repaint_rect(RepaintRectEvent &event) {
|
||||||
if (!m_did_init || !painter.can_paint())
|
if (!m_did_init || !painter.can_paint())
|
||||||
return;
|
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
|
return; // widgets contain their children, thus we don't need to recurse further
|
||||||
|
|
||||||
// using a "group" in cairo reduces flickering
|
// 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) {
|
void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
|
||||||
bool update_focus_to = true;
|
bool update_focus_to = true;
|
||||||
if (!m_rect.contains_point(event.point())) {
|
if (!m_rect.contains(event.point())) {
|
||||||
// we just became unfocused
|
// we just became unfocused
|
||||||
update_focus_to = false;
|
update_focus_to = false;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
|
||||||
void Widget::handle_mouse_button_event(MouseButtonEvent &event) {
|
void Widget::handle_mouse_button_event(MouseButtonEvent &event) {
|
||||||
bool update_activation_to = event.was_left_button_pressed();
|
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;
|
update_activation_to = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue