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