Krotos Modules 3
Loading...
Searching...
No Matches
krotos::OpacityDrawableButton Class Reference

Helper class to create DrawableButtons with opacity hover states using a single Drawable resource. Lower overhead than the traditional method as it only instantiates as many drawables as needed. More...

#include <DrawableButtonHelpers.h>

Inheritance diagram for krotos::OpacityDrawableButton:
krotos::ContextMenuButton

Public Member Functions

 OpacityDrawableButton (std::unique_ptr< Drawable > drawable, const String &name, DrawableButton::ButtonStyle style, float opacityNormal, float opacityHover=0.0f, float opacityDown=0.0f, Colour targetColourToChangeAlpha=Colours::white)
 Creates a DrawableButton with opacity hover states specified by the targetColourToChangeAlpha. This may not work for all drawable SVGs since it relies on changing a single colour. it's best suited for simple graphics that use a single colour. Lower overhead than creating 3 separate drawables for each state and only instantiates as many drawables as needed.
 

Detailed Description

Helper class to create DrawableButtons with opacity hover states using a single Drawable resource. Lower overhead than the traditional method as it only instantiates as many drawables as needed.

Constructor & Destructor Documentation

◆ OpacityDrawableButton()

krotos::OpacityDrawableButton::OpacityDrawableButton ( std::unique_ptr< Drawable > drawable,
const String & name,
DrawableButton::ButtonStyle style,
float opacityNormal,
float opacityHover = 0.0f,
float opacityDown = 0.0f,
Colour targetColourToChangeAlpha = Colours::white )

Creates a DrawableButton with opacity hover states specified by the targetColourToChangeAlpha. This may not work for all drawable SVGs since it relies on changing a single colour. it's best suited for simple graphics that use a single colour. Lower overhead than creating 3 separate drawables for each state and only instantiates as many drawables as needed.

Parameters
drawableThe drawable to use for the button.
nameThe name of the button.
styleThe draw style.
opacityNormalDefault opacity to draw at.
opacityHoverOpacity to draw when the mouse is hovering over
opacityDownOpacity to draw at when the mouse is down
targetColourToChangeAlphaThe target colour in the SVG to apply the alpha to.

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