From 231a5c0d8dfc6d5b0fd2cbbdbd10cea582562f85 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 25 Mar 2012 21:40:45 +0200 Subject: menu/text: added variable vertical alignment in the box of the control --- src/menu/text.hpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/menu/text.hpp') diff --git a/src/menu/text.hpp b/src/menu/text.hpp index ad5fcb9a..7ec0dade 100644 --- a/src/menu/text.hpp +++ b/src/menu/text.hpp @@ -35,6 +35,7 @@ #include "drawable_control.hpp" #include "container.hpp" #include "utils/point.hpp" +#include "vertical_text_alignment.hpp" namespace usdx { @@ -62,15 +63,33 @@ namespace usdx */ bool stretch; + /** + * Offset of the baseline of the text to the top left corner of the + * control. + */ + Point offset; + FTFont *font; + const VerticalTextAlignment *valign; + boost::mutex font_mutex; + /** + * This function is used to recalculate the offset of the drawn + * text. It should be called every time the text or the font size is + * changed. + * + * @see: offset + */ + void realign(void); protected: virtual void draw(void); public: - Text(Container* parent, const std::string text = "", const unsigned int size = 60); + Text(Container*, const std::string = "", const unsigned int = 60, + const VerticalTextAlignment* = new VerticalTextAlignmentTop()); + virtual ~Text(); void set_font_size(const unsigned int value); -- cgit v1.2.3