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
80
81
|
#include "StdAfx.h"
#include "T2MWControl.h"
#include "T2TowerDoc.h"
#include "T2DLL/T2WorldDef.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#line 19
IMPLEMENT_DYNCREATE(T2MWControl, CWnd)
T2MWControl::T2MWControl() {
mDocument = NULL;
mWorldDef = NULL;
mData = 0;
}
/*virtual*/ T2MWControl::~T2MWControl() {
}
BEGIN_MESSAGE_MAP(T2MWControl, CWnd)
//{{AFX_MSG_MAP(T2MWControl)
ON_WM_ERASEBKGND()
ON_WM_QUERYNEWPALETTE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/*virtual*/ void T2MWControl::Setup(T2TowerDoc *inDoc) {
mDocument = inDoc;
mWorldDef = inDoc->mWorldDef;
InvalidateRect(NULL);
}
afx_msg BOOL T2MWControl::OnEraseBkgnd(CDC* pDC) {
if (!mWorldDef)
return true;
mWorldDef->DrawCtrl(mDocument, this);
return true;
}
afx_msg BOOL T2MWControl::OnQueryNewPalette() {
return CWnd::OnQueryNewPalette();
}
/*virtual*/ void T2MWControl::SetData(int data) {
mData = data;
InvalidateRect(NULL);
}
/*virtual*/ int T2MWControl::GetData() const {
return mData;
}
afx_msg void T2MWControl::OnLButtonDown(UINT nFlags, CPoint point) {
if (mWorldDef)
mWorldDef->ButtonDownOnCtrl(mDocument, this, point, GetParent());
}
afx_msg void T2MWControl::OnLButtonUp(UINT nFlags, CPoint point) {
if (mWorldDef)
mWorldDef->ButtonUpOnCtrl(mDocument, this, point, GetParent());
}
afx_msg void T2MWControl::OnMouseMove(UINT nFlags, CPoint point) {
if (mWorldDef) {
CWinApp *theApp = AfxGetApp();
HCURSOR cursor = theApp->LoadStandardCursor(IDC_ARROW);
if (cursor)
SetCursor(cursor);
mWorldDef->MouseMoveOnCtrl(mDocument, this, point, GetParent());
}
}
|