22 #ifndef __MYGUI_ALIGN_H__
23 #define __MYGUI_ALIGN_H__
40 Center = HCenter | VCenter,
50 Stretch = HStretch | VStretch,
61 return HCenter == (value & ((int)HStretch));
66 return VCenter == (value & ((int)VStretch));
71 return Center == (value & ((int)Stretch));
76 return Left == (value & ((int)HStretch));
81 return Right == (value & ((int)HStretch));
86 return HStretch == (value & ((int)HStretch));
91 return Top == (value & ((int)VStretch));
96 return (
Bottom == (value & ((
int)VStretch)));
101 return (VStretch == (value & ((
int)VStretch)));
106 return (Stretch == (value & ((
int)Stretch)));
111 return (Default == (value & ((
int)Stretch)));
116 value =
Enum(
int(value) |
int(_other.value));
127 return Align(
Enum(
int(a.value) |
int(b.value)));
132 return a.value == b.value;
137 return a.value != b.value;
145 const MapAlign& map_names = result.getValueNames();
147 for (
size_t pos = 0; pos < vec.size(); pos++)
149 MapAlign::const_iterator iter = map_names.find(vec[pos]);
150 if (iter != map_names.end())
152 result.value =
Enum(
int(result.value) |
int(iter->second));
169 else if (value &
Right)
177 result +=
" VStretch";
184 result +=
" VCenter";
189 friend std::ostream& operator << ( std::ostream& _stream,
const Align& _value )
191 _stream << _value.
print();
195 friend std::istream& operator >> ( std::istream& _stream,
Align& _value )
197 _value.value =
Enum(0);
201 const MapAlign& map_names = _value.getValueNames();
202 MapAlign::const_iterator iter = map_names.find(value);
203 if (iter != map_names.end())
204 _value.value =
Enum(
int(_value.value) | int(iter->second));
210 iter = map_names.find(value2);
211 if (iter != map_names.end())
212 _value.value =
Enum(
int(_value.value) | int(iter->second));
219 const MapAlign& getValueNames()
const
221 static MapAlign map_names;
223 if (map_names.empty())
226 map_names[
"ALIGN_HCENTER"] = HCenter;
227 map_names[
"ALIGN_VCENTER"] = VCenter;
228 map_names[
"ALIGN_CENTER"] = Center;
229 map_names[
"ALIGN_LEFT"] =
Left;
230 map_names[
"ALIGN_RIGHT"] =
Right;
231 map_names[
"ALIGN_HSTRETCH"] = HStretch;
232 map_names[
"ALIGN_TOP"] =
Top;
233 map_names[
"ALIGN_BOTTOM"] =
Bottom;
234 map_names[
"ALIGN_VSTRETCH"] = VStretch;
235 map_names[
"ALIGN_STRETCH"] = Stretch;
236 map_names[
"ALIGN_DEFAULT"] = Default;
260 #endif // __MYGUI_ALIGN_H__