Rev | Line | |
---|
[4838] | 1 | /*! |
---|
[8538] | 2 | * @file limited_width_text.h |
---|
[5343] | 3 | * @brief Definition of a text Class, that is able to render text. |
---|
[7355] | 4 | */ |
---|
[1853] | 5 | |
---|
[8538] | 6 | #ifndef _LIMITED_WIDTH_TEXT_H |
---|
| 7 | #define _LIMITED_WIDTH_TEXT_H |
---|
[1853] | 8 | |
---|
[7450] | 9 | #include "text.h" |
---|
[1853] | 10 | |
---|
[7450] | 11 | #include <vector> |
---|
[5343] | 12 | |
---|
| 13 | //! Represents one textElement. |
---|
[8538] | 14 | class LimitedWidthText : public Text |
---|
[5343] | 15 | { |
---|
| 16 | public: |
---|
[8538] | 17 | typedef enum { |
---|
| 18 | Begin, |
---|
| 19 | End, |
---|
| 20 | } DotsPosition; |
---|
[3245] | 21 | |
---|
[8538] | 22 | |
---|
| 23 | public: |
---|
| 24 | LimitedWidthText(const std::string& fontFile = "", unsigned int fontSize = TEXT_DEFAULT_SIZE, float lineWidth = 100.0, DotsPosition dotsPosition = Begin); |
---|
| 25 | |
---|
[7450] | 26 | // Setup: |
---|
| 27 | void setLineWidth(float lineWidth); |
---|
[8980] | 28 | void setDotsPosition(LimitedWidthText::DotsPosition dotsPosition); |
---|
[5345] | 29 | |
---|
[7450] | 30 | // Retrieve: |
---|
| 31 | /** @returns the LineWidth (maximum distance from the left to the right */ |
---|
[8538] | 32 | inline float lineWidth() const { return this->_lineWidth; }; |
---|
| 33 | /** @returns the dots position. */ |
---|
| 34 | inline float dotsPosition() const { return this->_dotsPosition; }; |
---|
[8542] | 35 | |
---|
[5343] | 36 | virtual void draw() const; |
---|
| 37 | |
---|
[7757] | 38 | void debug() const; |
---|
| 39 | |
---|
[7450] | 40 | protected: |
---|
| 41 | virtual void setupTextWidth(); |
---|
[5343] | 42 | |
---|
| 43 | private: |
---|
[8538] | 44 | std::string _dotedText; |
---|
| 45 | |
---|
| 46 | DotsPosition _dotsPosition; |
---|
| 47 | float _lineWidth; |
---|
| 48 | unsigned int _lineEnds; |
---|
[1853] | 49 | }; |
---|
| 50 | |
---|
[8538] | 51 | #endif /* _LIMITED_WIDTH_TEXT_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.