A Button widget renderer. More...
#include <ButtonRenderer.h>
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... | |
A Button widget renderer.
This class allows you to manipulate the render properties of a Button
Definition at line 43 of file ButtonRenderer.h.
|
inherited |
Unique renderer pointer.
Definition at line 75 of file IWidgetRenderer.h.
|
override |
Destructor.
|
overridevirtual |
Colour ime::ui::ButtonRenderer::getBackgroundColour | ( | ) | const |
Get the background colour of button.
Colour ime::ui::ButtonRenderer::getBackgroundColourDown | ( | ) | const |
Get the background colour when the left mouse button is down on the button.
Colour ime::ui::ButtonRenderer::getBackgroundColourHover | ( | ) | const |
Get the background colour of the button when the mouse enters it.
Colour ime::ui::ButtonRenderer::getBorderColour | ( | ) | const |
Get the border colour.
Colour ime::ui::ButtonRenderer::getBorderColourFocused | ( | ) | const |
Get the border colour when the button is focused but not hovered.
Colour ime::ui::ButtonRenderer::getBorderColourOnMouseDown | ( | ) | const |
Get the background colour when the left mouse button is down on the button.
Colour ime::ui::ButtonRenderer::getBorderHoverColour | ( | ) | const |
Get the background colour of when the mouse enters the button.
Borders ime::ui::ButtonRenderer::getBorders | ( | ) | const |
Get the ize of the widgets borders.
Colour ime::ui::ButtonRenderer::getDisabledBackgroundColour | ( | ) | const |
Get the background colour of the button when it is disabled.
Colour ime::ui::ButtonRenderer::getDisabledBorderColour | ( | ) | const |
#
Get the background colour when the button is disabled
Colour ime::ui::ButtonRenderer::getDisabledTextColour | ( | ) | const |
Get the colour of the text when the button is disabled.
Colour ime::ui::ButtonRenderer::getFocusedBackgroundColour | ( | ) | const |
Get the background colour when the button is focused but not hovered.
TextStyle ime::ui::ButtonRenderer::getHoverTextStyle | ( | ) | const |
Get the text style when the mouse enters the button.
|
overridevirtual |
Implements ime::ui::IWidgetRenderer.
|
overridevirtual |
Get the opacity of the widget.
Implements ime::ui::IWidgetRenderer.
|
overridevirtual |
Get the opacity of the widget when it is disabled.
This function will return -1 if the widget uses the same opacity as the enabled state when it is disabled
Implements ime::ui::IWidgetRenderer.
float ime::ui::ButtonRenderer::getRoundedBorderRadius | ( | ) | const |
Get the radius of the rounded corners.
Colour ime::ui::ButtonRenderer::getTextColour | ( | ) | const |
Get the colour of the button text.
Colour ime::ui::ButtonRenderer::getTextColourFocused | ( | ) | const |
Get the text colour when the button is focused but not hovered.
Colour ime::ui::ButtonRenderer::getTextColourOnMouseDown | ( | ) | const |
Get the text colour when the left mouse button is down on the button.
Colour ime::ui::ButtonRenderer::getTextHoverColour | ( | ) | const |
Get the text colour when the mouse enters the button.
Colour ime::ui::ButtonRenderer::getTextOutlineColour | ( | ) | const |
Get the outline colour of the text.
float ime::ui::ButtonRenderer::getTextOutlineThickness | ( | ) | const |
Get the thickness of the text outline.
TextStyle ime::ui::ButtonRenderer::getTextStyle | ( | ) | const |
Get the text style.
TextStyle ime::ui::ButtonRenderer::getTextStyleDisabled | ( | ) | const |
Get the text style used when the button is disabled.
TextStyle ime::ui::ButtonRenderer::getTextStyleFocused | ( | ) | const |
Get the text style used when the button is focused.
TextStyle ime::ui::ButtonRenderer::getTextStyleOnMouseDown | ( | ) | const |
Get the style when the left mouse button is down on the button.
|
overridevirtual |
Set whether mouse events should be ignored on transparent parts of the texture of the widget in normal state.
ignoreTransparentParts | True 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.
|
overridevirtual |
Check if mouse events are ignored on transparent parts of the texture or not.
Implements ime::ui::IWidgetRenderer.
void ime::ui::ButtonRenderer::setBackgroundColour | ( | Colour | colour | ) |
Set the background colour of the button.
colour | The background colour to set |
void ime::ui::ButtonRenderer::setBackgroundColourDown | ( | Colour | colour | ) |
Set the background colour when the left mouse button is down on the button.
colour | The backgound colour to set |
void ime::ui::ButtonRenderer::setBackgroundHoverColour | ( | Colour | colour | ) |
Set the background colour of the button when the mouse enters it.
colour | The background colour to set |
void ime::ui::ButtonRenderer::setBorderColour | ( | Colour | colour | ) |
Set the border colour.
colour | The border colour to set |
void ime::ui::ButtonRenderer::setBorderColourOnMouseDown | ( | Colour | colour | ) |
Set the background colour when the left mouse button is down on the button.
colour | Background colour to set |
void ime::ui::ButtonRenderer::setBorderHoverColour | ( | Colour | colour | ) |
Set the background colour of when the mouse enters the button.
colour | The background colour to set |
void ime::ui::ButtonRenderer::setBorders | ( | const Borders & | borders | ) |
Change the ize of the widget borders.
borders | The size of the borders |
void ime::ui::ButtonRenderer::setDisabledBackgroundColour | ( | Colour | colour | ) |
Set the background colour of the button when it is disabled.
colour | Background colour to set |
void ime::ui::ButtonRenderer::setDisabledBorderColour | ( | Colour | colour | ) |
#
Set the background colour when the button is disabled
colour | The background colour when the button is disabled |
void ime::ui::ButtonRenderer::setDisabledTextColour | ( | Colour | colour | ) |
Set the colour of the text when the button is disabled.
colour | The colour to be set |
void ime::ui::ButtonRenderer::setDisabledTexture | ( | const std::string & | texture | ) |
Set the image when the button is disabled.
texture | Filename of the image to be set |
FileNotFoundException | If the image cannot be found on the disk |
When this image is set then the background colour property will be ignored
void ime::ui::ButtonRenderer::setFocusedBackgroundColour | ( | Colour | colour | ) |
Set the background colour when the button is focused but not hovered.
colour | Background colour to be set |
void ime::ui::ButtonRenderer::setFocusedBorderColour | ( | Colour | colour | ) |
Set the border colour when the button is focused but not hovered.
colour | Border colour to set |
void ime::ui::ButtonRenderer::setFocusedTextColour | ( | Colour | colour | ) |
Set the text colour when the button is focused but not hovered.
colour | Colour to be set |
void ime::ui::ButtonRenderer::setFocusedTextureFocused | ( | const std::string & | texture | ) |
Set the image when the button is focused but not hovered.
texture | Filename of the image to be set |
FileNotFoundException | If the image cannot be found on the disk |
When this image is set then the background colour property will be ignored
|
overridevirtual |
Change the widgets font.
filename | Filename of the new font |
FileNotFoundException | If the font cannot be found on the disk |
Implements ime::ui::IWidgetRenderer.
void ime::ui::ButtonRenderer::setHoverTextStyle | ( | TextStyle | style | ) |
Set the text style when the mouse enters the button.
style | The style to be set |
|
overridevirtual |
Implements ime::ui::IWidgetRenderer.
void ime::ui::ButtonRenderer::setMouseDownTexture | ( | const std::string & | texture | ) |
Set the image when the left mouse button is down on the button.
texture | Filename of the image to be set |
FileNotFoundException | If the image cannot be found on the disk |
When this image is set then the background colour property will be ignored
|
overridevirtual |
Set the opacity of the widget.
opacity | The new opacity of the widget in between 0 and 1 |
0 means completely transparent, while 1 (default) means fully opaque
Implements ime::ui::IWidgetRenderer.
|
overridevirtual |
Set the opacity of the widget when it is disabled.
opacity | Opacity 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.
void ime::ui::ButtonRenderer::setRoundedBorderRadius | ( | float | radius | ) |
Set the radius for the rounded corners.
radius | Radius 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
void ime::ui::ButtonRenderer::setTextColour | ( | Colour | colour | ) |
Set the colour of the text displayed on the button.
colour | The new test colour |
void ime::ui::ButtonRenderer::setTextColourOnMouseDown | ( | Colour | colour | ) |
Set the text colour when the left mouse button is down on the button.
colour | Colour to set |
This colour is the same as the text colour by default
void ime::ui::ButtonRenderer::setTextHoverColour | ( | Colour | colour | ) |
Set the text colour when the mouse enters the button.
colour | The colour to be set |
void ime::ui::ButtonRenderer::setTextOutlineColour | ( | Colour | outlineColour | ) |
Set the outline colour of the text.
outlineColour | The outline colour to set |
void ime::ui::ButtonRenderer::setTextOutlineThickness | ( | float | outlineThickness | ) |
Set the thickness of the text outline.
outlineThickness | The new txt outline thickness |
void ime::ui::ButtonRenderer::setTextStyle | ( | TextStyle | style | ) |
Set the text style.
style | The style to be set |
void ime::ui::ButtonRenderer::setTextStyleDisabled | ( | TextStyle | style | ) |
Set the text style used when the button is disabled.
style | The text style to be ste |
void ime::ui::ButtonRenderer::setTextStyleFocused | ( | TextStyle | style | ) |
Set the text style used when the button is focused.
style | The style to set |
void ime::ui::ButtonRenderer::setTextStyleOnMouseDown | ( | TextStyle | style | ) |
Set the style when the left mouse button is down on the button.
style | The style to be set |
void ime::ui::ButtonRenderer::setTexture | ( | const std::string & | texture | ) |
Set the background image of the button.
texture | Filename of the image to be set |
FileNotFoundException | If the image cannot be found on the disk |
When this image is set then the background colour property will be ignored
void ime::ui::ButtonRenderer::setTextureHover | ( | const std::string & | texture | ) |
Set the image when the mouse enters the button.
texture | Filename of the image to be set |
FileNotFoundException | If the image cannot be found on the disk |
When this image is set then the background colour property will be ignored