diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2DlgItemListBox.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2DlgItemListBox.cpp | 85 |
1 files changed, 77 insertions, 8 deletions
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; } |