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>2010-10-26 15:32:42 +0000
committerStijn Buys <ingar@osirion.org>2010-10-26 15:32:42 +0000
commit23c7d2c11170ee8736673e82a88e87a3d2e538f7 (patch)
treecd88e317a4f42391bc3567ed1881c160227cd3c6 /src/ui/widget.h
parent5189168482f32d8aac630cde27fc0999e70ed57b (diff)
enables ui::Slider mouse dragging, corrected a bug in ui::Widget coordinate mapping
Diffstat (limited to 'src/ui/widget.h')
-rw-r--r--src/ui/widget.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 530af05..cb42ad0 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -293,12 +293,23 @@ protected:
/* -- coordinate mapping ----------------------------------- */
+ /// map local widget location to global location
+ inline math::Vector2f global_location() {
+ math::Vector2f v(widget_location);
+ Widget *parent = widget_parent;
+ while (parent) {
+ v += parent->location();
+ parent = parent->parent();
+ }
+ return v;
+ }
+
/// map local coordinates to global coordinates
inline math::Vector2f to_global_coords(const math::Vector2f &local) {
math::Vector2f v(local);
Widget *parent = widget_parent;
do {
- v -= parent->location();
+ v += parent->location();
parent = parent->parent();
} while (parent);
return v;
@@ -309,18 +320,7 @@ protected:
math::Vector2f v(global);
Widget *parent = this;
while (parent) {
- v += parent->location();
- parent = parent->parent();
- }
- return v;
- }
-
- /// map local widget location to global location
- inline math::Vector2f global_location() {
- math::Vector2f v(widget_location);
- Widget *parent = widget_parent;
- while (parent) {
- v += parent->location();
+ v -= parent->location();
parent = parent->parent();
}
return v;
@@ -356,6 +356,9 @@ protected:
/// draw the widget border
virtual void draw_border();
+
+ /// draw denug state
+ virtual void draw_debug();
/// add a child widget
virtual void add_child(Widget *child);
@@ -366,8 +369,8 @@ protected:
/// remove all child widgets
virtual void remove_children();
+
private:
- void draw_debug_border();
bool widget_visible;
bool widget_background;