summaryrefslogtreecommitdiff
path: root/src/T2MWControl.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/T2MWControl.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r--src/T2MWControl.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/T2MWControl.cpp b/src/T2MWControl.cpp
new file mode 100644
index 0000000..a6527f1
--- /dev/null
+++ b/src/T2MWControl.cpp
@@ -0,0 +1,69 @@
+#include "T2MWControl.h"
+#include "T2TowerDoc.h"
+#include "T2WorldDef.h"
+
+#line 19
+IMPLEMENT_DYNCREATE(T2MWControl, CWnd)
+
+T2MWControl::T2MWControl() {
+ mDocument = NULL;
+ mWorldDef = NULL;
+ mData = 0;
+}
+
+/*virtual*/ T2MWControl::~T2MWControl() {
+}
+
+BEGIN_MESSAGE_MAP(T2MWControl, CWnd)
+ ON_WM_ERASEBKGND()
+ ON_WM_QUERYNEWPALETTE()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+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)
+ 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) {
+ HCURSOR cursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
+ if (cursor)
+ SetCursor(cursor);
+
+ mWorldDef->MouseMoveOnCtrl(mDocument, this, point, GetParent());
+ }
+}