summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItemAllPurpose.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/T2DlgItemAllPurpose.cpp
parent37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff)
downloadt2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz
t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2DlgItemAllPurpose.cpp')
-rw-r--r--src/T2DLL/T2DlgItemAllPurpose.cpp73
1 files changed, 67 insertions, 6 deletions
diff --git a/src/T2DLL/T2DlgItemAllPurpose.cpp b/src/T2DLL/T2DlgItemAllPurpose.cpp
index ae98b03..9a947f0 100644
--- a/src/T2DLL/T2DlgItemAllPurpose.cpp
+++ b/src/T2DLL/T2DlgItemAllPurpose.cpp
@@ -1,28 +1,89 @@
#include "T2DlgItemAllPurpose.h"
-T2DlgItemAllPurpose::T2DlgItemAllPurpose(T2TowerDoc*, T2ImageObj*, CPalette*) {
+T2DlgItemAllPurpose::T2DlgItemAllPurpose(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette)
+ : T2DlgItem(inDoc, inImageObj, inPalette)
+{
+#line 16
+ mDownPoint = DEBUG_NEW CPoint(-1, -1);
+ mUpPoint = DEBUG_NEW CPoint(-1, -1);
+ mButton = -1;
}
/*virtual*/ T2DlgItemAllPurpose::~T2DlgItemAllPurpose() {
+ delete mDownPoint;
+ delete mUpPoint;
}
-/*virtual*/ int T2DlgItemAllPurpose::OnT2DlgItemEraseBkgnd(CDC*) {
+/*virtual*/ BOOL T2DlgItemAllPurpose::OnT2DlgItemEraseBkgnd(CDC* pDC) {
+ CRect rect;
+ GetClientRect(rect);
+
+ int save = pDC->SaveDC();
+ pDC->SelectPalette(mPalette, false);
+ pDC->RealizePalette();
+
+ CPen whitePen;
+ whitePen.CreatePen(PS_SOLID, 0, PALETTERGB(255, 255, 255));
+ CPen greyPen;
+ greyPen.CreatePen(PS_SOLID, 0, PALETTERGB(133, 133, 133));
+
+ pDC->SelectObject(greyPen);
+ pDC->MoveTo(rect.right - 1, rect.top);
+ pDC->LineTo(rect.left, rect.top);
+ pDC->LineTo(rect.left, rect.bottom);
+
+ pDC->SelectObject(whitePen);
+ pDC->MoveTo(rect.right - 1, rect.top + 1);
+ pDC->LineTo(rect.right - 1, rect.bottom - 1);
+ pDC->LineTo(rect.left, rect.bottom - 1);
+
+ pDC->RestoreDC(save);
+
+ return true;
}
-/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemLButtonDown(unsigned int, CPoint) {
+/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemLButtonDown(UINT, CPoint inPt) {
+ *mDownPoint = inPt;
+ mButton = 0;
}
-/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemLButtonUp(unsigned int, CPoint) {
+/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemLButtonUp(UINT, CPoint inPt) {
+ *mUpPoint = inPt;
+
+ if (mButton == 0) {
+ mButton = 0;
+
+ CSize delta = *mDownPoint - *mUpPoint;
+ if (abs(delta.cx) < 2 && abs(delta.cy) < 2)
+ Notify(GetDlgCtrlID(), 0, &mButton);
+ } else {
+ mButton = 0;
+ }
}
-/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemRButtonDown(unsigned int, CPoint) {
+/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemRButtonDown(UINT, CPoint inPt) {
+ *mDownPoint = inPt;
+ mButton = 1;
}
-/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemRButtonUp(unsigned int, CPoint) {
+/*virtual*/ void T2DlgItemAllPurpose::OnT2DlgItemRButtonUp(UINT, CPoint inPt) {
+ *mUpPoint = inPt;
+
+ if (mButton == 1) {
+ mButton = 1;
+
+ CSize delta = *mDownPoint - *mUpPoint;
+ if (abs(delta.cx) < 2 && abs(delta.cy) < 2)
+ Notify(GetDlgCtrlID(), 0, &mButton);
+ } else {
+ mButton = 1;
+ }
}
CPoint T2DlgItemAllPurpose::GetUpPoint() {
+ return *mUpPoint;
}
CPoint T2DlgItemAllPurpose::GetDownPoint() {
+ return *mDownPoint;
}