Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
FormDef.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: FormDef.h
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Form and Control Definition Resources
13
*/
14
15
#ifndef FormDef_h
16
#define FormDef_h
17
18
#include <vector>
19
#include "
Types.h
"
20
#include "
Geometry.h
"
21
#include "
Color.h
"
22
#include "
Text.h
"
23
#include "
List.h
"
24
25
// +--------------------------------------------------------------------+
26
27
class
FormDef
;
// values defining form style and control placement
28
class
CtrlDef
;
// values defining control style
29
class
WinDef
;
// base class for FormDef and CtrlDef
30
class
TermStruct
;
// used for parsing
31
32
enum
WinType
{
33
WIN_DEF_FORM
,
34
WIN_DEF_LABEL
,
35
WIN_DEF_BUTTON
,
36
WIN_DEF_COMBO
,
37
WIN_DEF_EDIT
,
38
WIN_DEF_IMAGE
,
39
WIN_DEF_SLIDER
,
40
WIN_DEF_LIST
,
41
WIN_DEF_RICH
42
};
43
44
// +--------------------------------------------------------------------+
45
46
class
ColumnDef
47
{
48
public
:
49
static
const
char
*
TYPENAME
() {
return
"ColumnDef"
; }
50
51
ColumnDef
();
52
ColumnDef
(
const
char
*
title
,
int
width
,
int
align
,
int
sort
);
53
54
Text
title
;
55
int
width
;
56
int
align
;
57
int
sort
;
58
Color
color
;
59
bool
use_color
;
60
};
61
62
// +--------------------------------------------------------------------+
63
64
class
LayoutDef
65
{
66
public
:
67
static
const
char
*
TYPENAME
() {
return
"LayoutDef"
; }
68
69
std::vector<DWORD>
x_mins
;
70
std::vector<DWORD>
y_mins
;
71
std::vector<float>
x_weights
;
72
std::vector<float>
y_weights
;
73
};
74
75
// +--------------------------------------------------------------------+
76
77
class
WinDef
78
{
79
friend
class
FormDef
;
80
81
public
:
82
static
const
char
*
TYPENAME
() {
return
"WinDef"
; }
83
84
WinDef
(DWORD
id
, DWORD
type
,
const
char
*
text
=0, DWORD
style
=0);
85
virtual
~WinDef
() { }
86
87
int
operator ==
(
const
WinDef
& w)
const
{
return
id
== w.
id
; }
88
89
DWORD
GetID
()
const
{
return
id
; }
90
void
SetID
(DWORD
id
);
91
DWORD
GetParentID
()
const
{
return
pid
; }
92
void
SetParentID
(DWORD
id
);
93
DWORD
GetType
()
const
{
return
type
; }
94
void
SetType
(DWORD
type
);
95
96
void
SetRect
(
const
Rect
& r);
97
Rect
GetRect
()
const
{
return
rect
; }
98
int
GetX
()
const
{
return
rect
.
x
; }
99
int
GetY
()
const
{
return
rect
.
y
; }
100
int
GetW
()
const
{
return
rect
.
w
; }
101
int
GetH
()
const
{
return
rect
.
h
; }
102
103
void
SetEnabled
(
bool
enable=
true
);
104
bool
IsEnabled
()
const
{
return
enabled
; }
105
106
void
SetStyle
(DWORD s);
107
DWORD
GetStyle
()
const
{
return
style
; }
108
109
void
SetFont
(
const
char
* t);
110
const
Text
&
GetFont
()
const
{
return
font
; }
111
void
SetText
(
const
char
* t);
112
const
Text
&
GetText
()
const
{
return
text
; }
113
void
SetAltText
(
const
char
* t);
114
const
Text
&
GetAltText
()
const
{
return
alt_text
; }
115
void
SetTexture
(
const
char
* t);
116
const
Text
&
GetTexture
()
const
{
return
texture
; }
117
118
void
SetBackColor
(
Color
c);
119
Color
GetBackColor
()
const
{
return
back_color
; }
120
void
SetBaseColor
(
Color
c);
121
Color
GetBaseColor
()
const
{
return
base_color
; }
122
void
SetForeColor
(
Color
c);
123
Color
GetForeColor
()
const
{
return
fore_color
; }
124
void
SetSingleLine
(
bool
a);
125
bool
GetSingleLine
()
const
{
return
single_line
; }
126
void
SetTextAlign
(DWORD a);
127
DWORD
GetTextAlign
()
const
{
return
text_align
; }
128
void
SetTransparent
(
bool
t);
129
bool
GetTransparent
()
const
{
return
transparent
; }
130
void
SetHidePartial
(
bool
a);
131
bool
GetHidePartial
()
const
{
return
hide_partial
;}
132
133
void
SetMargins
(
const
Insets
& m);
134
const
Insets
&
GetMargins
()
const
{
return
margins
; }
135
void
SetTextInsets
(
const
Insets
& t);
136
const
Insets
&
GetTextInsets
()
const
{
return
text_insets
; }
137
void
SetCellInsets
(
const
Insets
& t);
138
const
Insets
&
GetCellInsets
()
const
{
return
cell_insets
; }
139
void
SetCells
(
const
Rect
& r);
140
const
Rect
&
GetCells
()
const
{
return
cells
; }
141
142
void
SetFixedWidth
(
int
w) {
fixed_width
= w; }
143
int
GetFixedWidth
()
const
{
return
fixed_width
; }
144
void
SetFixedHeight
(
int
h) {
fixed_height
= h; }
145
int
GetFixedHeight
()
const
{
return
fixed_height
;}
146
147
const
LayoutDef
&
GetLayout
()
const
{
return
layout
; }
148
149
protected
:
150
DWORD
id
;
151
DWORD
pid
;
152
DWORD
type
;
153
Rect
rect
;
154
Text
font
;
155
Text
text
;
156
Text
alt_text
;
157
Text
texture
;
158
Text
picture
;
159
DWORD
style
;
160
DWORD
text_align
;
161
bool
single_line
;
162
bool
enabled
;
163
bool
transparent
;
164
bool
hide_partial
;
165
Color
back_color
;
166
Color
base_color
;
167
Color
fore_color
;
168
169
Insets
margins
;
170
Insets
text_insets
;
171
Insets
cell_insets
;
172
Rect
cells
;
173
int
fixed_width
;
174
int
fixed_height
;
175
176
LayoutDef
layout
;
177
};
178
179
// +--------------------------------------------------------------------+
180
181
class
CtrlDef
:
public
WinDef
182
{
183
public
:
184
static
const
char
*
TYPENAME
() {
return
"CtrlDef"
; }
185
186
CtrlDef
(DWORD
id
=0, DWORD
type
=
WIN_DEF_LABEL
,
const
char
*
text
=0, DWORD
style
=0);
187
virtual
~CtrlDef
();
188
189
virtual
CtrlDef
&
operator=
(
const
CtrlDef
& ctrl);
190
191
bool
GetActive
()
const
;
192
void
SetActive
(
bool
c);
193
Color
GetActiveColor
()
const
;
194
void
SetActiveColor
(
Color
c);
195
bool
GetAnimated
()
const
;
196
void
SetAnimated
(
bool
bNewValue);
197
short
GetBevelWidth
()
const
;
198
void
SetBevelWidth
(
short
nNewValue);
199
bool
GetBorder
()
const
;
200
void
SetBorder
(
bool
bNewValue);
201
Color
GetBorderColor
()
const
;
202
void
SetBorderColor
(
Color
c);
203
bool
GetDropShadow
()
const
;
204
void
SetDropShadow
(
bool
bNewValue);
205
bool
GetIndent
()
const
;
206
void
SetIndent
(
bool
bNewValue);
207
bool
GetInvertLabel
()
const
;
208
void
SetInvertLabel
(
bool
bNewValue);
209
int
GetOrientation
()
const
;
210
void
SetOrientation
(
int
o);
211
Text
GetPicture
()
const
;
212
void
SetPicture
(
const
Text
& img_name);
213
short
GetPictureLocation
()
const
;
214
void
SetPictureLocation
(
short
nNewValue);
215
short
GetPictureType
()
const
;
216
void
SetPictureType
(
short
nNewValue);
217
bool
GetSticky
()
const
;
218
void
SetSticky
(
bool
bNewValue);
219
int
GetNumLeds
()
const
;
220
void
SetNumLeds
(
int
nNewValue);
221
222
int
NumItems
()
const
;
223
Text
GetItem
(
int
i)
const
;
224
void
AddItem
(
const
char
* t);
225
226
int
NumColumns
()
const
;
227
ColumnDef
*
GetColumn
(
int
i)
const
;
228
void
AddColumn
(
const
char
* t,
int
w,
int
a,
int
s);
229
230
int
NumTabs
()
const
;
231
int
GetTab
(
int
i)
const
;
232
void
SetTab
(
int
i,
int
t);
233
void
AddTab
(
int
i);
234
235
bool
GetShowHeadings
()
const
;
236
void
SetShowHeadings
(
bool
bNewValue);
237
int
GetLeading
()
const
;
238
void
SetLeading
(
int
nNewValue);
239
int
GetLineHeight
()
const
;
240
void
SetLineHeight
(
int
nNewValue);
241
int
GetMultiSelect
()
const
;
242
void
SetMultiSelect
(
int
nNewValue);
243
int
GetDragDrop
()
const
;
244
void
SetDragDrop
(
int
nNewValue);
245
int
GetScrollBarVisible
()
const
;
246
void
SetScrollBarVisible
(
int
nNewValue);
247
bool
GetSmoothScroll
()
const
;
248
void
SetSmoothScroll
(
bool
bNewValue);
249
250
short
GetItemStyle
()
const
;
251
void
SetItemStyle
(
short
nNewValue);
252
short
GetSelectedStyle
()
const
;
253
void
SetSelectedStyle
(
short
nNewValue);
254
255
char
GetPasswordChar
()
const
;
256
void
SetPasswordChar
(
char
c);
257
258
Text
GetStandardImage
()
const
;
259
void
SetStandardImage
(
const
Text
& img_name);
260
Text
GetActivatedImage
()
const
;
261
void
SetActivatedImage
(
const
Text
& img_name);
262
Text
GetTransitionImage
()
const
;
263
void
SetTransitionImage
(
const
Text
& img_name);
264
265
protected
:
266
WORD
ctrl_flags
;
267
short
bevel_width
;
268
269
Color
active_color
;
270
Color
border_color
;
271
272
Text
picture
;
273
short
picture_loc
;
274
short
picture_type
;
275
276
Text
standard_image
;
277
Text
activated_image
;
278
Text
transition_image
;
279
280
bool
active
;
281
bool
show_headings
;
282
int
leading
;
283
int
line_height
;
284
int
multiselect
;
285
int
dragdrop
;
286
int
scroll_bar
;
287
int
orientation
;
288
int
num_leds
;
289
290
short
item_style
;
291
short
selected_style
;
292
293
bool
smooth_scroll
;
294
295
List<Text>
items
;
296
List<ColumnDef>
columns
;
297
298
int
ntabs
;
299
int
tabs
[10];
300
char
pass_char
;
301
};
302
303
// +--------------------------------------------------------------------+
304
305
class
FormDef
:
public
WinDef
306
{
307
public
:
308
static
const
char
*
TYPENAME
() {
return
"FormDef"
; }
309
310
FormDef
(
const
char
*
text
=0, DWORD
style
=0);
311
virtual
~FormDef
();
312
313
void
Load
(
const
char
* filename);
314
315
void
AddCtrl
(
CtrlDef
* def);
316
CtrlDef
*
FindCtrl
(BYTE ctrl_id);
317
318
ListIter<CtrlDef>
GetControls
()
const
;
319
320
protected
:
321
void
ParseCtrlDef
(
CtrlDef
* ctrl,
TermStruct
* val);
322
void
ParseColumnDef
(
CtrlDef
* ctrl,
TermStruct
* val);
323
void
ParseLayoutDef
(
LayoutDef
* def,
TermStruct
* val);
324
325
CtrlDef
defctrl
;
326
List<CtrlDef>
controls
;
327
};
328
329
// +--------------------------------------------------------------------+
330
331
#endif FormDef_h
332
nGenEx
FormDef.h
Generated on Tue Jun 5 2012 20:46:22 for Starshatter_Open by
1.8.1