-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChildToolTip.cpp
More file actions
59 lines (52 loc) · 1.33 KB
/
Copy pathChildToolTip.cpp
File metadata and controls
59 lines (52 loc) · 1.33 KB
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
// Copyleft 2004 Chris Korda
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or any later version.
/*
chris korda
revision history:
rev date comments
00 27jan04 initial version
implement tooltips for children of a window
*/
#include "stdafx.h"
#include "ChildTooltip.h"
CChildToolTip::CChildToolTip()
{
m_ToolTip = NULL;
}
CChildToolTip::~CChildToolTip()
{
delete m_ToolTip;
}
BOOL CChildToolTip::EnableToolTips(CWnd *pWnd, BOOL bEnable, BOOL UseDlgIDs)
{
if (bEnable) {
if (m_ToolTip != NULL)
return(TRUE); // already enabled, nothing to do
m_ToolTip = new CToolTipCtrl;
if (!m_ToolTip->Create(pWnd))
return(FALSE);
// iterate over our child controls, adding them to tooltip
CWnd *p = pWnd->GetWindow(GW_CHILD);
while (p != NULL) {
if (UseDlgIDs) {
int nID = p->GetDlgCtrlID();
if (nID != -1) {
if (!m_ToolTip->AddTool(p, nID))
return(FALSE);
}
} else {
if (!m_ToolTip->AddTool(p))
return(FALSE);
}
p = p->GetWindow(GW_HWNDNEXT);
}
} else {
if (m_ToolTip == NULL)
return(TRUE); // already disabled, nothing to do
delete m_ToolTip;
m_ToolTip = NULL;
}
return(TRUE);
}