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<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[nestedProperty->name] = {
String(
"{\n" + ss.str() +
"}")};
71 std::map<String, ObjectConverter> propertyValuePairs;
72 std::map<
const void*, std::function<void(
const String& property)>> observers;
228 void subscribe(
const void*
id,
const std::function<
void(
const 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
Wrapper class to store strings.
Definition String.hpp:79
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36
Shared data used in renderer classes.
Definition WidgetRenderer.hpp:42