#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(); }