MyGUI
3.4.2
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
include
MyGUI_ResizingPolicy.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_RESIZING_POLICY_H_
8
#define MYGUI_RESIZING_POLICY_H_
9
10
#include "
MyGUI_Prerequest.h
"
11
12
namespace
MyGUI
13
{
14
15
struct
MYGUI_EXPORT
ResizingPolicy
16
{
17
enum
Enum
18
{
19
Auto
,
20
Fixed
,
21
Fill
,
22
MAX
23
};
24
25
ResizingPolicy
(
Enum
_value
= MAX) :
26
mValue(
_value
)
27
{
28
}
29
30
static
ResizingPolicy
parse
(
const
std::string&
_value
)
31
{
32
ResizingPolicy
type;
33
int
value = 0;
34
while
(
true
)
35
{
36
const
char
* name = type.getValueName(value);
37
if
(
strcmp
(name,
""
) == 0 || name ==
_value
)
38
break
;
39
value++;
40
}
41
type.mValue =
Enum
(value);
42
return
type;
43
}
44
45
friend
bool
operator ==
(
ResizingPolicy
const
&
a
,
ResizingPolicy
const
&
b
)
46
{
47
return
a
.mValue ==
b
.mValue;
48
}
49
50
friend
bool
operator !=
(
ResizingPolicy
const
&
a
,
ResizingPolicy
const
&
b
)
51
{
52
return
a
.mValue !=
b
.mValue;
53
}
54
55
friend
std::ostream&
operator <<
(std::ostream&
_stream
,
const
ResizingPolicy
&
_value
)
56
{
57
_stream
<<
_value
.getValueName(
_value
.mValue);
58
return
_stream
;
59
}
60
61
friend
std::istream&
operator >>
(std::istream&
_stream
,
ResizingPolicy
&
_value
)
62
{
63
std::string value;
64
_stream
>> value;
65
_value
= parse(value);
66
return
_stream
;
67
}
68
69
std::string
print
()
const
70
{
71
return
getValueName(mValue);
72
}
73
74
int
getValue
()
const
75
{
76
return
mValue;
77
}
78
79
private
:
80
const
char
* getValueName(
int
_index
)
const
81
{
82
static
const
char
*
values
[MAX + 1] = {
"Auto"
,
"Fixed"
,
"Fill"
,
""
};
83
return
values[(_index < MAX && _index >= 0) ? _index : MAX];
84
}
85
86
private
:
87
Enum
mValue;
88
};
89
90
}
// namespace MyGUI
91
92
#endif
// MYGUI_RESIZING_POLICY_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::ResizingPolicy
Definition
MyGUI_ResizingPolicy.h:16
MyGUI::ResizingPolicy::parse
static ResizingPolicy parse(const std::string &_value)
Definition
MyGUI_ResizingPolicy.h:30
MyGUI::ResizingPolicy::print
std::string print() const
Definition
MyGUI_ResizingPolicy.h:69
MyGUI::ResizingPolicy::ResizingPolicy
ResizingPolicy(Enum _value=MAX)
Definition
MyGUI_ResizingPolicy.h:25
MyGUI::ResizingPolicy::Enum
Enum
Definition
MyGUI_ResizingPolicy.h:18
MyGUI::ResizingPolicy::Auto
@ Auto
Definition
MyGUI_ResizingPolicy.h:19
MyGUI::ResizingPolicy::Fixed
@ Fixed
Definition
MyGUI_ResizingPolicy.h:20
MyGUI::ResizingPolicy::Fill
@ Fill
Definition
MyGUI_ResizingPolicy.h:21
MyGUI::ResizingPolicy::getValue
int getValue() const
Definition
MyGUI_ResizingPolicy.h:74
Generated by
1.9.8