MyGUI
3.4.2
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_WidgetStyle.h
Go to the documentation of this file.
1
/*
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5
*/
6
7
#ifndef MYGUI_WIDGET_STYLE_H_
8
#define MYGUI_WIDGET_STYLE_H_
9
10
#include "
MyGUI_Prerequest.h
"
11
#include <string>
12
#include <cstring>
13
#include <iostream>
14
15
namespace
MyGUI
16
{
17
18
struct
MYGUI_EXPORT
WidgetStyle
19
{
20
enum
Enum
21
{
22
Child
,
23
Popup
,
24
Overlapped
,
25
MAX
26
};
27
28
WidgetStyle
() :
29
mValue(MAX)
30
{
31
}
32
33
WidgetStyle
(
Enum
_value
) :
34
mValue(
_value
)
35
{
36
}
37
38
static
WidgetStyle
parse
(
const
std::string&
_value
)
39
{
40
WidgetStyle
type;
41
int
value = 0;
42
while
(
true
)
43
{
44
const
char
* name = type.getValueName(value);
45
if
(
strcmp
(name,
""
) == 0 || name ==
_value
)
46
break
;
47
value++;
48
}
49
type.mValue = (
Enum
)value;
50
return
type;
51
}
52
53
friend
bool
operator ==
(
WidgetStyle
const
&
a
,
WidgetStyle
const
&
b
)
54
{
55
return
a
.mValue ==
b
.mValue;
56
}
57
58
friend
bool
operator !=
(
WidgetStyle
const
&
a
,
WidgetStyle
const
&
b
)
59
{
60
return
a
.mValue !=
b
.mValue;
61
}
62
63
friend
std::ostream&
operator <<
(std::ostream&
_stream
,
const
WidgetStyle
&
_value
)
64
{
65
_stream
<<
_value
.getValueName(
_value
.mValue);
66
return
_stream
;
67
}
68
69
friend
std::istream&
operator >>
(std::istream&
_stream
,
WidgetStyle
&
_value
)
70
{
71
std::string value;
72
_stream
>> value;
73
_value
= parse(value);
74
return
_stream
;
75
}
76
77
std::string
print
()
const
78
{
79
return
getValueName(mValue);
80
}
81
82
int
getValue
()
const
83
{
84
return
mValue;
85
}
86
87
private
:
88
const
char
* getValueName(
int
_index
)
const
89
{
90
static
const
char
*
values
[MAX + 1] = {
"Child"
,
"Popup"
,
"Overlapped"
,
""
};
91
return
values[(_index < MAX && _index >= 0) ? _index : MAX];
92
}
93
94
private
:
95
Enum
mValue;
96
};
97
98
}
// namespace MyGUI
99
100
#endif
// MYGUI_WIDGET_STYLE_H_
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition
MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI::Enumerator
Definition
MyGUI_Enumerator.h:49
MyGUI::FontCodeType::Enum
Enum
Definition
MyGUI_FontData.h:20
MyGUI
Definition
MyGUI_ActionController.h:15
MyGUI::WidgetStyle
Definition
MyGUI_WidgetStyle.h:19
MyGUI::WidgetStyle::WidgetStyle
WidgetStyle()
Definition
MyGUI_WidgetStyle.h:28
MyGUI::WidgetStyle::WidgetStyle
WidgetStyle(Enum _value)
Definition
MyGUI_WidgetStyle.h:33
MyGUI::WidgetStyle::print
std::string print() const
Definition
MyGUI_WidgetStyle.h:77
MyGUI::WidgetStyle::parse
static WidgetStyle parse(const std::string &_value)
Definition
MyGUI_WidgetStyle.h:38
MyGUI::WidgetStyle::Enum
Enum
Definition
MyGUI_WidgetStyle.h:21
MyGUI::WidgetStyle::Popup
@ Popup
Definition
MyGUI_WidgetStyle.h:23
MyGUI::WidgetStyle::Child
@ Child
Definition
MyGUI_WidgetStyle.h:22
MyGUI::WidgetStyle::Overlapped
@ Overlapped
Definition
MyGUI_WidgetStyle.h:24
MyGUI::WidgetStyle::getValue
int getValue() const
Definition
MyGUI_WidgetStyle.h:82
Generated by
1.9.8