Base class for all renderer classes.
More...
#include <TGUI/Renderers/WidgetRenderer.hpp>
|
| WidgetRenderer ()=default |
| Default constructor.
|
|
| WidgetRenderer (const std::shared_ptr< RendererData > &data) |
| Construct the renderer from renderer data.
|
|
virtual | ~WidgetRenderer ()=default |
| Virtual destructor.
|
|
void | setOpacity (float opacity) |
| Changes the opacity of the widget.
|
|
float | getOpacity () const |
| Returns the opacity of the widget.
|
|
void | setOpacityDisabled (float opacity) |
| Changes the opacity of the widget when it is disabled.
|
|
float | getOpacityDisabled () const |
| Returns the opacity of the widget when it is disabled.
|
|
void | setFont (Font font) |
| Changes the font used for the text in the widget.
|
|
Font | getFont () const |
| Returns the font associated with the widget (if any)
|
|
void | setTransparentTexture (bool ignoreTransparentParts) |
| Sets whether mouse events should be ignored on transparent parts of the texture of the widget in normal state.
|
|
bool | getTransparentTexture () const |
| Returns whether mouse events should be ignored on transparent parts of the texture of the widget.
|
|
void | setProperty (const String &property, ObjectConverter &&value) |
| Changes a property of the renderer.
|
|
ObjectConverter | getProperty (const String &property) const |
| Retrieves the value of a certain property.
|
|
const std::map< String, ObjectConverter > & | getPropertyValuePairs () const |
| Gets a map with all properties and their values.
|
|
void | subscribe (const void *id, const std::function< void(const String &property)> &function) |
| Subscribes a callback function to changes in the renderer.
|
|
void | unsubscribe (const void *id) |
| Subscribes a callback function to changes in the renderer.
|
|
void | setData (const std::shared_ptr< RendererData > &data) |
|
std::shared_ptr< RendererData > | getData () const |
| Returns the renderer data.
|
|
std::shared_ptr< RendererData > | clone () const |
| Gets a clone of the renderer data.
|
|
|
std::shared_ptr< RendererData > | m_data = RendererData::create() |
|
Base class for all renderer classes.
◆ WidgetRenderer()
tgui::WidgetRenderer::WidgetRenderer |
( |
const std::shared_ptr< RendererData > & |
data | ) |
|
|
inline |
Construct the renderer from renderer data.
- Parameters
-
data | Renderer data to initialize the renderer with |
◆ clone()
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.
◆ getData()
std::shared_ptr< RendererData > tgui::WidgetRenderer::getData |
( |
| ) |
const |
Returns the renderer data.
- Returns
- Data that is shared between the renderers
- Warning
- You should not make changed to this data directly. Instead, use the function from the renderer classes
◆ getFont()
Font tgui::WidgetRenderer::getFont |
( |
| ) |
const |
Returns the font associated with the widget (if any)
- Returns
- Font used by widget
◆ getOpacity()
float tgui::WidgetRenderer::getOpacity |
( |
| ) |
const |
Returns the opacity of the widget.
- Returns
- The opacity of the widget. 0 means completely transparent, while 1 (default) means fully opaque
◆ getOpacityDisabled()
float tgui::WidgetRenderer::getOpacityDisabled |
( |
| ) |
const |
Returns the opacity of the widget when it is disabled.
- Returns
- The opacity of the widget in disabled state, or -1 when using the not using a different opacity when the widget is enabled or disabled.
◆ getProperty()
Retrieves the value of a certain property.
- Parameters
-
property | The property that you would like to retrieve |
- Returns
- The value inside a ObjectConverter object which you can extract with the correct get function or an ObjectConverter object with type ObjectConverter::Type::None when the property did not exist.
◆ getPropertyValuePairs()
Gets a map with all properties and their values.
- Returns
- Property-value pairs of the renderer
◆ getTransparentTexture()
bool tgui::WidgetRenderer::getTransparentTexture |
( |
| ) |
const |
Returns whether mouse events should be ignored on transparent parts of the texture of the widget.
- Returns
- Whether mouse events on transparent texture parts are ignored
- See also
- setTransparentTexture
◆ setFont()
void tgui::WidgetRenderer::setFont |
( |
Font |
font | ) |
|
Changes the font used for the text in the widget.
- Parameters
-
When you don't call this function then the font from the parent widget will be used.
◆ setOpacity()
void tgui::WidgetRenderer::setOpacity |
( |
float |
opacity | ) |
|
Changes the opacity of the widget.
- Parameters
-
opacity | The opacity of the widget. 0 means completely transparent, while 1 (default) means fully opaque |
◆ setOpacityDisabled()
void tgui::WidgetRenderer::setOpacityDisabled |
( |
float |
opacity | ) |
|
Changes the opacity of the widget when it is disabled.
- Parameters
-
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. |
◆ setProperty()
Changes a property of the renderer.
- Parameters
-
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 |
- Exceptions
-
Exception | for unknown properties or when value was of a wrong type |
◆ setTransparentTexture()
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.
◆ subscribe()
void tgui::WidgetRenderer::subscribe |
( |
const void * |
id, |
|
|
const std::function< void(const String &property)> & |
function |
|
) |
| |
Subscribes a callback function to changes in the renderer.
- Parameters
-
id | Unique identifier for this callback function so that you can unsubscribe it later |
function | Callback function to call when the renderer changes |
◆ unsubscribe()
void tgui::WidgetRenderer::unsubscribe |
( |
const void * |
id | ) |
|
Subscribes a callback function to changes in the renderer.
- Parameters
-
id | Unique identifier used when subscribing the callback function |
The documentation for this class was generated from the following file: