00001
00002
00003
00004
00005
00006 #ifndef _XPOPUPTIP_H_INCLUDE_
00007 #define _XPOPUPTIP_H_INCLUDE_
00008
00009 #if _MSC_VER >= 1000
00010 #pragma once
00011 #endif
00012
00013 #include <afxtempl.h>
00014
00015 class CXInfoTip : public CWnd
00016 {
00017 protected:
00018
00019 typedef struct
00020 {
00021 CString szText;
00022 HICON hIcon;
00023 } TipToolInfo;
00024
00025 enum
00026 {
00027 timerShow = 100,
00028 timerHide = 101,
00029 timerShowNAH = 102
00030 };
00031
00032 LPCTSTR m_szClass;
00033
00034 int m_nShowDelay;
00035
00036 CPoint m_ptOrigin;
00037
00038 CString m_szText;
00039 CString m_strCaption;
00040 int m_nCaptionHeight;
00041
00042 UINT m_nTimer;
00043
00044 HICON m_hIcon;
00045 CSize m_IconSize;
00046
00047 CFont *m_pFont;
00048 CFont m_fntBold;
00049
00050 CMap<HWND, HWND, TipToolInfo, TipToolInfo> m_ToolMap;
00051
00052 public:
00053 void SetAutohideDelay (int nDelay);
00054 BOOL is_DontShowChecked();
00055 CXInfoTip();
00056 virtual ~CXInfoTip();
00057
00058 BOOL Create(CWnd *parent);
00059
00060 void AddTool(CWnd *pWnd, LPCTSTR szTooltipText, HICON hIcon = NULL);
00061 void RemoveTool(CWnd *pWnd);
00062
00063 void Show(LPCSTR pszCaption, CString szText, BOOL bAutoHide = TRUE, CPoint *pt = NULL);
00064 void Hide() {
00065 ShowWindow(SW_HIDE);
00066 if (m_nTimer == timerShowNAH)
00067 m_nTimer = 0;
00068 };
00069
00070 void SetShowDelay(int nDelay) { m_nShowDelay = nDelay; };
00071
00072 void SetIcon(HICON hIcon);
00073
00074 void SetFont(CFont *pFont)
00075 {
00076 m_pFont = pFont;
00077 if (IsWindow(m_hWnd))
00078 RedrawWindow();
00079 };
00080
00081 void RelayEvent(LPMSG lpMsg);
00082
00083 protected:
00084 BOOL GetWindowRegion(CDC *pDC, HRGN* hRegion, CSize* Size = NULL);
00085
00086 protected:
00087 int m_nAutohideDelay;
00088 BOOL m_bShowDSA;
00089 BOOL m_bDSAChecked;
00090 afx_msg void OnDSA();
00091 afx_msg BOOL OnSetCursor (CWnd* pWnd, UINT nHitTest, UINT message);
00092 bool m_bPlaced;
00093 int m_yDSA, m_cxDSA;
00094 CBrush m_brWnd;
00095 afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
00096 CButton m_btnDSA;
00097 afx_msg void OnLButtonDown (UINT, CPoint);
00098
00099 afx_msg void OnPaint();
00100 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00101 afx_msg void OnTimer(UINT nIDEvent);
00102 afx_msg void OnDestroy();
00103
00104 DECLARE_MESSAGE_MAP()
00105 };
00106
00107
00108
00109 #endif