-
Notifications
You must be signed in to change notification settings - Fork 0
/
XInfoTip.h
99 lines (74 loc) · 4.8 KB
/
XInfoTip.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//////////////////////////////////////////////////
//类名:CXInfoTip
//功能:提示窗消息显示
//修改人:徐景周(Johnny Xu, xujingzhou2016@gmail.com)
//组织:未来工作室(Future Studio)
//日期:2001.12.1
//////////////////////////////////////////////////
#ifndef _XPOPUPTIP_H_INCLUDE_
#define _XPOPUPTIP_H_INCLUDE_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
class CXInfoTip : public CWnd
{
protected:
///////////////////////////////////////////////////////////////////////////
// Tool information structure
///////////////////////////////////////////////////////////////////////////
typedef struct
{
CString szText; // Tooltip text
HICON hIcon; // Tooltip icon
} TipToolInfo;
// Timer identifiers
enum
{
timerShow = 100, // Show timer
timerHide = 101 // Hide timer
};
LPCTSTR m_szClass; // Window class
int m_nShowDelay; // Show delay
int m_nHideDelay; // 隐藏延时
CPoint m_ptOrigin; // Popup origin
CString m_szText; // Tip text
UINT m_nTimer; // Show/hide timer
HICON m_hIcon; // Tip icon
CSize m_IconSize; // Tip icon size
CFont *m_pFont; // Tip font
CMap<HWND, HWND, TipToolInfo, TipToolInfo> m_ToolMap; // Tools map
public:
CXInfoTip();
virtual ~CXInfoTip();
BOOL Create(CWnd *parent);
void AddTool(CWnd *pWnd, LPCTSTR szTooltipText, HICON hIcon = NULL);
void RemoveTool(CWnd *pWnd);
void Show(CString szText, CPoint *pt = NULL);
void Hide() { ShowWindow(SW_HIDE); };
// Sets the delay for the tooltip
void SetShowDelay(int nDelay) { m_nShowDelay = nDelay; };
//新增隐藏时间
void SetHideDelay(int nDelay) { m_nHideDelay = nDelay; };
void SetIcon(HICON hIcon);
// Sets the tooltip font
void SetFont(CFont *pFont)
{
m_pFont = pFont;
if (IsWindow(m_hWnd))
RedrawWindow();
};
void RelayEvent(LPMSG lpMsg);
protected:
BOOL GetWindowRegion(CDC *pDC, HRGN* hRegion, CSize* Size = NULL);
protected:
//{{AFX_MSG(CXInfoTip)
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif