Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
ListBox.h
Go to the documentation of this file.
1
/* Project nGenEx
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: nGenEx.lib
6
FILE: ListBox.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
ListBox ActiveWindow class
13
*/
14
15
#ifndef ListBox_h
16
#define ListBox_h
17
18
#include "
Types.h
"
19
#include "
ScrollWindow.h
"
20
#include "
List.h
"
21
22
// +--------------------------------------------------------------------+
23
24
class
Bitmap
;
25
class
ListBox
;
26
class
ListBoxCell
;
27
class
ListBoxItem
;
28
class
ListBoxColumn
;
29
30
// +--------------------------------------------------------------------+
31
32
class
ListBox
:
public
ScrollWindow
33
{
34
public
:
35
enum
SORT
{
LIST_SORT_NUMERIC_DESCENDING
= -2,
36
LIST_SORT_ALPHA_DESCENDING
,
37
LIST_SORT_NONE
,
38
LIST_SORT_ALPHA_ASCENDING
,
39
LIST_SORT_NUMERIC_ASCENDING
,
40
LIST_SORT_NEVER
41
};
42
43
enum
ALIGN
{
LIST_ALIGN_LEFT
= DT_LEFT,
44
LIST_ALIGN_CENTER
= DT_CENTER,
45
LIST_ALIGN_RIGHT
= DT_RIGHT
46
};
47
48
enum
STYLE
{
LIST_ITEM_STYLE_PLAIN
,
49
LIST_ITEM_STYLE_BOX
,
50
LIST_ITEM_STYLE_FILLED_BOX
51
};
52
53
ListBox
(
ActiveWindow
* p,
int
ax,
int
ay,
int
aw,
int
ah, DWORD aid);
54
ListBox
(
Screen
* s,
int
ax,
int
ay,
int
aw,
int
ah, DWORD aid);
55
virtual
~ListBox
();
56
57
// Operations:
58
virtual
void
DrawContent
(
const
Rect
& ctrl_rect);
59
60
// Event Target Interface:
61
virtual
int
OnMouseMove
(
int
x,
int
y);
62
virtual
int
OnLButtonDown
(
int
x,
int
y);
63
virtual
int
OnLButtonUp
(
int
x,
int
y);
64
virtual
int
OnMouseWheel
(
int
wheel);
65
virtual
int
OnClick
();
66
67
virtual
int
OnKeyDown
(
int
vk,
int
flags);
68
69
// pseudo-events:
70
virtual
int
OnDragStart
(
int
x,
int
y);
71
virtual
int
OnDragDrop
(
int
x,
int
y,
ActiveWindow
* source);
72
73
// Property accessors:
74
int
NumItems
();
75
int
NumColumns
();
76
77
Text
GetItemText
(
int
index);
78
void
SetItemText
(
int
index,
const
char
*
text
);
79
DWORD
GetItemData
(
int
index);
80
void
SetItemData
(
int
index, DWORD data);
81
Bitmap
*
GetItemImage
(
int
index);
82
void
SetItemImage
(
int
index,
Bitmap
* img);
83
Color
GetItemColor
(
int
index);
84
void
SetItemColor
(
int
index,
Color
c);
85
86
Text
GetItemText
(
int
index,
int
column);
87
void
SetItemText
(
int
index,
int
column,
const
char
*
text
);
88
DWORD
GetItemData
(
int
index,
int
column);
89
void
SetItemData
(
int
index,
int
column, DWORD data);
90
Bitmap
*
GetItemImage
(
int
index,
int
column);
91
void
SetItemImage
(
int
index,
int
column,
Bitmap
* img);
92
93
int
AddItem
(
const
char
*
text
);
94
int
AddImage
(
Bitmap
* img);
95
int
AddItemWithData
(
const
char
*
text
,
int
data);
96
void
InsertItem
(
int
index,
const
char
*
text
);
97
void
InsertItemWithData
(
int
index,
const
char
*
text
,
int
data);
98
void
ClearItems
();
99
void
RemoveItem
(
int
index);
100
void
RemoveSelectedItems
();
101
102
void
AddColumn
(
const
char
* title,
103
int
width,
104
int
align =
ListBox::LIST_ALIGN_LEFT
,
105
int
sort =
ListBox::LIST_SORT_NONE
);
106
107
Text
GetColumnTitle
(
int
index);
108
void
SetColumnTitle
(
int
index,
const
char
* title);
109
int
GetColumnWidth
(
int
index);
110
void
SetColumnWidth
(
int
index,
int
width);
111
int
GetColumnAlign
(
int
index);
112
void
SetColumnAlign
(
int
index,
int
align);
113
int
GetColumnSort
(
int
index);
114
void
SetColumnSort
(
int
index,
int
sort);
115
Color
GetColumnColor
(
int
index);
116
void
SetColumnColor
(
int
index,
Color
c);
117
118
Color
GetItemColor
(
int
index,
int
column);
119
120
int
GetMultiSelect
();
121
void
SetMultiSelect
(
int
nNewValue);
122
bool
GetShowHeadings
();
123
void
SetShowHeadings
(
bool
nNewValue);
124
Color
GetSelectedColor
();
125
void
SetSelectedColor
(
Color
c);
126
127
int
GetItemStyle
()
const
;
128
void
SetItemStyle
(
int
style
);
129
int
GetSelectedStyle
()
const
;
130
void
SetSelectedStyle
(
int
style
);
131
132
bool
IsSelected
(
int
index);
133
void
SetSelected
(
int
index,
bool
bNewValue=
true
);
134
void
ClearSelection
();
135
136
int
GetSortColumn
();
137
void
SetSortColumn
(
int
col_index);
138
int
GetSortCriteria
();
139
void
SetSortCriteria
(
SORT
sort);
140
void
SortItems
();
141
void
SizeColumns
();
142
143
// read-only:
144
virtual
int
GetListIndex
();
145
virtual
int
GetLineCount
();
146
virtual
int
GetSelCount
();
147
virtual
int
GetSelection
();
148
virtual
Text
GetSelectedItem
();
149
150
protected
:
151
int
IndexFromPoint
(
int
x,
int
y)
const
;
152
153
// properties:
154
List<ListBoxItem>
items
;
155
List<ListBoxColumn>
columns
;
156
157
bool
show_headings
;
158
int
multiselect
;
159
int
list_index
;
160
int
selcount
;
161
162
Color
selected_color
;
163
164
int
sort_column
;
165
int
item_style
;
166
int
seln_style
;
167
};
168
169
#endif ListBox_h
170
nGenEx
ListBox.h
Generated on Tue Jun 5 2012 20:46:24 for Starshatter_Open by
1.8.1