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
|
#include "StdAfx.h"
#include "GlobalFunc.h"
#include "T2DlgItemAnimation.h"
#include "T2StewardDialog.h"
T2StewardDialog::T2StewardDialog(T2TowerDoc* inDoc, HINSTANCE inModule, CString& inText, int inKind) {
mDeleteOnClose = true;
CRect mainWndRect;
AfxGetMainWnd()->GetWindowRect(mainWndRect);
T2DLGTEMPLATE dlg;
dlg.pt = mainWndRect.CenterPoint();
dlg.moduleHandle = inModule;
dlg.resID = 9000;
Realize(inDoc, &dlg, inDoc, NULL, NULL, true, NULL, 0, true);
T2DlgItem *label = GetT2DlgItem(100);
if (label)
label->SetDescriptor(inText);
T2DlgItemAnimation *animation = (T2DlgItemAnimation *) GetT2DlgItem(101);
if (animation)
animation->SetAnimation(inModule, 9000, 0);
if (inKind == 1) {
T2DlgItem *theOkButton = GetT2DlgItem(200);
theOkButton->ShowWindow(SW_HIDE);
} else {
T2DlgItem *theYesButton = GetT2DlgItem(201);
T2DlgItem *theNoButton = GetT2DlgItem(202);
theYesButton->ShowWindow(SW_HIDE);
theNoButton->ShowWindow(SW_HIDE);
}
}
/*virtual*/ BOOL T2StewardDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) {
BOOL result = true;
WORD code = HIWORD(inWParam);
WORD id = LOWORD(inWParam);
switch (id) {
case 200:
case 201:
OnT2OK();
DoClose(id - 200);
break;
case 202:
OnT2Cancel();
DoClose(id - 200);
break;
default:
result = T2Dialog::OnT2DialogCommand(inWParam, inLParam);
}
return result;
}
/*static*/ void T2StewardDialog::MessageBox(const char* inText, const char* inTitle) {
T2StewardDialog *theDialog = new T2StewardDialog(GetCurrentT2TowerDoc(), GetWorldModuleHandle(), CString(inText), 0);
if (!inTitle) {
inTitle = "\x83\x81\x83\x62\x83\x5A\x81\x5B\x83\x57";
}
theDialog->SetWindowText(inTitle);
theDialog->DoModal();
}
/*static*/ int T2StewardDialog::MessageBoxYN(const char* inText, const char* inTitle) {
T2StewardDialog *theDialog = new T2StewardDialog(GetCurrentT2TowerDoc(), GetWorldModuleHandle(), CString(inText), 1);
if (!inTitle) {
inTitle = "\x83\x81\x83\x62\x83\x5A\x81\x5B\x83\x57";
}
theDialog->SetWindowText(inTitle);
return theDialog->DoModal();
}
|