aduiTextTip.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. #ifndef _aduiTextTip_h
  12. #define _aduiTextTip_h
  13. #pragma pack (push, 8)
  14. #pragma once
  15. #ifndef _ADESK_MAC_
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CAdUiTipWindow
  18. #pragma warning(push)
  19. #pragma warning(disable : 4275)
  20. class ADUI_PORT CAdUiTipWindow : public CWnd {
  21. DECLARE_DYNAMIC(CAdUiTipWindow)
  22. public:
  23. CAdUiTipWindow ();
  24. virtual ~CAdUiTipWindow ();
  25. // Tip Window
  26. private:
  27. void ForwardClickMessage (UINT msg, UINT nFlags, CPoint& point, BOOL focus);
  28. protected:
  29. static LPCTSTR m_className; // Registered class name
  30. static const UINT_PTR m_timerEvent;
  31. BOOL m_bUseText; // Draw as text vs. owner-draw.
  32. CWnd *m_control; // Related control
  33. CWnd *m_owner; // Owner (dialog, etc.)
  34. UINT_PTR m_timerId;
  35. virtual void DrawBorder (CDC& dc, CRect& rExterior, CRect& rInterior);
  36. virtual void DrawContent (CDC& dc, CRect& rInterior);
  37. void StartTimer (DWORD ms=50);
  38. void StopTimer ();
  39. public:
  40. virtual BOOL Create (CWnd *owner);
  41. CWnd *GetControl ();
  42. void GetTextExtent (LPCTSTR text, int& width, int& height);
  43. BOOL GetUseText ();
  44. virtual void Hide ();
  45. CWnd *Owner ();
  46. void SetControl (CWnd *control);
  47. void SetUseText (BOOL useText);
  48. virtual void Show ();
  49. // ClassWizard-controlled
  50. public:
  51. //{{AFX_VIRTUAL(CAdUiTipWindow)
  52. //}}AFX_VIRTUAL
  53. protected:
  54. //{{AFX_MSG(CAdUiTipWindow)
  55. afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
  56. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  57. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  58. afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
  59. afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
  60. afx_msg void OnNcDestroy();
  61. afx_msg void OnPaint();
  62. afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
  63. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  64. afx_msg void OnTimer(UINT_PTR nIDEvent);
  65. //}}AFX_MSG
  66. DECLARE_MESSAGE_MAP()
  67. };
  68. #pragma warning(pop)
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CAdUiBalloonTip window - INTERNAL USE ONLY
  71. class ADUI_PORT CAdUiBalloonTip : public CAdUiTipWindow {
  72. DECLARE_DYNAMIC(CAdUiBalloonTip)
  73. public:
  74. CAdUiBalloonTip ();
  75. virtual ~CAdUiBalloonTip ();
  76. // Text Tip
  77. protected:
  78. CPoint m_initialCursorPos;
  79. virtual void DrawBorder (CDC& dc, CRect& rExterior, CRect& rInterior);
  80. virtual void DrawContent (CDC& dc, CRect& rInterior);
  81. public:
  82. virtual void Hide ();
  83. virtual void Show ();
  84. // ClassWizard-controlled
  85. public:
  86. //{{AFX_VIRTUAL(CAdUiBalloonTip)
  87. //}}AFX_VIRTUAL
  88. protected:
  89. //{{AFX_MSG(CAdUiBalloonTip)
  90. afx_msg void OnTimer(UINT_PTR nIDEvent);
  91. //}}AFX_MSG
  92. DECLARE_MESSAGE_MAP()
  93. };
  94. /////////////////////////////////////////////////////////////////////////////
  95. // CAdUiTextTip window
  96. class ADUI_PORT CAdUiTextTip : public CAdUiTipWindow {
  97. DECLARE_DYNAMIC(CAdUiTextTip)
  98. public:
  99. CAdUiTextTip ();
  100. virtual ~CAdUiTextTip ();
  101. // Text Tip
  102. protected:
  103. virtual void DrawBorder (CDC& dc, CRect& rExterior, CRect& rInterior);
  104. virtual void DrawContent (CDC& dc, CRect& rInterior);
  105. public:
  106. virtual void Hide ();
  107. void Update (CWnd *control, BOOL useText);
  108. void UpdateIfNecessary (CWnd *control, BOOL useText);
  109. // ClassWizard-controlled
  110. public:
  111. //{{AFX_VIRTUAL(CAdUiTextTip)
  112. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  113. //}}AFX_VIRTUAL
  114. protected:
  115. //{{AFX_MSG(CAdUiTextTip)
  116. //}}AFX_MSG
  117. DECLARE_MESSAGE_MAP()
  118. };
  119. /////////////////////////////////////////////////////////////////////////////
  120. // CAdToolTipCtrl: for INTERNAL USE ONLY.
  121. class AdToolTip;
  122. #pragma warning(push)
  123. #pragma warning(disable : 4275)
  124. class ADUI_PORT CAdToolTipCtrl : public CToolTipCtrl{
  125. DECLARE_MESSAGE_MAP()
  126. public:
  127. CAdToolTipCtrl();
  128. virtual ~CAdToolTipCtrl ();
  129. virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  130. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  131. afx_msg void OnDestroy();
  132. static void SetToolTipsFlag(BOOL bToolTipsFlag);
  133. static void SetDeaultDelayTime(int nDelay);
  134. protected:
  135. virtual AdToolTip * CreateAdToolTipInstance();
  136. AdToolTip* m_pToolTip;
  137. BOOL m_bActivate;
  138. UINT m_nDelayTime;
  139. private:
  140. static BOOL m_bToolTipHasCreated;
  141. static BOOL m_bToolTipsFlag;
  142. static UINT m_nDefaultDealyTime;
  143. };
  144. #pragma warning(pop)
  145. /////////////////////////////////////////////////////////////////////////////
  146. // CAdWthToolTipCtrl, used for What's this help: for INTERNAL USE ONLY.
  147. class AdWthToolTip;
  148. class ADUI_PORT CAdWthToolTipCtrl : public CAdToolTipCtrl
  149. {
  150. DECLARE_MESSAGE_MAP()
  151. public:
  152. AdWthToolTip* GetWthToolTip();
  153. protected:
  154. virtual AdToolTip * CreateAdToolTipInstance();
  155. };
  156. /////////////////////////////////////////////////////////////////////////////
  157. // These functions are all for INTERNAL USE ONLY.
  158. void ADUI_PORT AdUiHideBalloonTip (CWnd *control);
  159. BOOL ADUI_PORT AdUiShowBalloonTip (
  160. CWnd *owner, CWnd *control, LPCTSTR text, BOOL beep
  161. );
  162. BOOL ADUI_PORT AdUiShowBalloonTip (
  163. CWnd *owner, CWnd *control, CRect& rect, LPCTSTR text, BOOL beep
  164. );
  165. #endif // _ADESK_MAC_
  166. /////////////////////////////////////////////////////////////////////////////
  167. //{{AFX_INSERT_LOCATION}}
  168. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  169. #pragma pack (pop)
  170. #endif
  171. //////////////////////////////////////////////////////////////////////////////