-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelp.cpp
More file actions
61 lines (47 loc) · 966 Bytes
/
Help.cpp
File metadata and controls
61 lines (47 loc) · 966 Bytes
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
/************
* MODULE: Help.cpp
* PROJECT: Lens (a demonstration program for my diploma)
* DESCRIPTION: Implements the helper methods
* AUTHORS: Mike Hesser
* BUGS: -
* TO DO: -
*************/
#include "Help.h"
#include "afxtempl.h"
// array of help items
CArray<tHelp, tHelp> aHelp;
void SetHelpRect(int no, int l, int t, int r, int b)
{
ASSERT(no >= 0 && no < _hlpEnd);
aHelp[no].rc.SetRect(l, t, r, b);
}
void SetHelpRect(CWnd *pWnd, int nID, int nCID)
{
ASSERT(pWnd);
CWnd *pCtrl;
CRect rc;
pCtrl = pWnd->GetDlgItem(nCID);
if (pCtrl)
{
pCtrl->GetWindowRect(rc);
pWnd->ScreenToClient(rc);
aHelp[nID].rc.SetRect(rc.left, rc.top, rc.right, rc.bottom);
}
}
void AddHelp(int nID)
{
tHelp h;
h.nID = nID;
h.rc.SetRect(0, 0, 0, 0);
aHelp.Add(h);
}
int GetHelpID(CPoint & point)
{
int i;
for (i = 0; i < aHelp.GetSize(); i++)
{
if (aHelp[i].rc.PtInRect(point))
return aHelp[i].nID;
}
return -1;
}