From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2DlgItemListBox.cpp | 85 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 8 deletions(-) (limited to 'src/T2DLL/T2DlgItemListBox.cpp') diff --git a/src/T2DLL/T2DlgItemListBox.cpp b/src/T2DLL/T2DlgItemListBox.cpp index d476f33..66ad24e 100644 --- a/src/T2DLL/T2DlgItemListBox.cpp +++ b/src/T2DLL/T2DlgItemListBox.cpp @@ -1,40 +1,109 @@ #include "T2DlgItemListBox.h" -T2DlgItemListBox::T2DlgItemListBox(T2TowerDoc*, T2ImageObj*, CPalette*) { +T2DlgItemListBox::T2DlgItemListBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) + : T2DlgItem(inDoc, inImageObj, inPalette) + , mListBox(NULL) +{ } /*virtual*/ T2DlgItemListBox::~T2DlgItemListBox() { + delete mListBox; } -/*virtual*/ void T2DlgItemListBox::SetFont(HFONT) { +/*virtual*/ void T2DlgItemListBox::SetFont(HFONT inFont) { + T2DlgItem::SetFont(inFont); + if (mListBox) + mListBox->SetFont(CFont::FromHandle(inFont)); } /*virtual*/ void T2DlgItemListBox::CreateSubItem() { + mListBox = new CListBox; + + CRect rect; + GetClientRect(rect); + mListBox->Create(LBS_NOTIFY | WS_VSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD, rect, this, 0); } /*virtual*/ int T2DlgItemListBox::GetCount() { + int result = -1; + if (mListBox) { + result = mListBox->GetCount(); + if (result == -1) + result = -1; // very useful + } + return result; } /*virtual*/ int T2DlgItemListBox::ResetContent() { + int result = -1; + if (mListBox) + mListBox->ResetContent(); + return result; } -/*virtual*/ int T2DlgItemListBox::AddString(CString&) { +/*virtual*/ int T2DlgItemListBox::AddString(CString& inString) { + int result = -1; + if (mListBox) { + result = mListBox->AddString(inString); + if (result == -1) + result = -1; // still very useful + } + return result; } -/*virtual*/ int T2DlgItemListBox::DeleteString(unsigned int) { +/*virtual*/ int T2DlgItemListBox::DeleteString(unsigned int inIndex) { + int result = -1; + if (mListBox) { + result = mListBox->DeleteString(inIndex); + if (result == -1) + result = -1; // quite useful + } + return result; } /*virtual*/ int T2DlgItemListBox::GetCurSel() { + int result = -1; + if (mListBox) { + result = mListBox->GetCurSel(); + if (result == -1) + result = -1; // yep, you guessed it, useful + } + return result; } -/*virtual*/ int T2DlgItemListBox::SetItemData(int, unsigned long) { +/*virtual*/ int T2DlgItemListBox::SetItemData(int inIndex, DWORD inData) { + int result = -1; + if (mListBox) { + result = mListBox->SetItemData(inIndex, inData); + if (result == -1) + result = -1; // not very useful + } + return result; } -/*virtual*/ unsigned long T2DlgItemListBox::GetItemData(int) { +/*virtual*/ DWORD T2DlgItemListBox::GetItemData(int inIndex) { + DWORD result = (DWORD) -1; + if (mListBox) { + result = mListBox->GetItemData(inIndex); + if (result == (DWORD) -1) + result = (DWORD) -1; // hmmm + } + return result; } -/*virtual*/ int T2DlgItemListBox::SetItemDataPtr(int, void*) { +/*virtual*/ int T2DlgItemListBox::SetItemDataPtr(int inIndex, void* inData) { + int result = -1; + if (mListBox) { + result = mListBox->SetItemDataPtr(inIndex, inData); + if (result == -1) + result = -1; // also of questionable utility + } + return result; } -/*virtual*/ void* T2DlgItemListBox::GetItemDataPtr(int) { +/*virtual*/ void* T2DlgItemListBox::GetItemDataPtr(int inIndex) { + void *result = (void *) -1; + if (mListBox) + result = mListBox->GetItemDataPtr(inIndex); + return result; } -- cgit v1.2.3