1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#include "StdAfx.h"
#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;
}
|