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