-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtdialog.cpp
107 lines (90 loc) · 2.1 KB
/
tdialog.cpp
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
100
101
102
103
104
105
106
107
/*
TDIALOG.CPP
Copyright (c) 1994 Shawn Halpenny
All rights reserved.
Source code module for TDialog class.
*/
#ifndef __WOLF_H
#include <wolf.h>
#endif
//done
TDialog::TDialog(PTWindowObject pParent, int nID) : TWindow(pParent, NULL, nID)
{
nStatus = 0;
} //TDialog::TDialog
//done
BOOL CALLBACK _export TDialog::DlgProc(HWND hWindow, UINT wMsg, WPARAM wParam, LPARAM lParam)
{
TMessage Msg;
Msg.hWindow = hWindow;
Msg.wMsg = wMsg;
Msg.wParam = wParam;
Msg.lParam = lParam;
Msg.lResult = TRUE;
return (BOOL) UMP(Msg);
} //TDialog::DlgProc
//done
BOOL TDialog::Create()
{
SetGlobalWindowObject(this);
return DialogBox(pApplication->hInstance, MAKEINTRESOURCE(nID), pParent->hWindow, TDialog::DlgProc) != -1;
} //TDialog::Create
//done
LONG TDialog::DefMsgHandler(RTMessage)
{
return FALSE;
} //TDialog::DefMsgHandler
//done
void TDialog::WMInitDialog(RTMessage Msg)
{
BI_DoubleListIteratorImp<PTWindowObject> ChildListIterator(ChildList);
PTWindowObject pChild;
while (int(ChildListIterator))
{
pChild = ChildListIterator++;
pChild->hWindow = GetDlgItem(hWindow, pChild->nID);
pChild->SetProperties();
};
DoTransfer(TF_SET);
Msg.lResult = InitDialog();
} //TDialog::WMInitDialog
//done
void TDialog::Okay(RTMessage)
{
//make sure dialog's transfer mechanism is active, since user clicked OK
//Transfer is performed in TWindowObject::WMDestroy
SetFlags(WB_TRANSFER, TRUE);
Destroy(IDOK);
} //TDialog::Okay
//done
void TDialog::Cancel(RTMessage)
{
//turn off transfer mechanism for dialog so it doesn't work when DoTransfer is
//called in TWindowObject::WMDestroy
SetFlags(WB_TRANSFER, FALSE);
Destroy(IDCANCEL);
} //TDialog::Cancel
//done
void TDialog::Destroy(int nStatus)
{
if (CanClose())
{
this->nStatus = nStatus;
EndDialog(hWindow, TRUE);
}
} //TDialog::Destroy
//done
void TDialog::WMClose(RTMessage Msg)
{
Cancel(Msg);
} //TDialog::WMClose
//done
WORD TDialog::GetDefault()
{
return (LOWORD(SendMessage(hWindow, DM_GETDEFID, 0, 0)));
} //TDialog::GetDefault
//done
void TDialog::SetDefault(int nID)
{
SendMessage(hWindow, DM_SETDEFID, nID, 0);
} //TDialog::SetDefault