26#ifndef TGUI_WIDGET_RENDERER_HPP
27#define TGUI_WIDGET_RENDERER_HPP
30#include <TGUI/Config.hpp>
31#include <TGUI/ObjectConverter.hpp>
32#include <TGUI/Loading/DataIO.hpp>
45 static std::shared_ptr<RendererData> create(
const std::map<std::string, ObjectConverter>& init = {})
47 auto data = std::make_shared<RendererData>();
48 data->propertyValuePairs = init;
53 static std::shared_ptr<RendererData> createFromDataIONode(
const DataIO::Node* rendererNode)
55 auto rendererData = std::make_shared<RendererData>();
56 rendererData->shared =
false;
58 for (
const auto& pair : rendererNode->propertyValuePairs)
59 rendererData->propertyValuePairs[pair.first] =
ObjectConverter(pair.second->value);
61 for (
const auto& nestedProperty : rendererNode->children)
64 DataIO::emit(nestedProperty, ss);
65 rendererData->propertyValuePairs[
toLower(nestedProperty->name)] = {sf::String{
"{\n" + ss.str() +
"}"}};
71 std::map<std::string, ObjectConverter> propertyValuePairs;
72 std::map<
const void*, std::function<void(
const std::string& property)>> observers;
228 void subscribe(
const void*
id,
const std::function<
void(
const std::string& property)>&
function);
247 void setData(
const std::shared_ptr<RendererData>& data);
258 std::shared_ptr<RendererData>
getData()
const;
267 std::shared_ptr<RendererData>
clone()
const;
273 std::shared_ptr<RendererData> m_data = RendererData::create();
Implicit converter for settable properties.
Definition: ObjectConverter.hpp:48
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:37
TGUI_API std::string toLower(const std::string &str)
Converts a string to lowercase.
Shared data used in renderer classes.
Definition: WidgetRenderer.hpp:42