25 Center = HCenter | VCenter,
35 Stretch = HStretch | VStretch,
46 return HCenter == (mValue & ((int)HStretch));
51 return VCenter == (mValue & ((int)VStretch));
56 return Center == (mValue & ((int)Stretch));
61 return Left == (mValue & ((int)HStretch));
66 return Right == (mValue & ((int)HStretch));
71 return HStretch == (mValue & ((int)HStretch));
76 return Top == (mValue & ((int)VStretch));
81 return (
Bottom == (mValue & ((
int)VStretch)));
86 return (VStretch == (mValue & ((
int)VStretch)));
91 return (Stretch == (mValue & ((
int)Stretch)));
96 return (Default == (mValue & ((
int)Stretch)));
101 mValue =
Enum(
int(mValue) |
int(_other.mValue));
112 return Align(
Enum(
int(a.mValue) |
int(b.mValue)));
117 return a.mValue == b.mValue;
122 return a.mValue != b.mValue;
130 const MapAlign& map_names = result.getValueNames();
132 for (
const auto& pos : vec)
134 auto iter = map_names.find(pos);
135 if (iter != map_names.end())
137 result.mValue =
Enum(
int(result.mValue) |
int(iter->second));
154 else if (mValue &
Right)
162 result +=
" VStretch";
169 result +=
" VCenter";
174 friend std::ostream& operator << ( std::ostream& _stream,
const Align& _value )
176 _stream << _value.
print();
180 friend std::istream& operator >> ( std::istream& _stream,
Align& _value )
182 _value.mValue =
Enum(0);
186 const MapAlign& map_names = _value.getValueNames();
187 auto iter = map_names.find(value);
188 if (iter != map_names.end())
189 _value.mValue =
Enum(
int(_value.mValue) |
int(iter->second));
195 iter = map_names.find(value2);
196 if (iter != map_names.end())
197 _value.mValue =
Enum(
int(_value.mValue) |
int(iter->second));
209 const MapAlign& getValueNames()
const
211 static MapAlign map_names;
213 if (map_names.empty())
216 map_names[
"ALIGN_HCENTER"] = HCenter;
217 map_names[
"ALIGN_VCENTER"] = VCenter;
218 map_names[
"ALIGN_CENTER"] = Center;
219 map_names[
"ALIGN_LEFT"] =
Left;
220 map_names[
"ALIGN_RIGHT"] =
Right;
221 map_names[
"ALIGN_HSTRETCH"] = HStretch;
222 map_names[
"ALIGN_TOP"] =
Top;
223 map_names[
"ALIGN_BOTTOM"] =
Bottom;
224 map_names[
"ALIGN_VSTRETCH"] = VStretch;
225 map_names[
"ALIGN_STRETCH"] = Stretch;
226 map_names[
"ALIGN_DEFAULT"] = Default;
#define MYGUI_REGISTER_VALUE(map, value)
std::vector< std::string > split(const std::string &_source, const std::string &_delims="\t\n ")
bool operator==(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
bool operator!=(const UString::_const_fwd_iterator &left, const UString::_const_fwd_iterator &right)
Align(Enum _value=Default)
std::string print() const
static Align parse(const std::string &_value)
std::map< std::string, int > MapAlign