TGUI  0.7.4
tgui::ButtonRenderer Class Reference
Inheritance diagram for tgui::ButtonRenderer:
tgui::WidgetRenderer tgui::WidgetBorders

Public Member Functions

 ButtonRenderer (Button *button)
 Constructor. More...
 
virtual void setProperty (std::string property, const std::string &value) override
 Change a property of the renderer. More...
 
virtual void setProperty (std::string property, ObjectConverter &&value) override
 Change a property of the renderer. More...
 
virtual ObjectConverter getProperty (std::string property) const override
 Retrieve the value of a certain property. More...
 
virtual std::map< std::string, ObjectConvertergetPropertyValuePairs () const override
 Get a map with all properties and their values. More...
 
void setTextColor (const Color &color)
 Changes the color of the text. More...
 
void setTextColorNormal (const Color &color)
 Changes the color of the text in the normal state (mouse not on button). More...
 
void setTextColorHover (const Color &color)
 Changes the color of the text in the hover state (mouse on button, but not pressed). More...
 
void setTextColorDown (const Color &color)
 Changes the color of the text in the down state (mouse on button and left mouse button being held down). More...
 
void setBackgroundColor (const Color &color)
 Changes the color of the background. More...
 
void setBackgroundColorNormal (const Color &color)
 Changes the color of the background in the normal state (mouse not on button). More...
 
void setBackgroundColorHover (const Color &color)
 Changes the color of the background in the hover state (mouse on button, but not pressed). More...
 
void setBackgroundColorDown (const Color &color)
 Changes the color of the background in the down state (mouse on button and left mouse button being held down). More...
 
void setBorderColor (const Color &color)
 Changes the color of the borders. More...
 
void setNormalTexture (const Texture &texture)
 Change the image that is displayed when the mouse is not on the button. More...
 
void setHoverTexture (const Texture &texture)
 Change the image that is displayed when the mouse is located on top of the button. More...
 
void setDownTexture (const Texture &texture)
 Change the image that is displayed when the mouse is held down on top of the button. More...
 
void setFocusTexture (const Texture &texture)
 Change the image that is drawn on top of the button image when the button is focused. More...
 
- Public Member Functions inherited from tgui::WidgetRenderer
virtual ~WidgetRenderer ()
 Virtual destructor.
 
- Public Member Functions inherited from tgui::WidgetBorders
virtual void setBorders (const Borders &borders)
 Changes the size of the borders. More...
 
void setBorders (float leftBorder, float topBorder, float rightBorder, float bottomBorder)
 Changes the size of the borders. More...
 
void setBorders (float width, float height)
 Changes the size of the borders. More...
 
virtual Borders getBorders () const
 Returns the size of the borders as a tgui::Borders. More...
 

Constructor & Destructor Documentation

◆ ButtonRenderer()

tgui::ButtonRenderer::ButtonRenderer ( Button button)
inline

Constructor.

Parameters
buttonThe button that is connected to the renderer

Member Function Documentation

◆ getProperty()

virtual ObjectConverter tgui::ButtonRenderer::getProperty ( std::string  property) const
overridevirtual

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

Reimplemented from tgui::WidgetRenderer.

◆ getPropertyValuePairs()

virtual std::map<std::string, ObjectConverter> tgui::ButtonRenderer::getPropertyValuePairs ( ) const
overridevirtual

Get a map with all properties and their values.

Returns
Property-value pairs of the renderer

Reimplemented from tgui::WidgetRenderer.

◆ setBackgroundColor()

void tgui::ButtonRenderer::setBackgroundColor ( const Color color)

Changes the color of the background.

Parameters
colorNew background color

This color will overwrite the color for any state (normal, hover and down).

Note that this color is ignored when you set an image as background.

See also
setBackgroundColorNormal
setBackgroundColorHover
setBackgroundColorDown

◆ setBackgroundColorDown()

void tgui::ButtonRenderer::setBackgroundColorDown ( const Color color)

Changes the color of the background in the down state (mouse on button and left mouse button being held down).

Parameters
colorNew background color

Note that this color is ignored when you set an image as background.

◆ setBackgroundColorHover()

void tgui::ButtonRenderer::setBackgroundColorHover ( const Color color)

Changes the color of the background in the hover state (mouse on button, but not pressed).

Parameters
colorNew background color

Note that this color is ignored when you set an image as background.

◆ setBackgroundColorNormal()

void tgui::ButtonRenderer::setBackgroundColorNormal ( const Color color)

Changes the color of the background in the normal state (mouse not on button).

Parameters
colorNew background color

Note that this color is ignored when you set an image as background.

◆ setBorderColor()

void tgui::ButtonRenderer::setBorderColor ( const Color color)

Changes the color of the borders.

Parameters
colorNew border color

◆ setDownTexture()

void tgui::ButtonRenderer::setDownTexture ( const Texture texture)

Change the image that is displayed when the mouse is held down on top of the button.

Parameters
textureThe new down texture

Pass an empty texture to unset the image.

◆ setFocusTexture()

void tgui::ButtonRenderer::setFocusTexture ( const Texture texture)

Change the image that is drawn on top of the button image when the button is focused.

Parameters
textureThe new focus texture

Pass an empty texture to unset the image.

◆ setHoverTexture()

void tgui::ButtonRenderer::setHoverTexture ( const Texture texture)

Change the image that is displayed when the mouse is located on top of the button.

Parameters
textureThe new hover texture

Pass an empty texture to unset the image.

◆ setNormalTexture()

void tgui::ButtonRenderer::setNormalTexture ( const Texture texture)

Change the image that is displayed when the mouse is not on the button.

Parameters
textureThe new normal texture

When this image is set, the background color property will be ignored. Pass an empty texture to unset the image, in this case the background color property will be used again.

◆ setProperty() [1/2]

virtual void tgui::ButtonRenderer::setProperty ( std::string  property,
const std::string &  value 
)
overridevirtual

Change a property of the renderer.

Parameters
propertyThe property that you would like to change
valueThe new serialized value that you like to assign to the property
Exceptions
Exceptionwhen deserialization fails or when the widget does not have this property.

Reimplemented from tgui::WidgetRenderer.

◆ setProperty() [2/2]

virtual void tgui::ButtonRenderer::setProperty ( std::string  property,
ObjectConverter &&  value 
)
overridevirtual

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

Reimplemented from tgui::WidgetRenderer.

◆ setTextColor()

void tgui::ButtonRenderer::setTextColor ( const Color color)

Changes the color of the text.

Parameters
colorNew text color

This color will overwrite the color for any state (normal, hover and down).

See also
setTextColorNormal
setTextColorHover
setTextColorDown

◆ setTextColorDown()

void tgui::ButtonRenderer::setTextColorDown ( const Color color)

Changes the color of the text in the down state (mouse on button and left mouse button being held down).

Parameters
colorNew text color

◆ setTextColorHover()

void tgui::ButtonRenderer::setTextColorHover ( const Color color)

Changes the color of the text in the hover state (mouse on button, but not pressed).

Parameters
colorNew text color

◆ setTextColorNormal()

void tgui::ButtonRenderer::setTextColorNormal ( const Color color)

Changes the color of the text in the normal state (mouse not on button).

Parameters
colorNew text color

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