58 normalImage = copyDrawableIfNotNull (normal);
59 overImage = copyDrawableIfNotNull (
over);
60 downImage = copyDrawableIfNotNull (
down);
61 disabledImage = copyDrawableIfNotNull (disabled);
62 normalImageOn = copyDrawableIfNotNull (
normalOn);
63 overImageOn = copyDrawableIfNotNull (
overOn);
64 downImageOn = copyDrawableIfNotNull (
downOn);
65 disabledImageOn = copyDrawableIfNotNull (
disabledOn);
67 currentImage =
nullptr;
98 if (shouldDrawButtonBackground())
118 if (currentImage !=
nullptr)
132 if (style == ImageOnButtonBackgroundOriginalSize)
146 float opacity = 1.0f;
155 : disabledImage.get();
169 if (currentImage !=
nullptr)
177 if (currentImage !=
nullptr)
198 if (shouldDrawButtonBackground())
199 lf.drawButtonBackground (g, *
this,
218 return (
getToggleState() && normalImageOn !=
nullptr) ? normalImageOn.get()
226 if (overImageOn !=
nullptr)
return overImageOn.get();
227 if (normalImageOn !=
nullptr)
return normalImageOn.get();
230 return overImage !=
nullptr ? overImage.get() : normalImage.get();
235 if (
auto* d =
getToggleState() ? downImageOn.get() : downImage.get())
int proportionOfWidth(float proportion) const noexcept
Returns a proportion of the component's width.
void setInterceptsMouseClicks(bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept
Changes the default return value for the hitTest() method.
int proportionOfHeight(float proportion) const noexcept
Returns a proportion of the component's height.
int getHeight() const noexcept
Returns the component's height in pixels.
void setAlpha(float newAlpha)
Changes the transparency of this component.
void addAndMakeVisible(Component *child, int zOrder=-1)
Adds a child component to this one, and also makes the child visible if it isn't already.
void repaint()
Marks the whole component as needing to be redrawn.
virtual void resized()
Called when this component's size has been changed.
void removeChildComponent(Component *childToRemove)
Removes one of this component's child-components.
Colour findColour(int colourID, bool inheritFromParent=false) const
Looks for a colour that has been registered with the given colour ID number.
int getWidth() const noexcept
Returns the component's width in pixels.
bool isEnabled() const noexcept
Returns true if the component (and all its parents) are enabled.
LookAndFeel & getLookAndFeel() const noexcept
Finds the appropriate look-and-feel to use for this component.
Rectangle< int > getLocalBounds() const noexcept
Returns the component's bounds, relative to its own origin.
The base class for objects which can draw themselves, e.g.
virtual std::unique_ptr< Drawable > createCopy() const =0
Creates a deep copy of this Drawable object.
void setTransformToFit(const Rectangle< float > &areaInParent, RectanglePlacement placement)
Sets a transform for this drawable that will position it within the specified area of its parent comp...
A graphics context, used for drawing a component or image.
@ doNotResize
Indicates that the source rectangle's size should be left unchanged.
@ centred
A shorthand value that is equivalent to (xMid | yMid).
@ stretchToFit
If this flag is set, then the source rectangle will be resized to completely fill the destination rec...
Manages a rectangle and allows geometric operations to be performed on it.
@ buttonColourId
The colour used to fill the button shape (when the button is toggled 'off').
@ buttonOnColourId
The colour used to fill the button shape (when the button is toggled 'on').
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...