Public Types | Public Member Functions | List of all members
ime::ui::ButtonRenderer Class Reference

A Button widget renderer. More...

#include <ButtonRenderer.h>

Inheritance diagram for ime::ui::ButtonRenderer:
ime::ui::IWidgetRenderer

Public Types

using Ptr = std::unique_ptr< IWidgetRenderer >
 Unique renderer pointer. More...
 

Public Member Functions

void setBorders (const Borders &borders)
 Change the ize of the widget borders. More...
 
Borders getBorders () const
 Get the ize of the widgets borders. More...
 
void setTextColour (Colour colour)
 Set the colour of the text displayed on the button. More...
 
Colour getTextColour () const
 Get the colour of the button text. More...
 
void setTextHoverColour (Colour colour)
 Set the text colour when the mouse enters the button. More...
 
Colour getTextHoverColour () const
 Get the text colour when the mouse enters the button. More...
 
void setTextColourOnMouseDown (Colour colour)
 Set the text colour when the left mouse button is down on the button. More...
 
Colour getTextColourOnMouseDown () const
 Get the text colour when the left mouse button is down on the button. More...
 
void setDisabledTextColour (Colour colour)
 Set the colour of the text when the button is disabled. More...
 
Colour getDisabledTextColour () const
 Get the colour of the text when the button is disabled. More...
 
void setFocusedTextColour (Colour colour)
 Set the text colour when the button is focused but not hovered. More...
 
Colour getTextColourFocused () const
 Get the text colour when the button is focused but not hovered. More...
 
void setBackgroundColour (Colour colour)
 Set the background colour of the button. More...
 
Colour getBackgroundColour () const
 Get the background colour of button. More...
 
void setBackgroundHoverColour (Colour colour)
 Set the background colour of the button when the mouse enters it. More...
 
Colour getBackgroundColourHover () const
 Get the background colour of the button when the mouse enters it. More...
 
void setBackgroundColourDown (Colour colour)
 Set the background colour when the left mouse button is down on the button. More...
 
Colour getBackgroundColourDown () const
 Get the background colour when the left mouse button is down on the button. More...
 
void setDisabledBackgroundColour (Colour colour)
 Set the background colour of the button when it is disabled. More...
 
Colour getDisabledBackgroundColour () const
 Get the background colour of the button when it is disabled. More...
 
void setFocusedBackgroundColour (Colour colour)
 Set the background colour when the button is focused but not hovered. More...
 
Colour getFocusedBackgroundColour () const
 Get the background colour when the button is focused but not hovered. More...
 
void setBorderColour (Colour colour)
 Set the border colour. More...
 
Colour getBorderColour () const
 Get the border colour. More...
 
void setBorderHoverColour (Colour colour)
 Set the background colour of when the mouse enters the button. More...
 
Colour getBorderHoverColour () const
 Get the background colour of when the mouse enters the button. More...
 
void setBorderColourOnMouseDown (Colour colour)
 Set the background colour when the left mouse button is down on the button. More...
 
Colour getBorderColourOnMouseDown () const
 Get the background colour when the left mouse button is down on the button. More...
 
void setDisabledBorderColour (Colour colour)
 # More...
 
Colour getDisabledBorderColour () const
 # More...
 
void setFocusedBorderColour (Colour colour)
 Set the border colour when the button is focused but not hovered. More...
 
Colour getBorderColourFocused () const
 Get the border colour when the button is focused but not hovered. More...
 
void setTexture (const std::string &texture)
 Set the background image of the button. More...
 
void setTextureHover (const std::string &texture)
 Set the image when the mouse enters the button. More...
 
void setMouseDownTexture (const std::string &texture)
 Set the image when the left mouse button is down on the button. More...
 
void setDisabledTexture (const std::string &texture)
 Set the image when the button is disabled. More...
 
void setFocusedTextureFocused (const std::string &texture)
 Set the image when the button is focused but not hovered. More...
 
void setTextStyle (TextStyle style)
 Set the text style. More...
 
TextStyle getTextStyle () const
 Get the text style. More...
 
void setHoverTextStyle (TextStyle style)
 Set the text style when the mouse enters the button. More...
 
TextStyle getHoverTextStyle () const
 Get the text style when the mouse enters the button. More...
 
void setTextStyleOnMouseDown (TextStyle style)
 Set the style when the left mouse button is down on the button. More...
 
TextStyle getTextStyleOnMouseDown () const
 Get the style when the left mouse button is down on the button. More...
 
void setTextStyleDisabled (TextStyle style)
 Set the text style used when the button is disabled. More...
 
TextStyle getTextStyleDisabled () const
 Get the text style used when the button is disabled. More...
 
void setTextStyleFocused (TextStyle style)
 Set the text style used when the button is focused. More...
 
TextStyle getTextStyleFocused () const
 Get the text style used when the button is focused. More...
 
void setTextOutlineColour (Colour outlineColour)
 Set the outline colour of the text. More...
 
Colour getTextOutlineColour () const
 Get the outline colour of the text. More...
 
void setTextOutlineThickness (float outlineThickness)
 Set the thickness of the text outline. More...
 
float getTextOutlineThickness () const
 Get the thickness of the text outline. More...
 
void setRoundedBorderRadius (float radius)
 Set the radius for the rounded corners. More...
 
float getRoundedBorderRadius () const
 Get the radius of the rounded corners. More...
 
void setOpacity (float opacity) override
 Set the opacity of the widget. More...
 
float getOpacity () const override
 Get the opacity of the widget. More...
 
void setOpacityDisabled (float opacity) override
 Set the opacity of the widget when it is disabled. More...
 
float getOpacityDisabled () const override
 Get the opacity of the widget when it is disabled. More...
 
void setFont (const std::string &filename) override
 Change the widgets font. More...
 
void ignoreTransparentTexture (bool ignoreTransparentParts) override
 Set whether mouse events should be ignored on transparent parts of the texture of the widget in normal state. More...
 
bool isTransparentTextureIgnored () const override
 Check if mouse events are ignored on transparent parts of the texture or not. More...
 
IWidgetRenderer::Ptr clone () const override
 Create a copy of the render. More...
 
void setInternalPtr (tgui::WidgetRenderer *renderer) override
 
tgui::WidgetRenderer * getInternalPtr () override
 
 ~ButtonRenderer () override
 Destructor. More...
 

Detailed Description

A Button widget renderer.

This class allows you to manipulate the render properties of a Button

Definition at line 43 of file ButtonRenderer.h.

Member Typedef Documentation

◆ Ptr

using ime::ui::IWidgetRenderer::Ptr = std::unique_ptr<IWidgetRenderer>
inherited

Unique renderer pointer.

Definition at line 75 of file IWidgetRenderer.h.

Constructor & Destructor Documentation

◆ ~ButtonRenderer()

ime::ui::ButtonRenderer::~ButtonRenderer ( )
override

Destructor.

Member Function Documentation

◆ clone()

IWidgetRenderer::Ptr ime::ui::ButtonRenderer::clone ( ) const
overridevirtual

Create a copy of the render.

Returns
A copy of the render

Implements ime::ui::IWidgetRenderer.

◆ getBackgroundColour()

Colour ime::ui::ButtonRenderer::getBackgroundColour ( ) const

Get the background colour of button.

Returns
The background colour of the button

◆ getBackgroundColourDown()

Colour ime::ui::ButtonRenderer::getBackgroundColourDown ( ) const

Get the background colour when the left mouse button is down on the button.

Returns
The background colour when the left mouse button is down on the button

◆ getBackgroundColourHover()

Colour ime::ui::ButtonRenderer::getBackgroundColourHover ( ) const

Get the background colour of the button when the mouse enters it.

Returns
The background colour of the button when the mouse enters it

◆ getBorderColour()

Colour ime::ui::ButtonRenderer::getBorderColour ( ) const

Get the border colour.

Returns
The border colour

◆ getBorderColourFocused()

Colour ime::ui::ButtonRenderer::getBorderColourFocused ( ) const

Get the border colour when the button is focused but not hovered.

Returns
The border colour when the button is focused but not hovered

◆ getBorderColourOnMouseDown()

Colour ime::ui::ButtonRenderer::getBorderColourOnMouseDown ( ) const

Get the background colour when the left mouse button is down on the button.

Returns
The background colour when the left mouse button is down on the button

◆ getBorderHoverColour()

Colour ime::ui::ButtonRenderer::getBorderHoverColour ( ) const

Get the background colour of when the mouse enters the button.

Returns
The background colour of when the mouse enters the button

◆ getBorders()

Borders ime::ui::ButtonRenderer::getBorders ( ) const

Get the ize of the widgets borders.

Returns
The size of the widgets borders

◆ getDisabledBackgroundColour()

Colour ime::ui::ButtonRenderer::getDisabledBackgroundColour ( ) const

Get the background colour of the button when it is disabled.

Returns
The background colour of the button when it is disabled

◆ getDisabledBorderColour()

Colour ime::ui::ButtonRenderer::getDisabledBorderColour ( ) const

#

Get the background colour when the button is disabled

Returns
The background colour when the button is disabled

◆ getDisabledTextColour()

Colour ime::ui::ButtonRenderer::getDisabledTextColour ( ) const

Get the colour of the text when the button is disabled.

Returns
The colour of the text when the button is disabled

◆ getFocusedBackgroundColour()

Colour ime::ui::ButtonRenderer::getFocusedBackgroundColour ( ) const

Get the background colour when the button is focused but not hovered.

Returns
The background colour when the button is focused but not hovered

◆ getHoverTextStyle()

TextStyle ime::ui::ButtonRenderer::getHoverTextStyle ( ) const

Get the text style when the mouse enters the button.

Returns
The text style when the mouse enters the button

◆ getInternalPtr()

tgui::WidgetRenderer * ime::ui::ButtonRenderer::getInternalPtr ( )
overridevirtual

◆ getOpacity()

float ime::ui::ButtonRenderer::getOpacity ( ) const
overridevirtual

Get the opacity of the widget.

Returns
The opacity of the widget

Implements ime::ui::IWidgetRenderer.

◆ getOpacityDisabled()

float ime::ui::ButtonRenderer::getOpacityDisabled ( ) const
overridevirtual

Get the opacity of the widget when it is disabled.

Returns
The opacity of the widget in disabled state

This function will return -1 if the widget uses the same opacity as the enabled state when it is disabled

Implements ime::ui::IWidgetRenderer.

◆ getRoundedBorderRadius()

float ime::ui::ButtonRenderer::getRoundedBorderRadius ( ) const

Get the radius of the rounded corners.

Returns
The radius of the rounded corners
See also
setRoundedBorderRadius

◆ getTextColour()

Colour ime::ui::ButtonRenderer::getTextColour ( ) const

Get the colour of the button text.

Returns
The colour of the button text

◆ getTextColourFocused()

Colour ime::ui::ButtonRenderer::getTextColourFocused ( ) const

Get the text colour when the button is focused but not hovered.

Returns
The text colour when the button is focused but not hovered

◆ getTextColourOnMouseDown()

Colour ime::ui::ButtonRenderer::getTextColourOnMouseDown ( ) const

Get the text colour when the left mouse button is down on the button.

Returns
The text colour when the left mouse button is down on the button

◆ getTextHoverColour()

Colour ime::ui::ButtonRenderer::getTextHoverColour ( ) const

Get the text colour when the mouse enters the button.

Returns
The text colour when the mouse enters the button

◆ getTextOutlineColour()

Colour ime::ui::ButtonRenderer::getTextOutlineColour ( ) const

Get the outline colour of the text.

Returns
The outline colour of the text

◆ getTextOutlineThickness()

float ime::ui::ButtonRenderer::getTextOutlineThickness ( ) const

Get the thickness of the text outline.

Returns
The thickness of the text outline

◆ getTextStyle()

TextStyle ime::ui::ButtonRenderer::getTextStyle ( ) const

Get the text style.

Returns
The text style

◆ getTextStyleDisabled()

TextStyle ime::ui::ButtonRenderer::getTextStyleDisabled ( ) const

Get the text style used when the button is disabled.

Returns
The text style used when the button is disabled

◆ getTextStyleFocused()

TextStyle ime::ui::ButtonRenderer::getTextStyleFocused ( ) const

Get the text style used when the button is focused.

Returns
The text style used when the button is focused

◆ getTextStyleOnMouseDown()

TextStyle ime::ui::ButtonRenderer::getTextStyleOnMouseDown ( ) const

Get the style when the left mouse button is down on the button.

Returns
Get the style when the left mouse button is down on the button

◆ ignoreTransparentTexture()

void ime::ui::ButtonRenderer::ignoreTransparentTexture ( bool  ignoreTransparentParts)
overridevirtual

Set whether mouse events should be ignored on transparent parts of the texture of the widget in normal state.

Parameters
ignoreTransparentPartsTrue to ignore mouse events on transparent parts of the texture, otherwise false

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

Implements ime::ui::IWidgetRenderer.

◆ isTransparentTextureIgnored()

bool ime::ui::ButtonRenderer::isTransparentTextureIgnored ( ) const
overridevirtual

Check if mouse events are ignored on transparent parts of the texture or not.

Returns
True if mouse events are ignored, otherwise false
See also
ignoreTransparentTexture

Implements ime::ui::IWidgetRenderer.

◆ setBackgroundColour()

void ime::ui::ButtonRenderer::setBackgroundColour ( Colour  colour)

Set the background colour of the button.

Parameters
colourThe background colour to set
Note
that this colour is ignored when you set a background image

◆ setBackgroundColourDown()

void ime::ui::ButtonRenderer::setBackgroundColourDown ( Colour  colour)

Set the background colour when the left mouse button is down on the button.

Parameters
colourThe backgound colour to set
Note
This colour is ignored when you set a background image

◆ setBackgroundHoverColour()

void ime::ui::ButtonRenderer::setBackgroundHoverColour ( Colour  colour)

Set the background colour of the button when the mouse enters it.

Parameters
colourThe background colour to set
Note
that this colour is ignored when you set a background image

◆ setBorderColour()

void ime::ui::ButtonRenderer::setBorderColour ( Colour  colour)

Set the border colour.

Parameters
colourThe border colour to set

◆ setBorderColourOnMouseDown()

void ime::ui::ButtonRenderer::setBorderColourOnMouseDown ( Colour  colour)

Set the background colour when the left mouse button is down on the button.

Parameters
colourBackground colour to set

◆ setBorderHoverColour()

void ime::ui::ButtonRenderer::setBorderHoverColour ( Colour  colour)

Set the background colour of when the mouse enters the button.

Parameters
colourThe background colour to set

◆ setBorders()

void ime::ui::ButtonRenderer::setBorders ( const Borders borders)

Change the ize of the widget borders.

Parameters
bordersThe size of the borders

◆ setDisabledBackgroundColour()

void ime::ui::ButtonRenderer::setDisabledBackgroundColour ( Colour  colour)

Set the background colour of the button when it is disabled.

Parameters
colourBackground colour to set
Note
This colour is ignored when you set a background image

◆ setDisabledBorderColour()

void ime::ui::ButtonRenderer::setDisabledBorderColour ( Colour  colour)

#

Set the background colour when the button is disabled

Parameters
colourThe background colour when the button is disabled

◆ setDisabledTextColour()

void ime::ui::ButtonRenderer::setDisabledTextColour ( Colour  colour)

Set the colour of the text when the button is disabled.

Parameters
colourThe colour to be set

◆ setDisabledTexture()

void ime::ui::ButtonRenderer::setDisabledTexture ( const std::string &  texture)

Set the image when the button is disabled.

Parameters
textureFilename of the image to be set
Exceptions
FileNotFoundExceptionIf the image cannot be found on the disk

When this image is set then the background colour property will be ignored

◆ setFocusedBackgroundColour()

void ime::ui::ButtonRenderer::setFocusedBackgroundColour ( Colour  colour)

Set the background colour when the button is focused but not hovered.

Parameters
colourBackground colour to be set
Note
This colour is ignored when you set a background image

◆ setFocusedBorderColour()

void ime::ui::ButtonRenderer::setFocusedBorderColour ( Colour  colour)

Set the border colour when the button is focused but not hovered.

Parameters
colourBorder colour to set

◆ setFocusedTextColour()

void ime::ui::ButtonRenderer::setFocusedTextColour ( Colour  colour)

Set the text colour when the button is focused but not hovered.

Parameters
colourColour to be set

◆ setFocusedTextureFocused()

void ime::ui::ButtonRenderer::setFocusedTextureFocused ( const std::string &  texture)

Set the image when the button is focused but not hovered.

Parameters
textureFilename of the image to be set
Exceptions
FileNotFoundExceptionIf the image cannot be found on the disk

When this image is set then the background colour property will be ignored

◆ setFont()

void ime::ui::ButtonRenderer::setFont ( const std::string &  filename)
overridevirtual

Change the widgets font.

Parameters
filenameFilename of the new font
Exceptions
FileNotFoundExceptionIf the font cannot be found on the disk

Implements ime::ui::IWidgetRenderer.

◆ setHoverTextStyle()

void ime::ui::ButtonRenderer::setHoverTextStyle ( TextStyle  style)

Set the text style when the mouse enters the button.

Parameters
styleThe style to be set

◆ setInternalPtr()

void ime::ui::ButtonRenderer::setInternalPtr ( tgui::WidgetRenderer *  renderer)
overridevirtual

◆ setMouseDownTexture()

void ime::ui::ButtonRenderer::setMouseDownTexture ( const std::string &  texture)

Set the image when the left mouse button is down on the button.

Parameters
textureFilename of the image to be set
Exceptions
FileNotFoundExceptionIf the image cannot be found on the disk

When this image is set then the background colour property will be ignored

◆ setOpacity()

void ime::ui::ButtonRenderer::setOpacity ( float  opacity)
overridevirtual

Set the opacity of the widget.

Parameters
opacityThe new opacity of the widget in between 0 and 1

0 means completely transparent, while 1 (default) means fully opaque

Implements ime::ui::IWidgetRenderer.

◆ setOpacityDisabled()

void ime::ui::ButtonRenderer::setOpacityDisabled ( float  opacity)
overridevirtual

Set the opacity of the widget when it is disabled.

Parameters
opacityOpacity to set between 0 and 1

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.

Implements ime::ui::IWidgetRenderer.

◆ setRoundedBorderRadius()

void ime::ui::ButtonRenderer::setRoundedBorderRadius ( float  radius)

Set the radius for the rounded corners.

Parameters
radiusRadius of the corners

This function will round the corners of the button, radius controls how much rounding is applied to the borders of the button.

By default the radius is 0, meaning the button is not rounded

Warning
This property is ignored when textures are used as background

◆ setTextColour()

void ime::ui::ButtonRenderer::setTextColour ( Colour  colour)

Set the colour of the text displayed on the button.

Parameters
colourThe new test colour

◆ setTextColourOnMouseDown()

void ime::ui::ButtonRenderer::setTextColourOnMouseDown ( Colour  colour)

Set the text colour when the left mouse button is down on the button.

Parameters
colourColour to set

This colour is the same as the text colour by default

◆ setTextHoverColour()

void ime::ui::ButtonRenderer::setTextHoverColour ( Colour  colour)

Set the text colour when the mouse enters the button.

Parameters
colourThe colour to be set

◆ setTextOutlineColour()

void ime::ui::ButtonRenderer::setTextOutlineColour ( Colour  outlineColour)

Set the outline colour of the text.

Parameters
outlineColourThe outline colour to set

◆ setTextOutlineThickness()

void ime::ui::ButtonRenderer::setTextOutlineThickness ( float  outlineThickness)

Set the thickness of the text outline.

Parameters
outlineThicknessThe new txt outline thickness

◆ setTextStyle()

void ime::ui::ButtonRenderer::setTextStyle ( TextStyle  style)

Set the text style.

Parameters
styleThe style to be set

◆ setTextStyleDisabled()

void ime::ui::ButtonRenderer::setTextStyleDisabled ( TextStyle  style)

Set the text style used when the button is disabled.

Parameters
styleThe text style to be ste

◆ setTextStyleFocused()

void ime::ui::ButtonRenderer::setTextStyleFocused ( TextStyle  style)

Set the text style used when the button is focused.

Parameters
styleThe style to set

◆ setTextStyleOnMouseDown()

void ime::ui::ButtonRenderer::setTextStyleOnMouseDown ( TextStyle  style)

Set the style when the left mouse button is down on the button.

Parameters
styleThe style to be set

◆ setTexture()

void ime::ui::ButtonRenderer::setTexture ( const std::string &  texture)

Set the background image of the button.

Parameters
textureFilename of the image to be set
Exceptions
FileNotFoundExceptionIf the image cannot be found on the disk

When this image is set then the background colour property will be ignored

◆ setTextureHover()

void ime::ui::ButtonRenderer::setTextureHover ( const std::string &  texture)

Set the image when the mouse enters the button.

Parameters
textureFilename of the image to be set
Exceptions
FileNotFoundExceptionIf the image cannot be found on the disk

When this image is set then the background colour property will be ignored


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