aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/menu/clipping_helper.cpp6
-rw-r--r--src/menu/container.cpp7
-rw-r--r--src/menu/drawable_control.cpp5
-rw-r--r--src/menu/drawable_control.hpp1
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*);