From 36fced66c1ea8962e148ebddc0e021a8aedfc310 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 19 Nov 2015 11:58:08 +0200 Subject: [PATCH] Make some functions const that by all rights should be --- source/container.cpp | 8 ++++---- source/container.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/container.cpp b/source/container.cpp index 7c2e3fb..b7bd2ad 100644 --- a/source/container.cpp +++ b/source/container.cpp @@ -90,16 +90,16 @@ list Container::get_children() const return result; } -Widget *Container::get_child_at(int x, int y) +Widget *Container::get_child_at(int x, int y) const { - for(list::iterator i=children.end(); i!=children.begin();) + for(list::const_iterator i=children.end(); i!=children.begin();) if((*--i)->widget->is_visible() && (*i)->widget->get_geometry().is_inside(x, y)) return (*i)->widget; return 0; } -Widget *Container::get_descendant_at(int x, int y) +Widget *Container::get_descendant_at(int x, int y) const { Widget *wdg = get_child_at(x, y); if(Container *cont = dynamic_cast(wdg)) @@ -212,7 +212,7 @@ void Container::pointer_motion(int x, int y) } } -Widget *Container::get_pointer_target(int x, int y) +Widget *Container::get_pointer_target(int x, int y) const { if(pointer_grabbed) return pointer_focus; diff --git a/source/container.h b/source/container.h index bcb3b4e..2c29e5d 100644 --- a/source/container.h +++ b/source/container.h @@ -54,8 +54,8 @@ protected: void reposition_child(Widget &, const Part &) const; public: std::list get_children() const; - Widget *get_child_at(int, int); - Widget *get_descendant_at(int, int); + Widget *get_child_at(int, int) const; + Widget *get_descendant_at(int, int) const; void raise(Widget &); protected: @@ -69,7 +69,7 @@ public: virtual void button_release(int, int, unsigned); virtual void pointer_motion(int, int); private: - Widget *get_pointer_target(int, int); + Widget *get_pointer_target(int, int) const; public: virtual void pointer_leave(); virtual void key_press(unsigned, unsigned); -- 2.45.2