Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-01-29 13:51:31 +0000
committerStijn Buys <ingar@osirion.org>2012-01-29 13:51:31 +0000
commit398f3df8af02047a76ab7172c69d93313250260c (patch)
tree0a4925510726d74b23d84115c56de0ca4042643e /src/ui/widget.cc
parentf320ee25c74b6f24db58d97c0129de6e94db3345 (diff)
FS#80 Have mouse focus stick to the widget when the mouse button is down.
Diffstat (limited to 'src/ui/widget.cc')
-rw-r--r--src/ui/widget.cc18
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