diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-10-26 18:38:30 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-18 19:34:20 +0100 |
commit | 77d65c98a8330a00d9cad8c10177660ebc685f9c (patch) | |
tree | d89322c411b0aba8b72a21b511592748432445e7 /src/menu | |
parent | 21892f777ee38a93428e6a3804868eab73fc683d (diff) | |
download | usdx-77d65c98a8330a00d9cad8c10177660ebc685f9c.tar.gz usdx-77d65c98a8330a00d9cad8c10177660ebc685f9c.tar.xz usdx-77d65c98a8330a00d9cad8c10177660ebc685f9c.zip |
menu: fix calculate window coordinates
Diffstat (limited to '')
-rw-r--r-- | src/menu/clipping_helper.cpp | 6 | ||||
-rw-r--r-- | src/menu/container.cpp | 7 | ||||
-rw-r--r-- | src/menu/drawable_control.cpp | 5 | ||||
-rw-r--r-- | src/menu/drawable_control.hpp | 1 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/menu/clipping_helper.cpp b/src/menu/clipping_helper.cpp index 425e9dec..1a92d3f1 100644 --- a/src/menu/clipping_helper.cpp +++ b/src/menu/clipping_helper.cpp @@ -45,7 +45,11 @@ namespace usdx // calculate window coordinates of rectangle if (parent) { int offset = parent->get_size().get_height() - rect.get_bottom(); - new_scissor_box.set_top(parent->get_window_coords().get_y() + offset); + new_scissor_box.set_top(parent->get_window_coords().get_y() + + offset); + + new_scissor_box.set_left(parent->get_window_coords().get_x() + + rect.get_left()); } // calculate intersection of old clipping and requested clipping diff --git a/src/menu/container.cpp b/src/menu/container.cpp index 84811d3a..65b85aec 100644 --- a/src/menu/container.cpp +++ b/src/menu/container.cpp @@ -98,10 +98,11 @@ namespace usdx void Container::recalculate_window_coords(void) { if (parent) { - window_coords.set_x(parent->get_width() - - (get_left() + get_width())); + window_coords.set_x(parent->get_window_coords().get_x() + + get_left()); - window_coords.set_y(parent->get_height() - + window_coords.set_y(parent->get_window_coords().get_y() + + get_parent()->get_height() - (get_top() + get_height())); } } diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp index 8b2246c5..74ef77a3 100644 --- a/src/menu/drawable_control.cpp +++ b/src/menu/drawable_control.cpp @@ -180,6 +180,11 @@ namespace usdx return size.get_height(); } + Container* DrawableControl::get_parent(void) const + { + return parent; + } + void DrawableControl::remove_parent(void) { if (parent) { diff --git a/src/menu/drawable_control.hpp b/src/menu/drawable_control.hpp index be53fbf8..9f33b376 100644 --- a/src/menu/drawable_control.hpp +++ b/src/menu/drawable_control.hpp @@ -118,6 +118,7 @@ namespace usdx int get_width(void) const; int get_height(void) const; + Container* get_parent(void) const; void remove_parent(void); void set_background(Background*); |