aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/container.cpp
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-04-09 18:33:45 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:40:52 +0100
commit09eacc82176c37fdc12c903061ffa3ff960ac4cf (patch)
tree91b8c9eab484a838504cebc4c0a9eda4d7fe4b01 /src/menu/container.cpp
parentde10bbae4602917aae0ed648824f75c3f674eb4a (diff)
downloadusdx-09eacc82176c37fdc12c903061ffa3ff960ac4cf.tar.gz
usdx-09eacc82176c37fdc12c903061ffa3ff960ac4cf.tar.xz
usdx-09eacc82176c37fdc12c903061ffa3ff960ac4cf.zip
menu/container: calculate window coordinates
the container have to keep the current window coordinates of its left, bottom corner, therefor they have to be recalculated on every size/position change (need virtual functions in DrawableControl)
Diffstat (limited to 'src/menu/container.cpp')
-rw-r--r--src/menu/container.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/menu/container.cpp b/src/menu/container.cpp
index ce73c1c2..3cf8d770 100644
--- a/src/menu/container.cpp
+++ b/src/menu/container.cpp
@@ -91,4 +91,40 @@ namespace usdx
{
return window_coords;
}
+
+ void Container::recalculate_window_coords(void)
+ {
+ if (parent) {
+ assert(parent != NULL);
+ window_coords.set_x(parent->get_width() -
+ (get_left() + get_width()));
+
+ window_coords.set_y(parent->get_height() -
+ (get_top() + get_height()));
+ }
+ }
+
+ void Container::set_position(const Point<int>& position)
+ {
+ DrawableControl::set_position(position);
+ recalculate_window_coords();
+ }
+
+ void Container::set_position(int left, int top)
+ {
+ DrawableControl::set_position(left, top);
+ recalculate_window_coords();
+ }
+
+ void Container::set_size(const Dimension<int>& size)
+ {
+ DrawableControl::set_size(size);
+ recalculate_window_coords();
+ }
+
+ void Container::set_size(int width, int height)
+ {
+ DrawableControl::set_size(width, height);
+ recalculate_window_coords();
+ }
};