My Project
GUIToolTip.h
1 #pragma once
2 #include "GUIBase.h"
3 
4 namespace ParaEngine
5 {
6  struct GUIToolTipItem {
7  enum TipState{BEFORESHOW,SHOWING,AFTERSHOW,BLINKING};
8  CGUIBase* m_obj; //where the tooltip attached to
9  u16string m_text; //what text it displays
10  int m_behavior; //how this tooltip behaves
11  int m_timecount; //for effects
12  int m_autopopdelay; //time length of displaying
13  int m_initialdelay; //time before it shows
14  bool m_show; //whether to show this item
15  bool m_rendered; //whether this item needs to show in this frame
16  RECT m_rect;//the size of the rectangle needed to draw text
17  int m_state;
18  };
19  /*
20  Elements:
21  0. Text client "text"
22  1. Left-Top corner "lefttop"
23  2. Top border "top"
24  3. Right-Top corner "righttop"
25  4. Left border "left"
26  5. Right border "right"
27  6. Left-bottom corner "leftbottom"
28  7. Bottom border "bottom"
29  8. Right-Bottom corner "rightbottom"
30  9. Left Dialog indicator "leftindicator"
31  10. Right Dialog indicator "rightindicator"
32  11. Left Filling area "leftfill"
33  12. Right Filling area "rightfill"
34  */
50  class CGUIToolTip:public CGUIBase
51  {
52  public:
61  NONE=0,FLASHING=1,POINTING=2,STATIC=4,HIGHTLIGHT=8
62  };
63  CGUIToolTip();
64  virtual ~CGUIToolTip();
65  void Initialize();
66  int GetBehavior(){return m_nBehavior;}
67  void SetBehavior(int behavior){m_nBehavior=behavior;}
68  int GetAutomaticDelay(){return m_nAutomaticDelay;}
69  void SetAutomaticDelay(int automaticdelay){m_nAutoPopDelay=automaticdelay*20;m_nInitialDelay=automaticdelay;}
70  int GetAutoPopDelay(){return m_nAutoPopDelay;}
71  void SetAutoPopDelay(int autopopdelay){m_nAutoPopDelay=autopopdelay;}
72  int GetInitialDelay(){return m_nInitialDelay;}
73  void SetInitialDelay(int initialdelay){m_nInitialDelay=initialdelay;}
74 
82  void SetToolTip(CGUIBase* obj,const char16_t* text);
83  void SetToolTipA(CGUIBase* obj,const char* szText);
84  const char16_t* GetToolTip(CGUIBase* obj);
85  int GetToolTipA(CGUIBase* obj,std::string & out);
86  GUIToolTipItem* GetActiveTip();
87  void RemoveTip(CGUIBase* obj);
88  void RemoveAll();
89 
94  void ActivateTip(CGUIBase* obj);
101  void DeactivateTip(CGUIBase* obj);
102  void SetIndicator(int indicator){m_nIndicator=indicator>0?indicator:0;}
103  int GetIndicator(){return m_nIndicator;}
104  virtual int Release();
105  virtual void UpdateRects();
106  virtual void InitObject(const char * strObjectName, const char * alignment, int x, int y, int width, int height);
107  virtual HRESULT Render(GUIState* pGUIState ,float fElapsedTime);
108  virtual bool MsgProc(CGUIEvent *event/* =NULL */){return false;}
109  virtual const IType* GetType()const{return m_type;}
110  protected:
111  static const IType* m_type;
112  map<CGUIBase*,GUIToolTipItem> m_items;
113  int m_nBehavior;
114  int m_nAutomaticDelay;
115  int m_nAutoPopDelay;
116  int m_nInitialDelay;
117  int m_nIndicator;
118  GUIToolTipItem *m_ActiveTip;
120  void CheckTipState(float fTimeElapsed);
121  };
122 }
IType is for type information and validating It contains type information of an object.
Definition: Type.h:75
Definition: GUIToolTip.h:6
ToolTip_Behavior
NONE: default behavior FLASHING: flashing tip POINTING: pointing to an object, drawing user attention...
Definition: GUIToolTip.h:60
different physics engine has different winding order.
Definition: EventBinding.h:32
Place of the.
Definition: GUIEvent.h:43
Definition: ManagedDef.h:18
base object for all 2D GUI objects (1) 2D GUI object are not tested against view frustum, instead it is controlled by visibility tag automatically or through user input.
Definition: GUIBase.h:54
It&#39;s used as parameter to Render method of each GUI object.
Definition: GUIState.h:16
m_objResource->m_objArtwork->DrawingRects[0]: text rectangle; m_objResource->m_objArtwork->DrawingRec...
Definition: GUIToolTip.h:50