Pyrogenesis  trunk
CText.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_CTEXT
19 #define INCLUDED_CTEXT
20 
21 #include "gui/CGUISprite.h"
26 
27 /**
28  * Text field that just displays static text.
29  */
30 class CText : public IGUIObject, public IGUIScrollBarOwner, public IGUITextOwner
31 {
33 public:
34  CText(CGUI& pGUI);
35  virtual ~CText();
36 
37  /**
38  * @see IGUIObject#ResetStates()
39  */
40  virtual void ResetStates();
41 
42  /**
43  * @see IGUIObject#UpdateCachedSize()
44  */
45  virtual void UpdateCachedSize();
46 
47  /**
48  * @return the object text size.
49  */
51 
52  virtual const CStrW& GetTooltipText() const;
53 protected:
54  /**
55  * Sets up text, should be called every time changes has been
56  * made that can change the visual.
57  */
58  void SetupText();
59 
60  /**
61  * @see IGUIObject#HandleMessage()
62  */
63  virtual void HandleMessage(SGUIMessage& Message);
64 
65  /**
66  * Draws the Text
67  */
68  virtual void Draw(CCanvas2D& canvas);
69 
70  virtual void CreateJSObject();
71 
72  /**
73  * Placement of text. Ignored when scrollbars are active.
74  */
76 
89 };
90 
91 #endif // INCLUDED_CTEXT
CGUISimpleSetting< float > m_BufferZone
Definition: CText.h:77
void SetupText()
Sets up text, should be called every time changes has been made that can change the visual...
Definition: CText.cpp:56
CSize2D GetTextSize()
Definition: CText.cpp:110
CGUISimpleSetting< CGUISpriteInstance > m_Sprite
Definition: CText.h:85
CGUISimpleSetting< bool > m_ScrollBar
Definition: CText.h:81
CGUISimpleSetting< CGUIColor > m_TextColor
Definition: CText.h:87
GUI object such as a button or an input-box.
Definition: IGUIObject.h:59
The main object that represents a whole GUI page.
Definition: CGUI.h:60
virtual ~CText()
Definition: CText.cpp:52
virtual const CStrW & GetTooltipText() const
Definition: CText.cpp:116
Definition: Size2D.h:24
CText(CGUI &pGUI)
Definition: CText.cpp:26
Framework for handling Output text.
Definition: IGUITextOwner.h:52
virtual void Draw(CCanvas2D &canvas)
Draws the Text.
Definition: CText.cpp:186
CGUISimpleSetting< bool > m_ScrollBottom
Definition: CText.h:83
Definition: Canvas2D.h:35
CGUISimpleSetting< CGUIColor > m_TextColorDisabled
Definition: CText.h:88
CVector2D m_TextPos
Placement of text.
Definition: CText.h:75
Definition: Vector2D.h:31
virtual void HandleMessage(SGUIMessage &Message)
Definition: CText.cpp:130
virtual void ResetStates()
Definition: CText.cpp:98
virtual void CreateJSObject()
Creates the JS object representing this page upon first use.
#define GUI_OBJECT(obj)
Definition: IGUIObject.h:50
CGUISimpleSetting< CGUISpriteInstance > m_SpriteOverlay
Definition: CText.h:86
Text field that just displays static text.
Definition: CText.h:30
virtual void UpdateCachedSize()
Definition: CText.cpp:104
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:67
Base-class this if you want an object to contain one, or several, scroll-bars.
Definition: IGUIScrollBarOwner.h:36
CGUISimpleSetting< CStrW > m_Font
Definition: CText.h:80
CGUISimpleSetting< CGUIString > m_Caption
Definition: CText.h:78
CGUISimpleSetting< CStr > m_ScrollBarStyle
Definition: CText.h:82
CGUISimpleSetting< bool > m_Clip
Definition: CText.h:79
CGUISimpleSetting< bool > m_ScrollTop
Definition: CText.h:84