]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/container.cpp
Rename some get functions as find because they can return null
[libs/gltk.git] / source / container.cpp
index 4f4d2a370152fe6fda3b05c2e65de7d92d59ef35..393973cc2ab7293adcd32c3e939442780e0ff23e 100644 (file)
@@ -86,7 +86,7 @@ list<Widget *> Container::get_children() const
        return result;
 }
 
-Widget *Container::get_child_at(int x, int y) const
+Widget *Container::find_child_at(int x, int y) const
 {
        for(auto i=children.end(); i!=children.begin();)
                if((*--i)->widget->is_visible() && (*i)->widget->get_geometry().is_inside(x, y))
@@ -95,13 +95,13 @@ Widget *Container::get_child_at(int x, int y) const
        return nullptr;
 }
 
-Widget *Container::get_descendant_at(int x, int y) const
+Widget *Container::find_descendant_at(int x, int y) const
 {
-       Widget *wdg = get_child_at(x, y);
+       Widget *wdg = find_child_at(x, y);
        if(Container *cont = dynamic_cast<Container *>(wdg))
        {
                const Geometry &cgeom = wdg->get_geometry();
-               Widget *wdg2 = cont->get_descendant_at(x-cgeom.x, y-cgeom.y);
+               Widget *wdg2 = cont->find_descendant_at(x-cgeom.x, y-cgeom.y);
                if(wdg2)
                        return wdg2;
        }
@@ -211,7 +211,7 @@ void Container::button_release(int x, int y, unsigned btn)
                {
                        click_focus = nullptr;
                        if(!pointer_focus)
-                               set_pointer_focus(get_child_at(x, y));
+                               set_pointer_focus(find_child_at(x, y));
                }
 
                const Geometry &cgeom = child->get_geometry();
@@ -242,7 +242,7 @@ Widget *Container::get_pointer_target(int x, int y, bool touch) const
                return touch_focus;
        else
        {
-               Widget *child = get_child_at(x, y);
+               Widget *child = find_child_at(x, y);
                if(child && child->is_enabled())
                        return child;
                else