74 if (name ==
"textcolor") {
76 }
else if (name ==
"bgcolor") {
78 }
else if (name ==
"bgcolor_hovered") {
80 }
else if (name ==
"bgcolor_pressed") {
82 }
else if (name ==
"noclip") {
84 }
else if (name ==
"border") {
86 }
else if (name ==
"bgimg") {
88 }
else if (name ==
"bgimg_hovered") {
90 }
else if (name ==
"bgimg_middle") {
92 }
else if (name ==
"bgimg_pressed") {
94 }
else if (name ==
"fgimg") {
96 }
else if (name ==
"fgimg_hovered") {
98 }
else if (name ==
"fgimg_middle") {
100 }
else if (name ==
"fgimg_pressed") {
102 }
else if (name ==
"alpha") {
104 }
else if (name ==
"content_offset") {
106 }
else if (name ==
"padding") {
108 }
else if (name ==
"font") {
110 }
else if (name ==
"font_size") {
112 }
else if (name ==
"halign") {
114 }
else if (name ==
"valign") {
116 }
else if (name ==
"colors") {
118 }
else if (name ==
"bordercolors") {
120 }
else if (name ==
"borderwidths") {
122 }
else if (name ==
"sound") {
124 }
else if (name ==
"spacing") {
126 }
else if (name ==
"size") {
128 }
else if (name ==
"editable") {
137 return val.empty() ? def : val;
149 if (name ==
"default") {
151 }
else if (name ==
"focused") {
153 }
else if (name ==
"hovered") {
155 }
else if (name ==
"pressed") {
183 if ((state & i) != 0) {
184 temp = temp | styles[i];
213 std::array<video::SColor, 4> def)
const
219 std::vector<std::string> strs;
223 for (
size_t i = 0; i <= 3; i++) {
238 std::vector<std::string> strs;
242 for (
size_t i = 0; i <= 3; i++)
243 def[i] =
stoi(strs[i]);
254 core::rect<s32> rect;
266 core::rect<s32> rect;
294 return v2s32(vec.X, vec.Y);
304 return v2s32(vec.X, vec.Y);
314 if (font.empty() && size.empty())
317 std::vector<std::string> modes =
split(font,
',');
319 for (
size_t i = 0; i < modes.size(); i++) {
320 if (modes[i] ==
"normal")
322 else if (modes[i] ==
"mono")
324 else if (modes[i] ==
"bold")
326 else if (modes[i] ==
"italic")
328 else if (modes[i] ==
"_no_server_media")
335 if (size[0] ==
'*') {
336 std::string new_size = size.substr(1);
338 }
else if (size[0] ==
'+' || size[0] ==
'-') {
341 calc_size =
stoi(size);
344 spec.
size = (unsigned)std::min(std::max(calc_size, 1), 999);
351 video::ITexture *def)
const
358 video::ITexture *texture = tsrc->
getTexture(val);
368 video::ITexture *texture = tsrc->
getTexture(val);
410 bool parseArray(
const std::string &value, std::vector<std::string> &arr)
const
412 std::vector<std::string> strs =
split(value,
',');
414 if (strs.size() == 1) {
415 arr = {strs[0], strs[0], strs[0], strs[0]};
416 }
else if (strs.size() == 2) {
417 arr = {strs[0], strs[1], strs[0], strs[1]};
418 }
else if (strs.size() == 4) {
422 <<
" arguments): \"" << value <<
"\"" << std::endl;
428 bool parseRect(
const std::string &value, core::rect<s32> *parsed_rect)
const
430 core::rect<s32> rect;
431 std::vector<std::string> v_rect =
split(value,
',');
433 if (v_rect.size() == 1) {
434 s32
x =
stoi(v_rect[0]);
435 rect.UpperLeftCorner = core::vector2di(
x,
x);
436 rect.LowerRightCorner = core::vector2di(-
x, -
x);
437 }
else if (v_rect.size() == 2) {
438 s32
x =
stoi(v_rect[0]);
439 s32
y =
stoi(v_rect[1]);
440 rect.UpperLeftCorner = core::vector2di(
x,
y);
441 rect.LowerRightCorner = core::vector2di(-
x, -
y);
443 }
else if (v_rect.size() == 4) {
444 rect.UpperLeftCorner = core::vector2di(
446 rect.LowerRightCorner = core::vector2di(
449 warningstream <<
"Invalid rectangle string format: \"" << value
450 <<
"\"" << std::endl;
462 std::vector<std::string> v_vector =
split(value,
',');
464 if (v_vector.size() == 1) {
465 f32
x =
stof(v_vector[0]);
468 }
else if (v_vector.size() == 2) {
469 vec.X =
stof(v_vector[0]);
470 vec.Y =
stof(v_vector[1]);
472 warningstream <<
"Invalid 2d vector string format: \"" << value
473 <<
"\"" << std::endl;
Definition texturesource.h:34
virtual video::ITexture * getTexture(const std::string &name, u32 *id=nullptr)=0
Generates a texture string into a standard texture.
Definition StyleSpec.h:18
gui::IGUIFont * getFont() const
Definition StyleSpec.h:307
static State getStateByName(const std::string &name)
Parses a name and returns the corresponding state enum.
Definition StyleSpec.h:147
core::rect< s32 > getRect(Property prop, core::rect< s32 > def) const
Definition StyleSpec.h:248
video::SColor getColor(Property prop) const
Definition StyleSpec.h:202
std::array< bool, NUM_PROPERTIES > property_set
Definition StyleSpec.h:67
bool getBool(Property prop, bool def) const
Definition StyleSpec.h:373
State
Definition StyleSpec.h:57
@ STATE_HOVERED
Definition StyleSpec.h:60
@ STATE_INVALID
Definition StyleSpec.h:63
@ STATE_FOCUSED
Definition StyleSpec.h:59
@ STATE_DEFAULT
Definition StyleSpec.h:58
@ STATE_PRESSED
Definition StyleSpec.h:61
@ NUM_STATES
Definition StyleSpec.h:62
bool parseVector2f(const std::string &value, v2f32 *parsed_vec) const
Definition StyleSpec.h:459
core::rect< s32 > getRect(Property prop) const
Definition StyleSpec.h:261
State getState() const
Gets the state that this style is intended for.
Definition StyleSpec.h:163
std::string get(Property prop, std::string def) const
Definition StyleSpec.h:134
v2s32 getVector2i(Property prop) const
Definition StyleSpec.h:297
Property
Definition StyleSpec.h:21
@ FONT_SIZE
Definition StyleSpec.h:40
@ BGCOLOR_PRESSED
Definition StyleSpec.h:25
@ SOUND
Definition StyleSpec.h:46
@ BORDERCOLORS
Definition StyleSpec.h:44
@ BGIMG_PRESSED
Definition StyleSpec.h:31
@ ALPHA
Definition StyleSpec.h:36
@ BGCOLOR_HOVERED
Definition StyleSpec.h:24
@ SPACING
Definition StyleSpec.h:47
@ BGIMG_MIDDLE
Definition StyleSpec.h:30
@ NOCLIP
Definition StyleSpec.h:26
@ SIZE
Definition StyleSpec.h:48
@ PADDING
Definition StyleSpec.h:38
@ NUM_PROPERTIES
Definition StyleSpec.h:51
@ COLORS
Definition StyleSpec.h:43
@ FONT
Definition StyleSpec.h:39
@ BORDER
Definition StyleSpec.h:27
@ HALIGN
Definition StyleSpec.h:41
@ FGIMG_PRESSED
Definition StyleSpec.h:35
@ NONE
Definition StyleSpec.h:52
@ TEXTCOLOR
Definition StyleSpec.h:22
@ BGCOLOR
Definition StyleSpec.h:23
@ BGIMG
Definition StyleSpec.h:28
@ BGIMG_HOVERED
Definition StyleSpec.h:29
@ FGIMG
Definition StyleSpec.h:32
@ BORDERWIDTHS
Definition StyleSpec.h:45
@ VALIGN
Definition StyleSpec.h:42
@ FGIMG_MIDDLE
Definition StyleSpec.h:34
@ CONTENT_OFFSET
Definition StyleSpec.h:37
@ EDITABLE
Definition StyleSpec.h:49
@ FGIMG_HOVERED
Definition StyleSpec.h:33
v2s32 getVector2i(Property prop, v2s32 def) const
Definition StyleSpec.h:284
static StyleSpec getStyleFromStatePropagation(const std::array< StyleSpec, NUM_STATES > &styles, State state)
Using a list of styles mapped to state values, calculate the final.
Definition StyleSpec.h:178
std::array< video::SColor, 4 > getColorArray(Property prop, std::array< video::SColor, 4 > def) const
Definition StyleSpec.h:212
static Property GetPropertyByName(const std::string &name)
Definition StyleSpec.h:72
bool isNotDefault(Property prop) const
Definition StyleSpec.h:383
StyleSpec operator|(const StyleSpec &other) const
Definition StyleSpec.h:402
void addState(State state)
Set the given state on this style.
Definition StyleSpec.h:169
bool parseArray(const std::string &value, std::vector< std::string > &arr) const
Definition StyleSpec.h:410
video::ITexture * getTexture(Property prop, ISimpleTextureSource *tsrc) const
Definition StyleSpec.h:363
bool parseRect(const std::string &value, core::rect< s32 > *parsed_rect) const
Definition StyleSpec.h:428
video::SColor getColor(Property prop, video::SColor def) const
Definition StyleSpec.h:191
State state_map
Definition StyleSpec.h:69
StyleSpec & operator|=(const StyleSpec &other)
Definition StyleSpec.h:390
void set(Property prop, const std::string &value)
Definition StyleSpec.h:140
video::ITexture * getTexture(Property prop, ISimpleTextureSource *tsrc, video::ITexture *def) const
Definition StyleSpec.h:350
std::array< s32, 4 > getIntArray(Property prop, std::array< s32, 4 > def) const
Definition StyleSpec.h:232
bool hasProperty(Property prop) const
Definition StyleSpec.h:388
std::array< std::string, NUM_PROPERTIES > properties
Definition StyleSpec.h:68
v2f32 getVector2f(Property prop, v2f32 def) const
Definition StyleSpec.h:271
#define FATAL_ERROR_IF(expr, msg)
Definition debug.h:54
FontEngine * g_fontengine
reference to access font engine, has to be initialized by main
Definition fontengine.cpp:21
@ FM_Standard
Regular font (settings "font_path*", overwritable).
Definition fontengine.h:29
@ FM_Mono
Monospace font (settings "mono_font*", overwritable).
Definition fontengine.h:32
#define FONT_SIZE_UNSPECIFIED
Definition fontengine.h:25
core::vector2d< f32 > v2f32
Definition irr_v2d.h:15
core::vector2d< s32 > v2s32
Definition irr_v2d.h:13
LogStream warningstream(warning_target)
bool parseColorString(const std::string &value, video::SColor &color, bool quiet, unsigned char default_alpha)
Definition string.cpp:582
#define stoi
Definition string.h:449
#define stof
Definition string.h:450
std::vector< std::basic_string< T > > split(std::basic_string_view< T > s, T delim, T escape=static_cast< T >('\\'))
Splits a string into its component parts separated by the character delimiter.
Definition string.h:681
bool is_yes(std::string_view str)
Returns whether str should be regarded as (bool) true.
Definition string.h:399
Definition fontengine.h:47
bool italic
Definition fontengine.h:68
bool allow_server_media
Definition fontengine.h:69
bool bold
Definition fontengine.h:67
unsigned int size
Definition fontengine.h:65
FontMode mode
Definition fontengine.h:66
constexpr v3f x
Definition test_irr_matrix4.cpp:18
constexpr v3f y
Definition test_irr_matrix4.cpp:19