From 06983baa19f0fbf48dd3e89e2d3810a4d8cf340a Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 7 Sep 2012 01:44:35 +0200 Subject: 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. --- src/menu/text.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/menu/text.cpp') 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; + } }; -- cgit v1.2.3