]> git.tdb.fi Git - libs/gltk.git/commitdiff
Make some functions const that by all rights should be
authorMikko Rasa <tdb@tdb.fi>
Thu, 19 Nov 2015 09:58:08 +0000 (11:58 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 19 Nov 2015 09:58:08 +0000 (11:58 +0200)
source/container.cpp
source/container.h

index 7c2e3fb4e8c8afb87b1aa41b49972575a27ffa62..b7bd2ad5dc9b06f7eb88c08db4fd90b43356c781 100644 (file)
@@ -90,16 +90,16 @@ list<Widget *> 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<Child *>::iterator i=children.end(); i!=children.begin();)
+       for(list<Child *>::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<Container *>(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;
index bcb3b4ee358537fc6e44ccd40172a4c086d8b89b..2c29e5d881e3615d765648ab8cbf3c9bf8835f1d 100644 (file)
@@ -54,8 +54,8 @@ protected:
        void reposition_child(Widget &, const Part &) const;
 public:
        std::list<Widget *> 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);