summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2StewardDialog.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
committerAsh Wolf <ninji@wuffs.org>2023-06-28 22:22:32 +0100
commitc0c336500955a23e344651e5412c9d9d441ef4ee (patch)
tree790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2StewardDialog.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2StewardDialog.cpp73
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();
}