From 37e364b2c6cc7487a1c888d256a73e5337bb7189 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 14 Jun 2023 00:50:34 +0100 Subject: initial commit --- src/T2DLL/T2DlgItem.cpp | 200 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 src/T2DLL/T2DlgItem.cpp (limited to 'src/T2DLL/T2DlgItem.cpp') diff --git a/src/T2DLL/T2DlgItem.cpp b/src/T2DLL/T2DlgItem.cpp new file mode 100644 index 0000000..f7b7b7e --- /dev/null +++ b/src/T2DLL/T2DlgItem.cpp @@ -0,0 +1,200 @@ +#include "T2DlgItem.h" + +T2DlgItem::T2DlgItem() { +} + +T2DlgItem::T2DlgItem(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette) { + mTowerDoc = towerDoc; + mImageObj = imageObj; + mPalette = palette; + mPattern = 0; + m74 = 0; + mFont = NULL; + mValue = 0; +} + +/*virtual*/ T2DlgItem::~T2DlgItem() { +} + +BEGIN_MESSAGE_MAP(T2DlgItem, CWnd) + ON_WM_ERASEBKGND() + ON_WM_LBUTTONDOWN() + ON_WM_LBUTTONUP() + ON_WM_RBUTTONDOWN() + ON_WM_RBUTTONUP() + ON_WM_MOUSEMOVE() + ON_WM_ENABLE() + ON_WM_CREATE() + ON_WM_SIZE() + ON_WM_SETFOCUS() + ON_WM_KILLFOCUS() + ON_WM_TIMER() + 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; + CString className = AfxRegisterWndClass( + WS_EX_CLIENTEDGE, + LoadCursor(NULL, IDC_ARROW), + (HBRUSH) GetStockObject(WHITE_BRUSH), + NULL); + return CWnd::Create(className, windowName, style, crect, parentWnd, nId); +} + +/*virtual*/ T2BitImage* T2DlgItem::GetObjectImage(RECT&, const char*, int, int, int, int) const { + // TODO T2ImageObj, T2TowerDoc, T2WorldDef + return 0; +} + +/*virtual*/ void T2DlgItem::PostNcDestroy() { + DestroySelf(); +} + +/*virtual*/ void T2DlgItem::DestroySelf() { + delete this; +} + +/*virtual*/ int T2DlgItem::OnT2DlgItemEraseBkgnd(CDC*) { + return false; +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemLButtonDown(UINT nFlags, CPoint pt) { +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemLButtonUp(UINT nFlags, CPoint pt) { +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemRButtonDown(UINT nFlags, CPoint pt) { +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemRButtonUp(UINT nFlags, CPoint pt) { +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemMouseMove(UINT nFlags, CPoint pt) { +} + +/*virtual*/ void T2DlgItem::OnT2DlgItemEnable(int) { + Invalidate(); +} + +/*virtual*/ int T2DlgItem::OnT2DlgItemCreate(CREATESTRUCT*) { + return false; +} + +int T2DlgItem::OnEraseBkgnd(CDC* dc) { + return OnT2DlgItemEraseBkgnd(dc); +} + +void T2DlgItem::OnLButtonDown(UINT nFlags, CPoint pt) { + OnT2DlgItemLButtonDown(nFlags, pt); +} + +void T2DlgItem::OnLButtonUp(UINT nFlags, CPoint pt) { + OnT2DlgItemLButtonUp(nFlags, pt); +} + +void T2DlgItem::OnRButtonDown(UINT nFlags, CPoint pt) { + OnT2DlgItemRButtonDown(nFlags, pt); +} + +void T2DlgItem::OnRButtonUp(UINT nFlags, CPoint pt) { + OnT2DlgItemRButtonUp(nFlags, pt); +} + +void T2DlgItem::OnMouseMove(UINT nFlags, CPoint pt) { + OnT2DlgItemMouseMove(nFlags, pt); +} + +void T2DlgItem::OnEnable(int v) { + CWnd::OnEnable(v); + OnT2DlgItemEnable(v); +} + +int T2DlgItem::OnCreate(CREATESTRUCT* cs) { + if (CWnd::OnCreate(cs) == -1) + return -1; + return OnT2DlgItemCreate(cs); +} + +/*virtual*/ void T2DlgItem::CreateSubItem(void*) { +} + +/*virtual*/ void T2DlgItem::SetFont(HFONT font) { + mFont = font; + Invalidate(); +} + +/*virtual*/ int T2DlgItem::GetValue() { + return mValue; +} + +/*virtual*/ void T2DlgItem::SetValue(int value) { + mValue = value; + Invalidate(); +} + +/*virtual*/ void T2DlgItem::GetDescriptor(CString& outStr) const { + GetWindowText(outStr); +} + +/*virtual*/ void T2DlgItem::SetDescriptor(const CString& str) { + SetWindowText(str); +} + +void T2DlgItem::Notify(unsigned short msg, void* data) { + Notify(GetDlgCtrlID(), msg, data); +} + +void T2DlgItem::Notify(unsigned short id, unsigned short msg, void* data) { + BroadcastMessage(id, data); + GetParent()->SendMessage(WM_COMMAND, id | (msg << 16), (LPARAM) m_hWnd); +} + +int T2DlgItem::GetPattern() const { + return IsWindowEnabled() ? mPattern : 200; +} + +void T2DlgItem::SetPattern(int pattern) { + mPattern = pattern; +} + +void T2DlgItem::OnSize(UINT nType, int cx, int cy) { + CWnd::OnSize(nType, cx, cy); + OnT2Size(nType, cx, cy); +} + +/*virtual*/ void T2DlgItem::OnT2Size(UINT nType, int cx, int cy) { +} + +void T2DlgItem::OnSetFocus(CWnd* wnd) { + CWnd::OnSetFocus(wnd); + OnT2SetFocus(wnd); +} + +void T2DlgItem::OnKillFocus(CWnd* wnd) { + CWnd::OnKillFocus(wnd); + OnT2KillFocus(wnd); +} + +/*virtual*/ void T2DlgItem::OnT2SetFocus(CWnd* wnd) { +} + +/*virtual*/ void T2DlgItem::OnT2KillFocus(CWnd* wnd) { +} + +void T2DlgItem::OnTimer(UINT id) { + OnT2Timer(id); + CWnd::OnTimer(id); +} + +/*virtual*/ void T2DlgItem::OnT2Timer(UINT id) { +} + +void T2DlgItem::OnClose() { + OnT2Close(); + CWnd::OnClose(); +} + +/*virtual*/ void T2DlgItem::OnT2Close() { +} -- cgit v1.2.3