diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-11 20:49:56 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-18 19:34:21 +0100 |
commit | 91337be4652b0f8c822de58d3c646423b1967bf0 (patch) | |
tree | 9e1f313f8713771555d348e94274339d30aa744a /src | |
parent | 91420895f6cbe7a1aa8e1c7f590195ed6bae0a48 (diff) | |
download | usdx-91337be4652b0f8c822de58d3c646423b1967bf0.tar.gz usdx-91337be4652b0f8c822de58d3c646423b1967bf0.tar.xz usdx-91337be4652b0f8c822de58d3c646423b1967bf0.zip |
text: resize text, if auto_size is enabled
Change the default for auto_size to false, so that it is not
automatically resized during construction.
Diffstat (limited to 'src')
-rw-r--r-- | src/menu/text.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/menu/text.cpp b/src/menu/text.cpp index 3c95b42b..0e2b07c9 100644 --- a/src/menu/text.cpp +++ b/src/menu/text.cpp @@ -34,7 +34,7 @@ namespace usdx Text::Text(Container *parent, const std::string text, const unsigned int size, const VerticalTextAlignment* valign) : - DrawableControl(parent), text(text), auto_size(true), + DrawableControl(parent), text(text), auto_size(false), stretch(false), offset(Point<int>(0, 0)), valign(valign) { font = new FTBufferFont("DejaVuSans.ttf"); @@ -75,7 +75,9 @@ namespace usdx bbox.get_point2().set_y(font->Descender()); valign->align(offset, bbox, get_size()); - // TODO: handle autosize (required for sensitive area) + if (auto_size && get_size() != bbox.get_dim()) { + set_size(bbox.get_dim()); + } } void Text::draw(void) |