summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DlgItem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2DlgItem.cpp')
-rw-r--r--src/T2DLL/T2DlgItem.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/T2DLL/T2DlgItem.cpp b/src/T2DLL/T2DlgItem.cpp
index f7b7b7e..ac4a70b 100644
--- a/src/T2DLL/T2DlgItem.cpp
+++ b/src/T2DLL/T2DlgItem.cpp
@@ -1,4 +1,7 @@
#include "T2DlgItem.h"
+#include "T2ImageObj.h"
+#include "T2TowerDoc.h"
+#include "T2WorldDef.h"
T2DlgItem::T2DlgItem() {
}
@@ -32,19 +35,33 @@ BEGIN_MESSAGE_MAP(T2DlgItem, CWnd)
ON_WM_CLOSE()
END_MESSAGE_MAP()
-/*virtual*/ BOOL T2DlgItem::Create(const char* windowName, DWORD style, const RECT& rect, CWnd* parentWnd, UINT nId) {
- CRect crect = rect;
+/*virtual*/ BOOL T2DlgItem::Create(const char* inWindowName, DWORD inStyle, const RECT& inRect, CWnd* inParentWnd, UINT inID) {
+ CRect crect = inRect;
CString className = AfxRegisterWndClass(
WS_EX_CLIENTEDGE,
LoadCursor(NULL, IDC_ARROW),
(HBRUSH) GetStockObject(WHITE_BRUSH),
NULL);
- return CWnd::Create(className, windowName, style, crect, parentWnd, nId);
+ return CWnd::Create(className, inWindowName, inStyle, crect, inParentWnd, inID);
}
-/*virtual*/ T2BitImage* T2DlgItem::GetObjectImage(RECT&, const char*, int, int, int, int) const {
- // TODO T2ImageObj, T2TowerDoc, T2WorldDef
- return 0;
+/*virtual*/ T2BitImage* T2DlgItem::GetObjectImage(RECT& outRect, const char* inName, int inPattern, int inGrade, int inSpan, int inOffset) const {
+ T2BitImage *theImage = NULL;
+ int index;
+
+ if (mImageObj) {
+ index = mImageObj->FindObject(inName, inPattern, inGrade, inSpan, inOffset);
+ if (index != -1)
+ theImage = mImageObj->GetObjectImage(index, outRect);
+ }
+
+ if (!theImage && mTowerDoc && mTowerDoc->mWorldDef) {
+ index = mTowerDoc->mWorldDef->mImageObj->FindObject(inName, inPattern, inGrade, inSpan, inOffset);
+ if (index != -1)
+ theImage = mTowerDoc->mWorldDef->mImageObj->GetObjectImage(index, outRect);
+ }
+
+ return theImage;
}
/*virtual*/ void T2DlgItem::PostNcDestroy() {
@@ -55,7 +72,7 @@ END_MESSAGE_MAP()
delete this;
}
-/*virtual*/ int T2DlgItem::OnT2DlgItemEraseBkgnd(CDC*) {
+/*virtual*/ BOOL T2DlgItem::OnT2DlgItemEraseBkgnd(CDC*) {
return false;
}
@@ -82,8 +99,8 @@ END_MESSAGE_MAP()
return false;
}
-int T2DlgItem::OnEraseBkgnd(CDC* dc) {
- return OnT2DlgItemEraseBkgnd(dc);
+BOOL T2DlgItem::OnEraseBkgnd(CDC* pDC) {
+ return OnT2DlgItemEraseBkgnd(pDC);
}
void T2DlgItem::OnLButtonDown(UINT nFlags, CPoint pt) {