Loading...
Searching...
No Matches
26#ifndef TGUI_RENDERER_DEFINES_HPP
27#define TGUI_RENDERER_DEFINES_HPP
30#include <TGUI/Loading/Theme.hpp>
34#define TGUI_RENDERER_PROPERTY_OUTLINE(CLASS, NAME) \
35 tgui::Outline CLASS::get##NAME() const \
37 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
38 if (it != m_data->propertyValuePairs.end()) \
39 return it->second.getOutline(); \
43 void CLASS::set##NAME(const tgui::Outline& outline) \
45 setProperty(tgui::String(#NAME), {outline}); \
50#define TGUI_RENDERER_PROPERTY_COLOR(CLASS, NAME, DEFAULT) \
51 tgui::Color CLASS::get##NAME() const \
53 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
54 if (it != m_data->propertyValuePairs.end()) \
55 return it->second.getColor(); \
59 void CLASS::set##NAME(tgui::Color color) \
61 setProperty(tgui::String(#NAME), {color}); \
66#define TGUI_RENDERER_PROPERTY_TEXT_STYLE(CLASS, NAME, DEFAULT) \
67 tgui::TextStyles CLASS::get##NAME() const \
69 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
70 if (it != m_data->propertyValuePairs.end()) \
71 return it->second.getTextStyle(); \
75 void CLASS::set##NAME(tgui::TextStyles style) \
77 setProperty(tgui::String(#NAME), ObjectConverter{style}); \
82#define TGUI_RENDERER_PROPERTY_GET_NUMBER(CLASS, NAME, DEFAULT) \
83 float CLASS::get##NAME() const \
85 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
86 if (it != m_data->propertyValuePairs.end()) \
87 return it->second.getNumber(); \
92#define TGUI_RENDERER_PROPERTY_NUMBER(CLASS, NAME, DEFAULT) \
93 TGUI_RENDERER_PROPERTY_GET_NUMBER(CLASS, NAME, DEFAULT) \
94 void CLASS::set##NAME(float number) \
96 setProperty(tgui::String(#NAME), ObjectConverter{number}); \
101#define TGUI_RENDERER_PROPERTY_GET_BOOL(CLASS, NAME, DEFAULT) \
102 bool CLASS::get##NAME() const \
104 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
105 if (it != m_data->propertyValuePairs.end()) \
106 return it->second.getBool(); \
111#define TGUI_RENDERER_PROPERTY_BOOL(CLASS, NAME, DEFAULT) \
112 TGUI_RENDERER_PROPERTY_GET_BOOL(CLASS, NAME, DEFAULT) \
113 void CLASS::set##NAME(bool flag) \
115 setProperty(tgui::String(#NAME), ObjectConverter{flag}); \
120#define TGUI_RENDERER_PROPERTY_TEXTURE(CLASS, NAME) \
121 const tgui::Texture& CLASS::get##NAME() const \
123 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
124 if (it != m_data->propertyValuePairs.end()) \
125 return it->second.getTexture(); \
128 m_data->propertyValuePairs[tgui::String(#NAME)] = {tgui::Texture{}}; \
129 return m_data->propertyValuePairs[tgui::String(#NAME)].getTexture(); \
132 void CLASS::set##NAME(const tgui::Texture& texture) \
134 setProperty(tgui::String(#NAME), {texture}); \
139#define TGUI_RENDERER_PROPERTY_RENDERER_WITH_DEFAULT(CLASS, NAME, RENDERER, DEFAULT) \
140 std::shared_ptr<tgui::RendererData> CLASS::get##NAME() const \
142 const auto it = m_data->propertyValuePairs.find(tgui::String(#NAME)); \
143 if (it != m_data->propertyValuePairs.end()) \
144 return it->second.getRenderer(); \
147 const auto& renderer = tgui::Theme::getDefault()->getRendererNoThrow(RENDERER); \
148 m_data->propertyValuePairs[tgui::String(#NAME)] = {renderer ? renderer : DEFAULT}; \
152 void CLASS::set##NAME(std::shared_ptr<tgui::RendererData> renderer) \
154 setProperty(tgui::String(#NAME), {renderer}); \
157#define TGUI_RENDERER_PROPERTY_RENDERER(CLASS, NAME, RENDERER) \
158 TGUI_RENDERER_PROPERTY_RENDERER_WITH_DEFAULT(CLASS, NAME, RENDERER, tgui::RendererData::create()) \