ToolTipEx.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #if !defined(AFX_ToolTipEx_H__5796127D_8817_493F_ACA7_8741A6759DD3__INCLUDED_)
  2. #define AFX_ToolTipEx_H__5796127D_8817_493F_ACA7_8741A6759DD3__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // ToolTipEx.h : header file
  7. //
  8. #include "RichEditCtrlEx.h"
  9. #include "WndEx.h"
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CToolTipEx window
  12. #define HIDE_WINDOW_TIMER 1
  13. class CToolTipEx : public CWnd
  14. {
  15. // Construction
  16. public:
  17. CToolTipEx();
  18. // Attributes
  19. public:
  20. // Operations
  21. public:
  22. BOOL OnMsg(MSG* pMsg);
  23. BOOL Create(CWnd* pParentWnd);
  24. BOOL Show(CPoint point);
  25. BOOL Hide();
  26. void SetToolTipText(const CString &csText);
  27. // void SetRTFText(const CString &csRTF);
  28. void SetRTFText(const char *pRTF);
  29. void SetBitmap(CBitmap *pBitmap);
  30. void SetNotifyWnd(CWnd *pNotify) { m_pNotifyWnd = pNotify; }
  31. void HideWindowInXMilliSeconds(long lms) { SetTimer(HIDE_WINDOW_TIMER, lms, NULL); }
  32. CRect GetBoundsRect();
  33. // Overrides
  34. // ClassWizard generated virtual function overrides
  35. //{{AFX_VIRTUAL(CToolTipEx)
  36. protected:
  37. virtual void PostNcDestroy();
  38. virtual BOOL PreTranslateMessage(MSG* pMsg);
  39. //}}AFX_VIRTUAL
  40. // Implementation
  41. public:
  42. virtual ~CToolTipEx();
  43. protected:
  44. DWORD m_dwTextStyle;
  45. CRect m_rectMargin;
  46. CString m_csText;
  47. CFont m_Font;
  48. CBitmap *m_pBitmap;
  49. CString m_csRTF;
  50. CRichEditCtrlEx m_RichEdit;
  51. CWnd *m_pNotifyWnd;
  52. protected:
  53. CString GetFieldFromString(CString ref, int nIndex, TCHAR ch);
  54. BOOL SetLogFont(LPLOGFONT lpLogFont, BOOL bRedraw /*=TRUE*/);
  55. LPLOGFONT GetSystemToolTipFont();
  56. BOOL IsCursorInToolTip();
  57. // Generated message map functions
  58. protected:
  59. //{{AFX_MSG(CToolTipEx)
  60. afx_msg void OnPaint();
  61. afx_msg void OnSize(UINT nType, int cx, int cy);
  62. afx_msg HITTEST_RET OnNcHitTest(CPoint point);
  63. afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
  64. //}}AFX_MSG
  65. DECLARE_MESSAGE_MAP()
  66. public:
  67. afx_msg void OnTimer(UINT_PTR nIDEvent);
  68. };
  69. /////////////////////////////////////////////////////////////////////////////
  70. //{{AFX_INSERT_LOCATION}}
  71. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  72. #endif // !defined(AFX_ToolTipEx_H__5796127D_8817_493F_ACA7_8741A6759DD3__INCLUDED_)