Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
XMLEnumHelper.h
1/***********************************************************************
2 created: Mon Jul 18 2005
3 author: Paul D Turner <paul@cegui.org.uk>
4*************************************************************************/
5/***************************************************************************
6 * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software, to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 ***************************************************************************/
27#ifndef _CEGUIFalXMLEnumHelper_h_
28#define _CEGUIFalXMLEnumHelper_h_
29
30#include "../String.h"
31#include "../Window.h"
32#include "CEGUI/falagard/Enums.h"
33
34namespace CEGUI
35{
36template<typename T>
38
39template<>
41{
42public:
45
46 static String toString(pass_type val)
47 {
48 switch (val)
49 {
51 return BottomAligned;
52
54 return CentreAligned;
55
56 case VF_TILED:
57 return Tiled;
58
59 case VF_STRETCHED:
60 return Stretched;
61
62 default:
63 return TopAligned;
64 }
65 }
66
67 static return_type fromString(const String& str)
68 {
69 if (str == CentreAligned)
70 return VF_CENTRE_ALIGNED;
71
72 else if (str == BottomAligned)
73 return VF_BOTTOM_ALIGNED;
74
75 else if (str == Tiled)
76 return VF_TILED;
77
78 else if (str == Stretched)
79 return VF_STRETCHED;
80
81 else
82 return VF_TOP_ALIGNED;
83 }
84
87 static const CEGUI::String CentreAligned;
88 static const CEGUI::String BottomAligned;
89 static const CEGUI::String Stretched;
90 static const CEGUI::String Tiled;
91};
92
93template<>
95{
96public:
99
100 static String toString(pass_type val)
101 {
102 switch (val)
103 {
104 case HF_RIGHT_ALIGNED:
105 return RightAligned;
106
108 return CentreAligned;
109
110 case HF_TILED:
111 return Tiled;
112
113 case HF_STRETCHED:
114 return Stretched;
115
116 default:
117 return LeftAligned;
118 }
119 }
120
121 static return_type fromString(const String& str)
122 {
123 if (str == CentreAligned)
124 return HF_CENTRE_ALIGNED;
125
126 else if (str == RightAligned)
127 return HF_RIGHT_ALIGNED;
128
129 else if (str == Tiled)
130 return HF_TILED;
131
132 else if (str == Stretched)
133 return HF_STRETCHED;
134
135 else
136 return HF_LEFT_ALIGNED;
137 }
138
141 static const CEGUI::String CentreAligned;
142 static const CEGUI::String RightAligned;
143 static const CEGUI::String Stretched;
144 static const CEGUI::String Tiled;
145};
146
147template<>
149{
150public:
153
154 static String toString(pass_type val)
155 {
156 switch (val)
157 {
158 case VA_BOTTOM:
159 return BottomAligned;
160
161 case VA_CENTRE:
162 return CentreAligned;
163
164 default:
165 return TopAligned;
166 }
167 }
168
169 static return_type fromString(const String& str)
170 {
171 if (str == CentreAligned)
172 return VA_CENTRE;
173
174 else if (str == BottomAligned)
175 return VA_BOTTOM;
176
177 else
178 return VA_TOP;
179 }
180
183 static const CEGUI::String CentreAligned;
184 static const CEGUI::String BottomAligned;
185};
186
187template<>
189{
190public:
193
194 static String toString(pass_type val)
195 {
196 switch (val)
197 {
198 case HA_RIGHT:
199 return RightAligned;
200
201 case HA_CENTRE:
202 return CentreAligned;
203
204 default:
205 return LeftAligned;
206 }
207 }
208
209 static return_type fromString(const String& str)
210 {
211 if (str == CentreAligned)
212 return HA_CENTRE;
213
214 else if (str == RightAligned)
215 return HA_RIGHT;
216
217 else
218 return HA_LEFT;
219 }
220
223 static const CEGUI::String CentreAligned;
224 static const CEGUI::String RightAligned;
225};
226
227template<>
229{
230public:
232 typedef DimensionType pass_type;
233
234 static String toString(pass_type val)
235 {
236 switch (val)
237 {
238 case DT_LEFT_EDGE:
239 return LeftEdge;
240
241 case DT_X_POSITION:
242 return XPosition;
243
244 case DT_TOP_EDGE:
245 return TopEdge;
246
247 case DT_Y_POSITION:
248 return YPosition;
249
250 case DT_RIGHT_EDGE:
251 return RightEdge;
252
253 case DT_BOTTOM_EDGE:
254 return BottomEdge;
255
256 case DT_WIDTH:
257 return Width;
258
259 case DT_HEIGHT:
260 return Height;
261
262 case DT_X_OFFSET:
263 return XOffset;
264
265 case DT_Y_OFFSET:
266 return YOffset;
267
268 default:
269 return Invalid;
270 }
271 }
272
273 static return_type fromString(const String& str)
274 {
275 if (str == LeftEdge)
276 return DT_LEFT_EDGE;
277
278 else if (str == XPosition)
279 return DT_X_POSITION;
280
281 else if (str == TopEdge)
282 return DT_TOP_EDGE;
283
284 else if (str == YPosition)
285 return DT_Y_POSITION;
286
287 else if (str == RightEdge)
288 return DT_RIGHT_EDGE;
289
290 else if (str == BottomEdge)
291 return DT_BOTTOM_EDGE;
292
293 else if (str == Width)
294 return DT_WIDTH;
295
296 else if (str == Height)
297 return DT_HEIGHT;
298
299 else if (str == XOffset)
300 return DT_X_OFFSET;
301
302 else if (str == YOffset)
303 return DT_Y_OFFSET;
304
305 else
306 return DT_INVALID;
307 }
308
311 static const CEGUI::String RightEdge;
312 static const CEGUI::String BottomEdge;
313 static const CEGUI::String TopEdge;
314 static const CEGUI::String XPosition;
315 static const CEGUI::String YPosition;
316 static const CEGUI::String Width;
317 static const CEGUI::String Height;
318 static const CEGUI::String XOffset;
319 static const CEGUI::String YOffset;
320 static const CEGUI::String Invalid;
321};
322
323template<>
325{
326public:
329
330 static String toString(pass_type val)
331 {
332 switch (val)
333 {
335 return BottomAligned;
336
338 return CentreAligned;
339
340 default:
341 return TopAligned;
342 }
343 }
344
345 static return_type fromString(const String& str)
346 {
347 if (str == CentreAligned)
348 return VTF_CENTRE_ALIGNED;
349
350 else if (str == BottomAligned)
351 return VTF_BOTTOM_ALIGNED;
352
353 else
354 return VTF_TOP_ALIGNED;
355 }
356
359 static const CEGUI::String CentreAligned;
360 static const CEGUI::String BottomAligned;
361};
362
363template<>
365{
366public:
369
370 static String toString(pass_type val)
371 {
372 switch (val)
373 {
375 return RightAligned;
376
378 return CentreAligned;
379
380 case HTF_JUSTIFIED:
381 return Justified;
382
384 return WordWrapLeftAligned;
385
387 return WordWrapRightAligned;
388
390 return WordWrapCentreAligned;
391
393 return WordWrapJustified;
394
395 default:
396 return LeftAligned;
397 }
398 }
399
400 static return_type fromString(const String& str)
401 {
402 if (str == CentreAligned)
403 return HTF_CENTRE_ALIGNED;
404
405 else if (str == RightAligned)
406 return HTF_RIGHT_ALIGNED;
407
408 else if (str == Justified)
409 return HTF_JUSTIFIED;
410
411 else if (str == WordWrapLeftAligned)
413
414 else if (str == WordWrapCentreAligned)
416
417 else if (str == WordWrapRightAligned)
419
420 else if (str == WordWrapJustified)
422
423 else
424 return HTF_LEFT_ALIGNED;
425 }
426
429 static const CEGUI::String CentreAligned;
430 static const CEGUI::String RightAligned;
431 static const CEGUI::String Justified;
432 static const CEGUI::String WordWrapLeftAligned;
433 static const CEGUI::String WordWrapRightAligned;
434 static const CEGUI::String WordWrapCentreAligned;
435 static const CEGUI::String WordWrapJustified;
436};
437
438template<>
440{
441public:
444
445 static String toString(pass_type val)
446 {
447 switch (val)
448 {
449 case FMT_BASELINE:
450 return Baseline;
451
452 case FMT_HORZ_EXTENT:
453 return HorzExtent;
454
455 default:
456 return LineSpacing;
457 }
458 }
459
460 static return_type fromString(const String& str)
461 {
462 if (str == LineSpacing)
463 return FMT_LINE_SPACING;
464
465 else if (str == Baseline)
466 return FMT_BASELINE;
467
468 else
469 return FMT_HORZ_EXTENT;
470 }
471
472 static const CEGUI::String LineSpacing;
473 static const CEGUI::String HorzExtent;
474 static const CEGUI::String Baseline;
475};
476
477template<>
479{
480public:
483
484 static String toString(pass_type val)
485 {
486 switch (val)
487 {
488 case DOP_ADD:
489 return Add;
490
491 case DOP_SUBTRACT:
492 return Subtract;
493
494 case DOP_MULTIPLY:
495 return Multiply;
496
497 case DOP_DIVIDE:
498 return Divide;
499
500 default:
501 return Noop;
502 }
503 }
504
505 static return_type fromString(const String& str)
506 {
507 if (str == Add)
508 return DOP_ADD;
509
510 else if (str == Subtract)
511 return DOP_SUBTRACT;
512
513 else if (str == Multiply)
514 return DOP_MULTIPLY;
515
516 else if (str == Divide)
517 return DOP_DIVIDE;
518
519 else
520 return DOP_NOOP;
521 }
522
523 static const CEGUI::String Add;
524 static const CEGUI::String Subtract;
525 static const CEGUI::String Multiply;
526 static const CEGUI::String Divide;
527 static const CEGUI::String Noop;
528};
529
530template<>
532{
533public:
536
537 static String toString(pass_type val)
538 {
539 switch (val)
540 {
542 return TopLeftCorner;
543
545 return TopRightCorner;
546
548 return BottomLeftCorner;
549
551 return BottomRightCorner;
552
553 case FIC_LEFT_EDGE:
554 return LeftEdge;
555
556 case FIC_RIGHT_EDGE:
557 return RightEdge;
558
559 case FIC_TOP_EDGE:
560 return TopEdge;
561
562 case FIC_BOTTOM_EDGE:
563 return BottomEdge;
564
565 default:
566 return Background;
567 }
568 }
569
570 static return_type fromString(const String& str)
571 {
572 if (str == TopLeftCorner)
573 return FIC_TOP_LEFT_CORNER;
574
575 if (str == TopRightCorner)
577
578 if (str == BottomLeftCorner)
580
581 if (str == BottomRightCorner)
583
584 if (str == LeftEdge)
585 return FIC_LEFT_EDGE;
586
587 if (str == RightEdge)
588 return FIC_RIGHT_EDGE;
589
590 if (str == TopEdge)
591 return FIC_TOP_EDGE;
592
593 if (str == BottomEdge)
594 return FIC_BOTTOM_EDGE;
595
596 else
597 return FIC_BACKGROUND;
598 }
599
600 static const CEGUI::String TopLeftCorner;
601 static const CEGUI::String TopRightCorner;
602 static const CEGUI::String BottomLeftCorner;
603 static const CEGUI::String BottomRightCorner;
604 static const CEGUI::String TopEdge;
605 static const CEGUI::String LeftEdge;
606 static const CEGUI::String RightEdge;
607 static const CEGUI::String BottomEdge;
608 static const CEGUI::String Background;
609};
610
611template<>
613{
614public:
617
618 static String toString(pass_type val)
619 {
620 switch (val)
621 {
622 case CEA_REDRAW:
623 return Redraw;
624
625 case CEA_LAYOUT:
626 return Layout;
627
628 default:
629 CEGUI_THROW(InvalidRequestException(
630 "Invalid enumeration value given."));
631 }
632 }
633
634 static return_type fromString(const String& str)
635 {
636 if (str == Redraw)
637 return CEA_REDRAW;
638
639 if (str == Layout)
640 return CEA_LAYOUT;
641
642 CEGUI_THROW(InvalidRequestException(
643 "'" + str +
644 "' does not represent a ChildEventAction enumerated value."));
645 }
646
647 static const CEGUI::String Redraw;
648 static const CEGUI::String Layout;
649};
650
653//
654// PropertyHelper specialisations
655//
658
659template<>
661{
662public:
667
668 static const String& getDataTypeName()
669 {
670 static String type("VerticalFormatting");
671
672 return type;
673 }
674
675 static return_type fromString(const String& str)
676 {
678 }
679
680 static string_return_type toString(pass_type val)
681 {
683 }
684};
685
686template<>
688{
689public:
694
695 static const String& getDataTypeName()
696 {
697 static String type("HorizontalFormatting");
698
699 return type;
700 }
701
702 static return_type fromString(const String& str)
703 {
705 }
706
707 static string_return_type toString(pass_type val)
708 {
710 }
711};
712
713template<>
715{
716public:
721
722 static const String& getDataTypeName()
723 {
724 static String type("VerticalTextFormatting");
725
726 return type;
727 }
728
729 static return_type fromString(const String& str)
730 {
732 }
733
734 static string_return_type toString(pass_type val)
735 {
737 }
738};
739
740template<>
742{
743public:
748
749 static const String& getDataTypeName()
750 {
751 static String type("HorizontalTextFormatting");
752
753 return type;
754 }
755
756 static return_type fromString(const String& str)
757 {
759 }
760
761 static string_return_type toString(pass_type val)
762 {
764 }
765};
766
767}
768
769
770#endif
static const CEGUI::String LeftEdge
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:310
static const CEGUI::String LeftAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:222
static const CEGUI::String LeftAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:140
static const CEGUI::String LeftAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:428
static const CEGUI::String TopAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:182
static const CEGUI::String TopAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:86
static const CEGUI::String TopAligned
Definitions of the possible values represented as Strings.
Definition XMLEnumHelper.h:358
Definition XMLEnumHelper.h:37
Exception class used when some impossible request was made of the system.
Definition Exceptions.h:305
Helper class used to convert various data types to and from the format expected in Property strings.
Definition ForwardRefs.h:84
String class used within the GUI system.
Definition String.h:64
base class for properties able to do native set/get
Definition TypedProperty.h:50
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1
HorizontalAlignment
Enumerated type used when specifying horizontal alignments for Element.
Definition Element.h:53
@ HA_LEFT
Definition Element.h:58
@ HA_RIGHT
Definition Element.h:68
@ HA_CENTRE
Definition Element.h:63
VerticalTextFormatting
Enumeration of possible values to indicate the vertical formatting to be used for a text component.
Definition Enums.h:85
@ VTF_TOP_ALIGNED
Top of text should be aligned with the top of the destination area.
Definition Enums.h:86
@ VTF_CENTRE_ALIGNED
text should be vertically centred within the destination area.
Definition Enums.h:87
@ VTF_BOTTOM_ALIGNED
Bottom of text should be aligned with the bottom of the destination area.
Definition Enums.h:88
HorizontalTextFormatting
Enumeration of possible values to indicate the horizontal formatting to be used for a text component.
Definition Enums.h:96
@ HTF_WORDWRAP_CENTRE_ALIGNED
text should be horizontally centred within the destination area (word wrapped to multiple lines as ne...
Definition Enums.h:103
@ HTF_WORDWRAP_JUSTIFIED
text should be spaced so that it takes the full width of the destination area (word wrapped to multip...
Definition Enums.h:104
@ HTF_WORDWRAP_RIGHT_ALIGNED
Right of text should be aligned with the right of the destination area (word wrapped to multiple line...
Definition Enums.h:102
@ HTF_RIGHT_ALIGNED
Right of text should be aligned with the right of the destination area (single line of text only).
Definition Enums.h:98
@ HTF_CENTRE_ALIGNED
text should be horizontally centred within the destination area (single line of text only).
Definition Enums.h:99
@ HTF_LEFT_ALIGNED
Left of text should be aligned with the left of the destination area (single line of text only).
Definition Enums.h:97
@ HTF_JUSTIFIED
text should be spaced so that it takes the full width of the destination area (single line of text on...
Definition Enums.h:100
@ HTF_WORDWRAP_LEFT_ALIGNED
Left of text should be aligned with the left of the destination area (word wrapped to multiple lines ...
Definition Enums.h:101
FrameImageComponent
Enumeration of values referencing available images forming a frame component.
Definition Enums.h:136
@ FIC_BOTTOM_LEFT_CORNER
References image used for the bottom-left corner.
Definition Enums.h:140
@ FIC_BOTTOM_EDGE
References image used for the bottom edge.
Definition Enums.h:145
@ FIC_TOP_RIGHT_CORNER
References image used for the top-right corner.
Definition Enums.h:139
@ FIC_LEFT_EDGE
References image used for the left edge.
Definition Enums.h:142
@ FIC_RIGHT_EDGE
References image used for the right edge.
Definition Enums.h:143
@ FIC_BOTTOM_RIGHT_CORNER
References image used for the bottom-right corner.
Definition Enums.h:141
@ FIC_BACKGROUND
References image used for the background.
Definition Enums.h:137
@ FIC_TOP_EDGE
References image used for the top edge.
Definition Enums.h:144
@ FIC_TOP_LEFT_CORNER
References image used for the top-left corner.
Definition Enums.h:138
VerticalAlignment
Enumerated type used when specifying vertical alignments for Element.
Definition Element.h:131
@ VA_CENTRE
Definition Element.h:141
@ VA_BOTTOM
Definition Element.h:146
@ VA_TOP
Definition Element.h:136
DimensionOperator
Enumeration of values representing mathematical operations on dimensions.
Definition Enums.h:123
@ DOP_MULTIPLY
Dims should be multiplied.
Definition Enums.h:127
@ DOP_SUBTRACT
Dims should be subtracted.
Definition Enums.h:126
@ DOP_NOOP
Do nothing operator.
Definition Enums.h:124
@ DOP_ADD
Dims should be added.
Definition Enums.h:125
@ DOP_DIVIDE
Dims should be divided.
Definition Enums.h:128
ChildEventAction
Enumeration of actions a WidgetLook can take in response to some event firing on a child WidgetCompon...
Definition Enums.h:155
@ CEA_LAYOUT
The window with the WidgetComponent as child performs child layout.
Definition Enums.h:159
@ CEA_REDRAW
The window with the WidgetComponent as child is redrawn.
Definition Enums.h:157
VerticalFormatting
Enumeration of possible values to indicate the vertical formatting to be used for an image component.
Definition Enums.h:59
@ VF_BOTTOM_ALIGNED
Bottom of Image should be aligned with the bottom of the destination area.
Definition Enums.h:62
@ VF_TOP_ALIGNED
Top of Image should be aligned with the top of the destination area.
Definition Enums.h:60
@ VF_STRETCHED
Image should be stretched vertically to fill the destination area.
Definition Enums.h:63
@ VF_TILED
Image should be tiled vertically to fill the destination area (bottom-most tile may be clipped).
Definition Enums.h:64
@ VF_CENTRE_ALIGNED
Image should be vertically centred within the destination area.
Definition Enums.h:61
DimensionType
Enumeration of possible values to indicate what a given dimension represents.
Definition Enums.h:40
@ DT_TOP_EDGE
Dimension represents the top edge of some entity (same as DT_Y_POSITION).
Definition Enums.h:43
@ DT_HEIGHT
Dimension represents the height of some entity.
Definition Enums.h:48
@ DT_INVALID
Invalid / uninitialised DimensionType.
Definition Enums.h:51
@ DT_RIGHT_EDGE
Dimension represents the right edge of some entity.
Definition Enums.h:45
@ DT_Y_POSITION
Dimension represents the y position of some entity (same as DT_TOP_EDGE).
Definition Enums.h:44
@ DT_X_POSITION
Dimension represents the x position of some entity (same as DT_LEFT_EDGE).
Definition Enums.h:42
@ DT_WIDTH
Dimension represents the width of some entity.
Definition Enums.h:47
@ DT_LEFT_EDGE
Dimension represents the left edge of some entity (same as DT_X_POSITION).
Definition Enums.h:41
@ DT_Y_OFFSET
Dimension represents the y offset of some entity (usually only applies to an Image entity).
Definition Enums.h:50
@ DT_X_OFFSET
Dimension represents the x offset of some entity (usually only applies to an Image entity).
Definition Enums.h:49
@ DT_BOTTOM_EDGE
Dimension represents the bottom edge of some entity.
Definition Enums.h:46
FontMetricType
Enumeration of possible values to indicate a particular font metric.
Definition Enums.h:112
@ FMT_HORZ_EXTENT
Horizontal extent of a string.
Definition Enums.h:115
@ FMT_LINE_SPACING
Vertical line spacing value for font.
Definition Enums.h:113
@ FMT_BASELINE
Vertical baseline value for font.
Definition Enums.h:114
HorizontalFormatting
Enumeration of possible values to indicate the horizontal formatting to be used for an image componen...
Definition Enums.h:72
@ HF_RIGHT_ALIGNED
Right of Image should be aligned with the right of the destination area.
Definition Enums.h:75
@ HF_LEFT_ALIGNED
Left of Image should be aligned with the left of the destination area.
Definition Enums.h:73
@ HF_CENTRE_ALIGNED
Image should be horizontally centred within the destination area.
Definition Enums.h:74
@ HF_STRETCHED
Image should be stretched horizontally to fill the destination area.
Definition Enums.h:76
@ HF_TILED
Image should be tiled horizontally to fill the destination area (right-most tile may be clipped).
Definition Enums.h:77