summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2EventDialog.cpp
blob: be651d0d6cb75066cf59a715ffaf30ee7cab67fe (plain)
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
#include "StdAfx.h"
#include "CTokenizer.h"
#include "T2DlgItemAnimation.h"
#include "T2EventDialog.h"

/*static*/ T2EventDialog *T2EventDialog::Show(void *a, T2TowerDoc *inDoc, HINSTANCE inModule, int inResID) {
    T2EventDialog *theDialog = new T2EventDialog;

    CRect rect;
    AfxGetMainWnd()->GetWindowRect(rect);

    T2DLGTEMPLATE tmpl;
    tmpl.pt = rect.CenterPoint();
    tmpl.moduleHandle = inModule;
    tmpl.resID = inResID;
    theDialog->Realize(a, &tmpl, inDoc, NULL, NULL, true, NULL, 0, true);

    return theDialog;
}

T2EventDialog::T2EventDialog() {
}

/*virtual*/ void T2EventDialog::CreateDlgItem(CTokenizer& tokenizer, T2DialogDef& def) {
    if (!_stricmp(tokenizer.Current(), "ANIM")) {
        RECT rect;
        UINT id = tokenizer.NextInteger();
        rect.left = tokenizer.NextInteger();
        rect.top = tokenizer.NextInteger();
        rect.right = tokenizer.NextInteger();
        rect.bottom = tokenizer.NextInteger();

        T2DlgItemAnimation *anim = new T2DlgItemAnimation(mTowerDoc, mImageObj, mPalette);
        anim->Create("", def.flags, rect, this, id);
        anim->CreateSubItem(NULL);
        if (mCurrentFont >= 0)
            anim->SetFont(*mFonts[mCurrentFont]);
    } else {
        T2Dialog::CreateDlgItem(tokenizer, def);
    }
}

/*virtual*/ void T2EventDialog::ListenToMessage(unsigned int msg, void* data) {
    DoClose(msg);
}