File: default_component_types.h

package info (click to toggle)
clanlib 0.5.4-1-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,320 kB
  • ctags: 10,893
  • sloc: cpp: 76,056; xml: 3,281; sh: 2,961; perl: 1,204; asm: 837; makefile: 775
file content (304 lines) | stat: -rw-r--r-- 7,984 bytes parent folder | download
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
/*
	$Id: default_component_types.h,v 1.33 2001/12/28 00:11:46 sphair Exp $
	
	ClanGUI, copyrights by various people. Have a look in the CREDITS file.
	
	This sourcecode is distributed using the Library GNU Public Licence,
	version 2 or (at your option) any later version. Please read LICENSE
	for details.
*/

#include "../API/GUI/component_type.h"

#include "API/GUI/label.h"
#include "API/GUI/button.h"
#include "API/GUI/frame.h"
#include "API/GUI/combobox.h"
#include "API/GUI/inputbox.h"
#include "API/GUI/image.h"
#include "API/GUI/scrollbar.h"
#include "API/GUI/progressbar.h"
#include "API/GUI/menubar.h"
#include "API/GUI/menuitem.h"
#include "API/GUI/popupmenu.h"
#include "API/GUI/checkbox.h"
#include "API/GUI/listbox.h"
#include "API/GUI/window.h"
#include "API/GUI/filedialog.h"

class CL_ComponentType_Component : public CL_ComponentType
{
public:
	CL_ComponentType_Component(bool _is_container) : CL_ComponentType(_is_container)
	{
		options["x"].type = CL_ComponentType::SOptionType::NUMBER;
		options["y"].type = CL_ComponentType::SOptionType::NUMBER;
		options["width"].type = CL_ComponentType::SOptionType::NUMBER;
		options["height"].type = CL_ComponentType::SOptionType::NUMBER;
		options["visible"].type = CL_ComponentType::SOptionType::BOOL;
		options["enabled"].type = CL_ComponentType::SOptionType::BOOL;
	}
};

class CL_ComponentType_Button : public CL_ComponentType_Component
{
public:
	CL_ComponentType_Button() : CL_ComponentType_Component(false)
	{
		options["text"].type = CL_ComponentType::SOptionType::STRING;;
		options["togglemode"].type = CL_ComponentType::SOptionType::NUMBER;
		options["surface_up"].type = CL_ComponentType::SOptionType::STRING;
		options["surface_down"].type = CL_ComponentType::SOptionType::STRING;
		options["surface_disabled"].type = CL_ComponentType::SOptionType::STRING;
		options["surface_highlighted"].type = CL_ComponentType::SOptionType::STRING;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_Button(parent, style);
	}
};

class CL_ComponentType_CheckBox : public CL_ComponentType_Component
{
public:
	CL_ComponentType_CheckBox() : CL_ComponentType_Component(false)
	{
		options["text"].type = CL_ComponentType::SOptionType::STRING;
		options["togglemode"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_CheckBox(parent, style);
	}
};

class CL_ComponentType_ComboBox : public CL_ComponentType_Component
{
public:
	CL_ComponentType_ComboBox() : CL_ComponentType_Component(false)
	{
		options["value"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_ComboBox(parent, style);
	}
};

class CL_ComponentType_FileDialog : public CL_ComponentType_Component
{
public:
	CL_ComponentType_FileDialog() : CL_ComponentType_Component(true)
	{
		options["file"].type = CL_ComponentType::SOptionType::STRING;
		options["filter"].type = CL_ComponentType::SOptionType::STRING;
		options["showhidden"].type = CL_ComponentType::SOptionType::BOOL;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_FileDialog(parent, style);
	}
};

class CL_ComponentType_Frame : public CL_ComponentType_Component
{
public:
	CL_ComponentType_Frame() : CL_ComponentType_Component(true)
	{
		options["surface"].type = CL_ComponentType::SOptionType::STRING;
		options["mode"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_Frame(parent, style);
	}
};

class CL_ComponentType_Image : public CL_ComponentType_Component
{
public:
	CL_ComponentType_Image() : CL_ComponentType_Component(false)
	{
		// no specific options for image
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_Image(parent, style);
	}
};

class CL_ComponentType_InputBox : public CL_ComponentType_Component
{
public:
	CL_ComponentType_InputBox() : CL_ComponentType_Component(false)
	{
		options["passwordmode"].type = CL_ComponentType::SOptionType::NUMBER;
		options["readonly"].type = CL_ComponentType::SOptionType::BOOL;
		options["maxlength"].type = CL_ComponentType::SOptionType::NUMBER;
		options["text"].type = CL_ComponentType::SOptionType::STRING;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_InputBox(parent, style);
	}
};

class CL_ComponentType_Label : public CL_ComponentType_Component
{
public:
	CL_ComponentType_Label() : CL_ComponentType_Component(false)
	{
		options["text"].type = CL_ComponentType::SOptionType::STRING;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_Label(parent, style);
	}
};

class CL_ComponentType_ListBox : public CL_ComponentType_Component
{
public:
	CL_ComponentType_ListBox() : CL_ComponentType_Component(false)
	{
		options["item"].type = CL_ComponentType::SOptionType::NUMBER;
		options["max_visible_items"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_ListBox(parent, style);
	}
};

/*class CL_ComponentType_MenuBar : public CL_ComponentType_Component
{
public:
	CL_ComponentType_MenuBar() : CL_ComponentType_Component(true)
	{
		// no specific menubar options
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_MenuBar(parent, style);
	}
};

class CL_ComponentType_MenuItem : public CL_ComponentType_Component
{
public:
	CL_ComponentType_MenuItem() : CL_ComponentType_Component(true)
	{
		options["text"].type = CL_ComponentType::SOptionType::STRING;
		options["checkable"].type = CL_ComponentType::SOptionType::BOOL;
		options["checked"].type = CL_ComponentType::SOptionType::BOOL;
		options["separator"].type = CL_ComponentType::SOptionType::STRING;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_MenuItem(parent, style);
	}
};

class CL_ComponentType_PopupMenu : public CL_ComponentType_Component
{
public:
	CL_ComponentType_PopupMenu() : CL_ComponentType_Component(true)
	{
		//no specific options
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_PopupMenu(parent, style);
	}
};
*/
class CL_ComponentType_ProgressBar : public CL_ComponentType_Component
{
public:
	CL_ComponentType_ProgressBar() : CL_ComponentType_Component(false)
	{
		options["steps"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_ProgressBar(parent, style);
	}
};

class CL_ComponentType_ScrollBar : public CL_ComponentType_Component
{
public:
	CL_ComponentType_ScrollBar() : CL_ComponentType_Component(false)
	{
		options["min"].type = CL_ComponentType::SOptionType::NUMBER;
		options["max"].type = CL_ComponentType::SOptionType::NUMBER;
		options["value"].type = CL_ComponentType::SOptionType::NUMBER;
		options["orientation"].type = CL_ComponentType::SOptionType::NUMBER;
		options["tracking"].type = CL_ComponentType::SOptionType::NUMBER;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_ScrollBar(parent, style);
	}
};

class CL_ComponentType_Window : public CL_ComponentType_Component
{
public:
	CL_ComponentType_Window() : CL_ComponentType_Component(true)
	{
		options["title"].type = CL_ComponentType::SOptionType::STRING;
	}

	virtual CL_Component *create_component(
		CL_Component *parent,
		CL_StyleManager *style)
	{
		return new CL_Window(parent, style);
	}
};

// TODO:
// Add missing component-types