aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-09-07 01:44:35 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:41:05 +0100
commit06983baa19f0fbf48dd3e89e2d3810a4d8cf340a (patch)
tree1515e02398884f56ed9e644ad01f1636b14f4f3f
parentba2bf102156c921eb3eba950cfe46d593105240e (diff)
downloadusdx-06983baa19f0fbf48dd3e89e2d3810a4d8cf340a.tar.gz
usdx-06983baa19f0fbf48dd3e89e2d3810a4d8cf340a.tar.xz
usdx-06983baa19f0fbf48dd3e89e2d3810a4d8cf340a.zip
menu/text: basic handling of auto size
If auto_size is false the control is setup clipping, so that the outside parts of the control gets discarded. If auto_size enable, the drawn parts outside the component rectangle are drawn. TODO: currently the component dost not really change its size. This could be necessary for sensible regions.
-rw-r--r--src/menu/text.cpp15
-rw-r--r--src/menu/text.hpp3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/menu/text.cpp b/src/menu/text.cpp
index 9cfc8218..3c95b42b 100644
--- a/src/menu/text.cpp
+++ b/src/menu/text.cpp
@@ -74,6 +74,8 @@ namespace usdx
bbox.get_point1().set_y(font->Ascender());
bbox.get_point2().set_y(font->Descender());
valign->align(offset, bbox, get_size());
+
+ // TODO: handle autosize (required for sensitive area)
}
void Text::draw(void)
@@ -132,5 +134,18 @@ namespace usdx
DrawableControl::set_size(width, height);
realign();
}
+
+ void Text::set_auto_size(const bool value)
+ {
+ auto_size = value;
+
+ set_clipping_required(!auto_size);
+ realign();
+ }
+
+ bool Text::get_auto_size(void) const
+ {
+ return auto_size;
+ }
};
diff --git a/src/menu/text.hpp b/src/menu/text.hpp
index 7a57adab..d5798c8e 100644
--- a/src/menu/text.hpp
+++ b/src/menu/text.hpp
@@ -104,6 +104,9 @@ namespace usdx
virtual void set_size(const Dimension<int>& size);
virtual void set_size(int width, int height);
+
+ void set_auto_size(const bool value);
+ bool get_auto_size(void) const;
};
};