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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
/* Project nGenEx
Destroyer Studios LLC
Copyright © 1997-2004. All Rights Reserved.
SUBSYSTEM: nGenEx.lib
FILE: FormDef.h
AUTHOR: John DiCamillo
OVERVIEW
========
Form and Control Definition Resources
*/
#ifndef FormDef_h
#define FormDef_h
#include <vector>
#include "Types.h"
#include "Geometry.h"
#include "Color.h"
#include "Text.h"
#include "List.h"
// +--------------------------------------------------------------------+
class FormDef; // values defining form style and control placement
class CtrlDef; // values defining control style
class WinDef; // base class for FormDef and CtrlDef
class TermStruct; // used for parsing
enum WinType {
WIN_DEF_FORM,
WIN_DEF_LABEL,
WIN_DEF_BUTTON,
WIN_DEF_COMBO,
WIN_DEF_EDIT,
WIN_DEF_IMAGE,
WIN_DEF_SLIDER,
WIN_DEF_LIST,
WIN_DEF_RICH
};
// +--------------------------------------------------------------------+
class ColumnDef
{
public:
static const char* TYPENAME() { return "ColumnDef"; }
ColumnDef();
ColumnDef(const char* title, int width, int align, int sort);
Text title;
int width;
int align;
int sort;
Color color;
bool use_color;
};
// +--------------------------------------------------------------------+
class LayoutDef
{
public:
static const char* TYPENAME() { return "LayoutDef"; }
std::vector<DWORD> x_mins;
std::vector<DWORD> y_mins;
std::vector<float> x_weights;
std::vector<float> y_weights;
};
// +--------------------------------------------------------------------+
class WinDef
{
friend class FormDef;
public:
static const char* TYPENAME() { return "WinDef"; }
WinDef(DWORD id, DWORD type, const char* text=0, DWORD style=0);
virtual ~WinDef() { }
int operator == (const WinDef& w) const { return id == w.id; }
DWORD GetID() const { return id; }
void SetID(DWORD id);
DWORD GetParentID() const { return pid; }
void SetParentID(DWORD id);
DWORD GetType() const { return type; }
void SetType(DWORD type);
void SetRect(const Rect& r);
Rect GetRect() const { return rect; }
int GetX() const { return rect.x; }
int GetY() const { return rect.y; }
int GetW() const { return rect.w; }
int GetH() const { return rect.h; }
void SetEnabled(bool enable=true);
bool IsEnabled() const { return enabled; }
void SetStyle(DWORD s);
DWORD GetStyle() const { return style; }
void SetFont(const char* t);
const Text& GetFont() const { return font; }
void SetText(const char* t);
const Text& GetText() const { return text; }
void SetAltText(const char* t);
const Text& GetAltText() const { return alt_text; }
void SetTexture(const char* t);
const Text& GetTexture() const { return texture; }
void SetBackColor(Color c);
Color GetBackColor() const { return back_color; }
void SetBaseColor(Color c);
Color GetBaseColor() const { return base_color; }
void SetForeColor(Color c);
Color GetForeColor() const { return fore_color; }
void SetSingleLine(bool a);
bool GetSingleLine() const { return single_line; }
void SetTextAlign(DWORD a);
DWORD GetTextAlign() const { return text_align; }
void SetTransparent(bool t);
bool GetTransparent() const { return transparent; }
void SetHidePartial(bool a);
bool GetHidePartial() const { return hide_partial;}
void SetMargins(const Insets& m);
const Insets& GetMargins() const { return margins; }
void SetTextInsets(const Insets& t);
const Insets& GetTextInsets() const { return text_insets; }
void SetCellInsets(const Insets& t);
const Insets& GetCellInsets() const { return cell_insets; }
void SetCells(const Rect& r);
const Rect& GetCells() const { return cells; }
void SetFixedWidth(int w) { fixed_width = w; }
int GetFixedWidth() const { return fixed_width; }
void SetFixedHeight(int h) { fixed_height = h; }
int GetFixedHeight() const { return fixed_height;}
const LayoutDef& GetLayout() const { return layout; }
protected:
DWORD id;
DWORD pid;
DWORD type;
Rect rect;
Text font;
Text text;
Text alt_text;
Text texture;
Text picture;
DWORD style;
DWORD text_align;
bool single_line;
bool enabled;
bool transparent;
bool hide_partial;
Color back_color;
Color base_color;
Color fore_color;
Insets margins;
Insets text_insets;
Insets cell_insets;
Rect cells;
int fixed_width;
int fixed_height;
LayoutDef layout;
};
// +--------------------------------------------------------------------+
class CtrlDef : public WinDef
{
public:
static const char* TYPENAME() { return "CtrlDef"; }
CtrlDef(DWORD id=0, DWORD type=WIN_DEF_LABEL, const char* text=0, DWORD style=0);
virtual ~CtrlDef();
virtual CtrlDef& operator=(const CtrlDef& ctrl);
bool GetActive() const;
void SetActive(bool c);
Color GetActiveColor() const;
void SetActiveColor(Color c);
bool GetAnimated() const;
void SetAnimated(bool bNewValue);
short GetBevelWidth() const;
void SetBevelWidth(short nNewValue);
bool GetBorder() const;
void SetBorder(bool bNewValue);
Color GetBorderColor() const;
void SetBorderColor(Color c);
bool GetDropShadow() const;
void SetDropShadow(bool bNewValue);
bool GetIndent() const;
void SetIndent(bool bNewValue);
bool GetInvertLabel() const;
void SetInvertLabel(bool bNewValue);
int GetOrientation() const;
void SetOrientation(int o);
Text GetPicture() const;
void SetPicture(const Text& img_name);
short GetPictureLocation() const;
void SetPictureLocation(short nNewValue);
short GetPictureType() const;
void SetPictureType(short nNewValue);
bool GetSticky() const;
void SetSticky(bool bNewValue);
int GetNumLeds() const;
void SetNumLeds(int nNewValue);
int NumItems() const;
Text GetItem(int i) const;
void AddItem(const char* t);
int NumColumns() const;
ColumnDef* GetColumn(int i) const;
void AddColumn(const char* t, int w, int a, int s);
int NumTabs() const;
int GetTab(int i) const;
void SetTab(int i, int t);
void AddTab(int i);
bool GetShowHeadings() const;
void SetShowHeadings(bool bNewValue);
int GetLeading() const;
void SetLeading(int nNewValue);
int GetLineHeight() const;
void SetLineHeight(int nNewValue);
int GetMultiSelect() const;
void SetMultiSelect(int nNewValue);
int GetDragDrop() const;
void SetDragDrop(int nNewValue);
int GetScrollBarVisible() const;
void SetScrollBarVisible(int nNewValue);
bool GetSmoothScroll() const;
void SetSmoothScroll(bool bNewValue);
short GetItemStyle() const;
void SetItemStyle(short nNewValue);
short GetSelectedStyle() const;
void SetSelectedStyle(short nNewValue);
char GetPasswordChar() const;
void SetPasswordChar(char c);
Text GetStandardImage() const;
void SetStandardImage(const Text& img_name);
Text GetActivatedImage() const;
void SetActivatedImage(const Text& img_name);
Text GetTransitionImage() const;
void SetTransitionImage(const Text& img_name);
protected:
WORD ctrl_flags;
short bevel_width;
Color active_color;
Color border_color;
Text picture;
short picture_loc;
short picture_type;
Text standard_image;
Text activated_image;
Text transition_image;
bool active;
bool show_headings;
int leading;
int line_height;
int multiselect;
int dragdrop;
int scroll_bar;
int orientation;
int num_leds;
short item_style;
short selected_style;
bool smooth_scroll;
List<Text> items;
List<ColumnDef> columns;
int ntabs;
int tabs[10];
char pass_char;
};
// +--------------------------------------------------------------------+
class FormDef : public WinDef
{
public:
static const char* TYPENAME() { return "FormDef"; }
FormDef(const char* text=0, DWORD style=0);
virtual ~FormDef();
void Load(const char* filename);
void AddCtrl(CtrlDef* def);
CtrlDef* FindCtrl(BYTE ctrl_id);
ListIter<CtrlDef> GetControls() const;
protected:
void ParseCtrlDef(CtrlDef* ctrl, TermStruct* val);
void ParseColumnDef(CtrlDef* ctrl, TermStruct* val);
void ParseLayoutDef(LayoutDef* def, TermStruct* val);
CtrlDef defctrl;
List<CtrlDef> controls;
};
// +--------------------------------------------------------------------+
#endif FormDef_h
|