TGUI
1.6.1
|
Base class for all renderer classes. More...
#include <TGUI/Renderers/WidgetRenderer.hpp>
Public Member Functions | |
WidgetRenderer ()=default | |
Default constructor. | |
WidgetRenderer (const WidgetRenderer &) | |
Copy constructor. | |
WidgetRenderer (WidgetRenderer &&)=default | |
Default move constructor. | |
WidgetRenderer & | operator= (const WidgetRenderer &) |
Copy assignment operator. | |
WidgetRenderer & | operator= (WidgetRenderer &&)=default |
Default move assignment operator. | |
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 (const 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 | setTextSize (unsigned int size) |
Changes the text size of the widget that is specified by the renderer. | |
unsigned int | getTextSize () const |
Returns text size of the widget that is specified by the renderer. | |
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 (Widget *widget) |
Subscribes a callback function to changes in the renderer. | |
void | unsubscribe (Widget *widget) |
Subscribes a callback function to changes in the renderer. | |
void | setData (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. | |
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 |
|
nodiscard |
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.
|
nodiscard |
Returns the renderer data.
|
nodiscard |
Returns the font associated with the widget (if any)
|
nodiscard |
Returns the opacity of the widget.
|
nodiscard |
Returns the opacity of the widget when it is disabled.
|
nodiscard |
Retrieves the value of a certain property.
property | The property that you would like to retrieve |
|
nodiscard |
Gets a map with all properties and their values.
|
nodiscard |
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.
|
nodiscard |
Returns whether mouse events should be ignored on transparent parts of the texture of the widget.
void tgui::WidgetRenderer::setFont | ( | const 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 | ( | Widget * | widget | ) |
Subscribes a callback function to changes in the renderer.
widget | The widget that should to be alerted when the renderer changes |
void tgui::WidgetRenderer::unsubscribe | ( | Widget * | widget | ) |
Subscribes a callback function to changes in the renderer.
widget | The widget that used to be alerted when the renderer changed |