7#ifndef MYGUI_WIDGET_STYLE_H_
8#define MYGUI_WIDGET_STYLE_H_
33 WidgetStyle(Enum _value) :
38 static WidgetStyle parse(std::string_view _value)
44 std::string_view name = type.getValueName(value);
45 if (name.empty() || name == _value)
49 type.mValue =
static_cast<Enum>(value);
53 friend bool operator==(WidgetStyle
const& a, WidgetStyle
const& b)
55 return a.mValue == b.mValue;
58 friend bool operator!=(WidgetStyle
const& a, WidgetStyle
const& b)
60 return a.mValue != b.mValue;
63 friend std::ostream& operator<<(std::ostream& _stream,
const WidgetStyle& _value)
65 _stream << _value.getValueName(_value.mValue);
69 friend std::istream& operator>>(std::istream& _stream, WidgetStyle& _value)
73 _value = parse(value);
77 std::string_view print()
const
79 return getValueName(mValue);
88 std::string_view getValueName(
int _index)
const
90 if (_index < 0 || _index >= MAX)
92 static const std::string_view values[MAX] = {
"Child",
"Popup",
"Overlapped"};
93 return values[_index];