| [25152] | 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_CTOOLTIP
|
|---|
| 19 | #define INCLUDED_CTOOLTIP
|
|---|
| [3802] | 20 |
|
|---|
| [24352] | 21 | #include "gui/CGUISprite.h"
|
|---|
| 22 | #include "gui/ObjectBases/IGUIObject.h"
|
|---|
| [23028] | 23 | #include "gui/ObjectBases/IGUITextOwner.h"
|
|---|
| 24 | #include "gui/SettingTypes/CGUIString.h"
|
|---|
| [25152] | 25 | #include "maths/Vector2D.h"
|
|---|
| [3802] | 26 |
|
|---|
| [16931] | 27 | /**
|
|---|
| 28 | * Dynamic tooltips. Similar to CText.
|
|---|
| 29 | */
|
|---|
| [23020] | 30 | class CTooltip : public IGUIObject, public IGUITextOwner
|
|---|
| [3802] | 31 | {
|
|---|
| 32 | GUI_OBJECT(CTooltip)
|
|---|
| 33 |
|
|---|
| 34 | public:
|
|---|
| [22741] | 35 | CTooltip(CGUI& pGUI);
|
|---|
| [3802] | 36 | virtual ~CTooltip();
|
|---|
| 37 |
|
|---|
| [25392] | 38 | const CStr& GetUsedObject() const { return m_UseObject; }
|
|---|
| 39 | i32 GetTooltipDelay() const { return m_Delay; }
|
|---|
| 40 | bool ShouldHideObject() const { return m_HideObject; }
|
|---|
| 41 | void SetMousePos(const CVector2D& vec) { m_MousePos.Set(vec, true); }
|
|---|
| 42 |
|
|---|
| [3802] | 43 | protected:
|
|---|
| 44 | void SetupText();
|
|---|
| 45 |
|
|---|
| [9340] | 46 | /**
|
|---|
| [23020] | 47 | * @see IGUIObject#UpdateCachedSize()
|
|---|
| 48 | */
|
|---|
| 49 | void UpdateCachedSize();
|
|---|
| 50 |
|
|---|
| 51 | /**
|
|---|
| [9340] | 52 | * @see IGUIObject#HandleMessage()
|
|---|
| 53 | */
|
|---|
| [16931] | 54 | virtual void HandleMessage(SGUIMessage& Message);
|
|---|
| [3802] | 55 |
|
|---|
| [25588] | 56 | virtual void Draw(CCanvas2D& canvas);
|
|---|
| [23005] | 57 |
|
|---|
| [25229] | 58 | virtual float GetBufferedZ() const;
|
|---|
| 59 |
|
|---|
| [25392] | 60 | CGUISimpleSetting<float> m_BufferZone;
|
|---|
| 61 | CGUISimpleSetting<CGUIString> m_Caption;
|
|---|
| 62 | CGUISimpleSetting<CStrW> m_Font;
|
|---|
| 63 | CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
|
|---|
| 64 | CGUISimpleSetting<i32> m_Delay;
|
|---|
| 65 | CGUISimpleSetting<CGUIColor> m_TextColor;
|
|---|
| 66 | CGUISimpleSetting<float> m_MaxWidth;
|
|---|
| 67 | CGUISimpleSetting<CVector2D> m_Offset;
|
|---|
| 68 | CGUISimpleSetting<EVAlign> m_Anchor;
|
|---|
| 69 | CGUISimpleSetting<bool> m_Independent;
|
|---|
| 70 | CGUISimpleSetting<CVector2D> m_MousePos;
|
|---|
| 71 | CGUISimpleSetting<CStr> m_UseObject;
|
|---|
| 72 | CGUISimpleSetting<bool> m_HideObject;
|
|---|
| [3802] | 73 | };
|
|---|
| 74 |
|
|---|
| [16931] | 75 | #endif // INCLUDED_CTOOLTIP
|
|---|