diff options
Diffstat (limited to '')
-rw-r--r-- | src/menu/drawable_control.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 47df96db..76749840 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -230,4 +230,26 @@ namespace usdx boost::shared_lock<boost::shared_mutex> lock(background_mutex); return background; } + + const Rectangle<int> DrawableControl::get_absolut_rect(void) const + { + Rectangle<int> rect(get_position(), get_size()); + + if (parent) { + Rectangle<int> parent_rect = parent->get_absolut_rect(); + rect += Point<int>(parent_rect.get_left(), + parent_rect.get_top()); + } + + return rect; + } + + DrawableControl* DrawableControl::get_component_at(const Point<int>& p) + { + if (focusable && get_absolut_rect().is_in(p)) { + return this; + } + + return NULL; + } }; |