diff options
Diffstat (limited to 'src/T2DLL/T2StewardDialog.cpp')
-rw-r--r-- | src/T2DLL/T2StewardDialog.cpp | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/src/T2DLL/T2StewardDialog.cpp b/src/T2DLL/T2StewardDialog.cpp index 74c6b0d..bda8675 100644 --- a/src/T2DLL/T2StewardDialog.cpp +++ b/src/T2DLL/T2StewardDialog.cpp @@ -1,13 +1,78 @@ +#include "GlobalFunc.h" +#include "T2DlgItemAnimation.h" #include "T2StewardDialog.h" -T2StewardDialog::T2StewardDialog(T2TowerDoc*, HINSTANCE, CString&, int) { +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*/ int T2StewardDialog::OnT2DialogCommand(unsigned int, long) { +/*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::MessageBoxA(const char*, const char*) { +/*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*, const char*) { +/*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(); } |