#include "T2DlgItemListBox.h" T2DlgItemListBox::T2DlgItemListBox(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItem(inDoc, inImageObj, inPalette) , mListBox(NULL) { } /*virtual*/ T2DlgItemListBox::~T2DlgItemListBox() { delete mListBox; } /*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& 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 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 inIndex, DWORD inData) { int result = -1; if (mListBox) { result = mListBox->SetItemData(inIndex, inData); if (result == -1) result = -1; // not very useful } return result; } /*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 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 inIndex) { void *result = (void *) -1; if (mListBox) result = mListBox->GetItemDataPtr(inIndex); return result; }