TGUI  1.3-dev
Loading...
Searching...
No Matches
tgui::WidgetRenderer Class Reference

Base class for all renderer classes. More...

#include <TGUI/Renderers/WidgetRenderer.hpp>

Inheritance diagram for tgui::WidgetRenderer:
tgui::ButtonRenderer tgui::ChatBoxRenderer tgui::ChildWindowRenderer tgui::ComboBoxRenderer tgui::EditBoxRenderer tgui::GroupRenderer tgui::KnobRenderer tgui::LabelRenderer tgui::ListBoxRenderer tgui::ListViewRenderer tgui::MenuBarRenderer tgui::PictureRenderer tgui::ProgressBarRenderer tgui::RadioButtonRenderer tgui::ScrollbarRenderer tgui::SeparatorLineRenderer tgui::SliderRenderer tgui::SpinButtonRenderer tgui::TabsRenderer tgui::TextAreaRenderer tgui::TreeViewRenderer

Public Member Functions

 WidgetRenderer ()=default
 Default constructor.
 
 WidgetRenderer (const WidgetRenderer &)
 Copy constructor.
 
 WidgetRenderer (WidgetRenderer &&)=default
 Default move constructor.
 
WidgetRendereroperator= (const WidgetRenderer &)
 Copy assignment operator.
 
WidgetRendereroperator= (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.
 
TGUI_NODISCARD float getOpacity () const
 Returns the opacity of the widget.
 
void setOpacityDisabled (float opacity)
 Changes the opacity of the widget when it is disabled.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD 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.
 
TGUI_NODISCARD ObjectConverter getProperty (const String &property) const
 Retrieves the value of a certain property.
 
TGUI_NODISCARD 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 (const std::shared_ptr< RendererData > &data)
 
TGUI_NODISCARD std::shared_ptr< RendererDatagetData () const
 Returns the renderer data.
 
TGUI_NODISCARD std::shared_ptr< RendererDataclone () const
 Gets a clone of the renderer data.
 

Protected Attributes

std::shared_ptr< RendererDatam_data = RendererData::create()
 

Detailed Description

Base class for all renderer classes.

Constructor & Destructor Documentation

◆ WidgetRenderer()

tgui::WidgetRenderer::WidgetRenderer ( const std::shared_ptr< RendererData > & data)
inline

Construct the renderer from renderer data.

Parameters
dataRenderer data to initialize the renderer with

Member Function Documentation

◆ clone()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD Font tgui::WidgetRenderer::getFont ( ) const

Returns the font associated with the widget (if any)

Returns
Font used by widget

◆ getOpacity()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD ObjectConverter tgui::WidgetRenderer::getProperty ( const String & property) const

Retrieves the value of a certain property.

Parameters
propertyThe 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()

TGUI_NODISCARD const std::map< String, ObjectConverter > & tgui::WidgetRenderer::getPropertyValuePairs ( ) const

Gets a map with all properties and their values.

Returns
Property-value pairs of the renderer

◆ getTextSize()

TGUI_NODISCARD 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.

Returns
Text size of the widget or 0 if the renderer doesn't specify a text size

◆ getTransparentTexture()

TGUI_NODISCARD 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 ( const Font & font)

Changes the font used for the text in the widget.

Parameters
fontThe new font

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
opacityThe 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
opacityThe 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()

void tgui::WidgetRenderer::setProperty ( const String & property,
ObjectConverter && value )

Changes a property of the renderer.

Parameters
propertyThe property that you would like to change
valueThe new value that you like to assign to the property. The ObjectConverter is implicitly constructed from the possible value types
Exceptions
Exceptionfor unknown properties or when value was of a wrong type

◆ setTextSize()

void tgui::WidgetRenderer::setTextSize ( unsigned int size)

Changes the text size of the widget that is specified by the renderer.

Parameters
sizeThe new text size to use

If the text size is 0 (default) then the renderer won't overwrite the text size of the widget.

◆ 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 ( Widget * widget)

Subscribes a callback function to changes in the renderer.

Parameters
widgetThe widget that should to be alerted when the renderer changes

◆ unsubscribe()

void tgui::WidgetRenderer::unsubscribe ( Widget * widget)

Subscribes a callback function to changes in the renderer.

Parameters
widgetThe widget that used to be alerted when the renderer changed

The documentation for this class was generated from the following file: