if(i==children.end())
throw hierarchy_error("widget not in container");
+ if(&wdg==saved_input_focus)
+ saved_input_focus = nullptr;
wdg.set_parent(nullptr);
delete *i;
children.erase(i);
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))
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;
}
{
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();
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
void Container::focus_in()
{
- if(saved_input_focus && saved_input_focus->get_parent()==this)
+ if(saved_input_focus)
set_input_focus(saved_input_focus);
Widget::focus_in();
}