Pyrogenesis  trunk
CTooltip.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_CTOOLTIP
19 #define INCLUDED_CTOOLTIP
20 
21 #include "gui/CGUISprite.h"
25 #include "maths/Vector2D.h"
26 
27 /**
28  * Dynamic tooltips. Similar to CText.
29  */
30 class CTooltip : public IGUIObject, public IGUITextOwner
31 {
33 
34 public:
35  CTooltip(CGUI& pGUI);
36  virtual ~CTooltip();
37 
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 
43 protected:
44  void SetupText();
45 
46  /**
47  * @see IGUIObject#UpdateCachedSize()
48  */
49  void UpdateCachedSize();
50 
51  /**
52  * @see IGUIObject#HandleMessage()
53  */
54  virtual void HandleMessage(SGUIMessage& Message);
55 
56  virtual void Draw(CCanvas2D& canvas);
57 
58  virtual float GetBufferedZ() const;
59 
73 };
74 
75 #endif // INCLUDED_CTOOLTIP
CGUISimpleSetting< CVector2D > m_Offset
Definition: CTooltip.h:67
void SetMousePos(const CVector2D &vec)
Definition: CTooltip.h:41
virtual void Draw(CCanvas2D &canvas)
Draws the object.
Definition: CTooltip.cpp:134
CGUISimpleSetting< CVector2D > m_MousePos
Definition: CTooltip.h:70
bool ShouldHideObject() const
Definition: CTooltip.h:40
CGUISimpleSetting< EVAlign > m_Anchor
Definition: CTooltip.h:68
Dynamic tooltips.
Definition: CTooltip.h:30
GUI object such as a button or an input-box.
Definition: IGUIObject.h:59
void SetupText()
Setup texts.
Definition: CTooltip.cpp:58
CGUISimpleSetting< CStr > m_UseObject
Definition: CTooltip.h:71
void Set(T value, bool sendMessage)
&#39;Uglified&#39; operator=, so that SendMessage is explicit.
Definition: CGUISetting.h:106
CGUISimpleSetting< bool > m_Independent
Definition: CTooltip.h:69
virtual void HandleMessage(SGUIMessage &Message)
Definition: CTooltip.cpp:128
The main object that represents a whole GUI page.
Definition: CGUI.h:60
virtual ~CTooltip()
Definition: CTooltip.cpp:54
CGUISimpleSetting< CGUIColor > m_TextColor
Definition: CTooltip.h:65
Framework for handling Output text.
Definition: IGUITextOwner.h:52
Definition: mongoose.cpp:428
virtual float GetBufferedZ() const
Returns not the Z value, but the actual buffered Z value, i.e.
Definition: CTooltip.cpp:148
Definition: Canvas2D.h:35
int32_t i32
Definition: types.h:34
CGUISimpleSetting< float > m_BufferZone
Definition: CTooltip.h:60
Definition: Vector2D.h:31
const CStr & GetUsedObject() const
Definition: CTooltip.h:38
CGUISimpleSetting< i32 > m_Delay
Definition: CTooltip.h:64
CGUISimpleSetting< CGUIString > m_Caption
Definition: CTooltip.h:61
CGUISimpleSetting< CStrW > m_Font
Definition: CTooltip.h:62
#define GUI_OBJECT(obj)
Definition: IGUIObject.h:50
CTooltip(CGUI &pGUI)
Definition: CTooltip.cpp:28
void UpdateCachedSize()
Definition: CTooltip.cpp:122
i32 GetTooltipDelay() const
Definition: CTooltip.h:39
CGUISimpleSetting< float > m_MaxWidth
Definition: CTooltip.h:66
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:67
CGUISimpleSetting< CGUISpriteInstance > m_Sprite
Definition: CTooltip.h:63
CGUISimpleSetting< bool > m_HideObject
Definition: CTooltip.h:72