| [25140] | 1 | /* Copyright (C) 2021 Wildfire Games.
|
|---|
| [27965] | 2 | * This file is part of 0 A.D.
|
|---|
| [6830] | 3 | *
|
|---|
| [27965] | 4 | * 0 A.D. is free software: you can redistribute it and/or modify
|
|---|
| [6830] | 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 | *
|
|---|
| [27965] | 9 | * 0 A.D. is distributed in the hope that it will be useful,
|
|---|
| [6830] | 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
|
|---|
| [27965] | 15 | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| [6830] | 16 | */
|
|---|
| 17 |
|
|---|
| [5040] | 18 | #ifndef INCLUDED_CTEXT
|
|---|
| 19 | #define INCLUDED_CTEXT
|
|---|
| [141] | 20 |
|
|---|
| [23005] | 21 | #include "gui/CGUISprite.h"
|
|---|
| [24352] | 22 | #include "gui/ObjectBases/IGUIObject.h"
|
|---|
| [23028] | 23 | #include "gui/ObjectBases/IGUIScrollBarOwner.h"
|
|---|
| 24 | #include "gui/ObjectBases/IGUITextOwner.h"
|
|---|
| 25 | #include "gui/SettingTypes/CGUIString.h"
|
|---|
| [141] | 26 |
|
|---|
| 27 | /**
|
|---|
| 28 | * Text field that just displays static text.
|
|---|
| 29 | */
|
|---|
| [23020] | 30 | class CText : public IGUIObject, public IGUIScrollBarOwner, public IGUITextOwner
|
|---|
| [141] | 31 | {
|
|---|
| 32 | GUI_OBJECT(CText)
|
|---|
| 33 | public:
|
|---|
| [22741] | 34 | CText(CGUI& pGUI);
|
|---|
| [141] | 35 | virtual ~CText();
|
|---|
| 36 |
|
|---|
| [9340] | 37 | /**
|
|---|
| 38 | * @see IGUIObject#ResetStates()
|
|---|
| 39 | */
|
|---|
| [23020] | 40 | virtual void ResetStates();
|
|---|
| [290] | 41 |
|
|---|
| [8494] | 42 | /**
|
|---|
| [23020] | 43 | * @see IGUIObject#UpdateCachedSize()
|
|---|
| 44 | */
|
|---|
| 45 | virtual void UpdateCachedSize();
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| [25225] | 48 | * @return the object text size.
|
|---|
| [8494] | 49 | */
|
|---|
| [25225] | 50 | CSize2D GetTextSize();
|
|---|
| [8494] | 51 |
|
|---|
| [25353] | 52 | virtual const CStrW& GetTooltipText() const;
|
|---|
| [290] | 53 | protected:
|
|---|
| [141] | 54 | /**
|
|---|
| [290] | 55 | * Sets up text, should be called every time changes has been
|
|---|
| 56 | * made that can change the visual.
|
|---|
| [141] | 57 | */
|
|---|
| [290] | 58 | void SetupText();
|
|---|
| [141] | 59 |
|
|---|
| 60 | /**
|
|---|
| [9340] | 61 | * @see IGUIObject#HandleMessage()
|
|---|
| [141] | 62 | */
|
|---|
| [16931] | 63 | virtual void HandleMessage(SGUIMessage& Message);
|
|---|
| [141] | 64 |
|
|---|
| 65 | /**
|
|---|
| 66 | * Draws the Text
|
|---|
| 67 | */
|
|---|
| [25588] | 68 | virtual void Draw(CCanvas2D& canvas);
|
|---|
| [1584] | 69 |
|
|---|
| [24229] | 70 | virtual void CreateJSObject();
|
|---|
| [23020] | 71 |
|
|---|
| 72 | /**
|
|---|
| [1584] | 73 | * Placement of text. Ignored when scrollbars are active.
|
|---|
| 74 | */
|
|---|
| [25152] | 75 | CVector2D m_TextPos;
|
|---|
| [23005] | 76 |
|
|---|
| [25392] | 77 | CGUISimpleSetting<float> m_BufferZone;
|
|---|
| 78 | CGUISimpleSetting<CGUIString> m_Caption;
|
|---|
| 79 | CGUISimpleSetting<bool> m_Clip;
|
|---|
| 80 | CGUISimpleSetting<CStrW> m_Font;
|
|---|
| 81 | CGUISimpleSetting<bool> m_ScrollBar;
|
|---|
| 82 | CGUISimpleSetting<CStr> m_ScrollBarStyle;
|
|---|
| 83 | CGUISimpleSetting<bool> m_ScrollBottom;
|
|---|
| 84 | CGUISimpleSetting<bool> m_ScrollTop;
|
|---|
| 85 | CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
|
|---|
| [25587] | 86 | CGUISimpleSetting<CGUISpriteInstance> m_SpriteOverlay;
|
|---|
| [25392] | 87 | CGUISimpleSetting<CGUIColor> m_TextColor;
|
|---|
| 88 | CGUISimpleSetting<CGUIColor> m_TextColorDisabled;
|
|---|
| [141] | 89 | };
|
|---|
| 90 |
|
|---|
| [16931] | 91 | #endif // INCLUDED_CTEXT
|
|---|