TGUI
0.10-beta
|
Base class for all renderer classes. More...
#include <TGUI/Renderers/WidgetRenderer.hpp>
Public Member Functions | |
WidgetRenderer ()=default | |
Default constructor. | |
WidgetRenderer (const std::shared_ptr< RendererData > &data) | |
Construct the renderer from renderer data. More... | |
virtual | ~WidgetRenderer ()=default |
Virtual destructor. | |
void | setOpacity (float opacity) |
Changes the opacity of the widget. More... | |
float | getOpacity () const |
Returns the opacity of the widget. More... | |
void | setOpacityDisabled (float opacity) |
Changes the opacity of the widget when it is disabled. More... | |
float | getOpacityDisabled () const |
Returns the opacity of the widget when it is disabled. More... | |
void | setFont (Font font) |
Changes the font used for the text in the widget. More... | |
Font | getFont () const |
Returns the font associated with the widget (if any) More... | |
void | setTextSize (unsigned int size) |
Changes the text size of the widget that is specified by the renderer. More... | |
unsigned int | getTextSize () const |
Returns text size of the widget that is specified by the renderer. More... | |
void | setTransparentTexture (bool ignoreTransparentParts) |
Sets whether mouse events should be ignored on transparent parts of the texture of the widget in normal state. More... | |
bool | getTransparentTexture () const |
Returns whether mouse events should be ignored on transparent parts of the texture of the widget. More... | |
void | setProperty (const String &property, ObjectConverter &&value) |
Changes a property of the renderer. More... | |
ObjectConverter | getProperty (const String &property) const |
Retrieves the value of a certain property. More... | |
const std::map< String, ObjectConverter > & | getPropertyValuePairs () const |
Gets a map with all properties and their values. More... | |
void | subscribe (const void *id, const std::function< void(const String &property)> &function) |
Subscribes a callback function to changes in the renderer. More... | |
void | unsubscribe (const void *id) |
Subscribes a callback function to changes in the renderer. More... | |
void | setData (const std::shared_ptr< RendererData > &data) |
std::shared_ptr< RendererData > | getData () const |
Returns the renderer data. More... | |
std::shared_ptr< RendererData > | clone () const |
Gets a clone of the renderer data. More... | |
Protected Attributes | |
std::shared_ptr< RendererData > | m_data = RendererData::create() |
Base class for all renderer classes.
|
inline |
Construct the renderer from renderer data.
data | Renderer data to initialize the renderer with |
std::shared_ptr< RendererData > tgui::WidgetRenderer::clone | ( | ) | const |
Gets a clone of the renderer data.
You can pass this to a widget with the setRenderer function to have a separate non-shared copy of this renderer.
std::shared_ptr< RendererData > tgui::WidgetRenderer::getData | ( | ) | const |
Returns the renderer data.
Font tgui::WidgetRenderer::getFont | ( | ) | const |
Returns the font associated with the widget (if any)
float tgui::WidgetRenderer::getOpacity | ( | ) | const |
Returns the opacity of the widget.
float tgui::WidgetRenderer::getOpacityDisabled | ( | ) | const |
Returns the opacity of the widget when it is disabled.
ObjectConverter tgui::WidgetRenderer::getProperty | ( | const String & | property | ) | const |
Retrieves the value of a certain property.
property | The property that you would like to retrieve |
const std::map< String, ObjectConverter > & tgui::WidgetRenderer::getPropertyValuePairs | ( | ) | const |
Gets a map with all properties and their values.
unsigned int tgui::WidgetRenderer::getTextSize | ( | ) | const |
Returns text size of the widget that is specified by the renderer.
By default, this function will return 0 which means the renderer isn't overwriting the text size of the widget. Use the getTextSize() function of the widget itself (instead of the one from the renderer) to get the actual size.
bool tgui::WidgetRenderer::getTransparentTexture | ( | ) | const |
Returns whether mouse events should be ignored on transparent parts of the texture of the widget.
void tgui::WidgetRenderer::setFont | ( | Font | font | ) |
Changes the font used for the text in the widget.
font | The new font |
When you don't call this function then the font from the parent widget will be used.
void tgui::WidgetRenderer::setOpacity | ( | float | opacity | ) |
Changes the opacity of the widget.
opacity | The opacity of the widget. 0 means completely transparent, while 1 (default) means fully opaque |
void tgui::WidgetRenderer::setOpacityDisabled | ( | float | opacity | ) |
Changes the opacity of the widget when it is disabled.
opacity | The opacity of the widget in disabled state. 0 means completely transparent, while 1 (default) means fully opaque. Set to -1 (default) to use the normal opacity value even when the widget is disabled. |
void tgui::WidgetRenderer::setProperty | ( | const String & | property, |
ObjectConverter && | value | ||
) |
Changes a property of the renderer.
property | The property that you would like to change |
value | The new value that you like to assign to the property. The ObjectConverter is implicitly constructed from the possible value types |
Exception | for unknown properties or when value was of a wrong type |
void tgui::WidgetRenderer::setTextSize | ( | unsigned int | size | ) |
Changes the text size of the widget that is specified by the renderer.
size | The new text size to use |
If the text size is 0 (default) then the renderer won't overwrite the text size of the widget.
void tgui::WidgetRenderer::setTransparentTexture | ( | bool | ignoreTransparentParts | ) |
Sets whether mouse events should be ignored on transparent parts of the texture of the widget in normal state.
ignoreTransparentParts Should mouse events on transparent texture parts be ignored?
When mouse events are ignored, they are passed to a widget behind the widget. By default, mouse events are NOT ignored and the widget will receive mouse events even on transparent texture parts.
This property does nothing if the widget doesn't use textures.
void tgui::WidgetRenderer::subscribe | ( | const void * | id, |
const std::function< void(const String &property)> & | function | ||
) |
Subscribes a callback function to changes in the renderer.
id | Unique identifier for this callback function so that you can unsubscribe it later |
function | Callback function to call when the renderer changes |
void tgui::WidgetRenderer::unsubscribe | ( | const void * | id | ) |
Subscribes a callback function to changes in the renderer.
id | Unique identifier used when subscribing the callback function |