diff options
Diffstat (limited to 'src/ui/widget.cc')
-rw-r--r-- | src/ui/widget.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ui/widget.cc b/src/ui/widget.cc index 6d0fb84..7cde03b 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -366,6 +366,24 @@ Widget *Widget::find_input_focus() return this; } +Widget *Widget::find_visible_child(const Widget *widget) +{ + if (!visible()) + return 0; + + if (this == widget) + return this; + + // search in reverse drawing order + for (Children::reverse_iterator rit = widget_children.rbegin(); rit != widget_children.rend(); ++rit) { + Widget *f = (*rit)->find_visible_child(widget); + if (f) { + return f; + } + } + return 0; +} + Widget *Widget::find_mouse_focus(const math::Vector2f & pos) { // this widget is not visible |