UTFWin::ButtonDrawableStandard class

The standard IDrawable for a standard, simple button component.

Base classes

class IDrawable
A class that is capable of drawing a user interface component.
class DefaultLayoutElement
A default implementation of ILayoutElement.
class IButtonDrawable
This class is a type of UTFWin::IDrawable capable of rendering an UTFWin::IButton.

Constructors, destructors, conversion operators

ButtonDrawableStandard()
~ButtonDrawableStandard() virtual

Public functions

auto GetTexCoords(int state, Math::Rectangle& dst) const -> bool virtual
Gets the texture coordinates that must be used to render the image that corresponds to the given state.
auto AddRef() -> int override
auto Release() -> int override
auto Cast(uint32_t type) const -> void* override
auto SetSerializer(Serializer& dst) -> void override
auto GetProxyID() const -> uint32_t override
Returns the ID that identifies this type of element in a SPUI file.
auto Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) -> void override
Paints this drawable onto the given UIRenderer.
auto IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) -> bool override
Tells whether the point specified is colliding in this drawable or not.
auto GetDimensions(Dimensions& dst, int state, int index) -> bool override
Used to get the dimensions of an image contained in this drawable.
auto UseCollision(uint32_t type, bool& dst) -> bool override
Tells whether the collision of a window should be handled by this drawable or not.
auto ToDrawable() -> IDrawable* override
Get the IDrawable instance that represents this class.
auto SetImage(Image* pImage, bool bTileable) -> void override
Set the image used by this drawable.

Protected variables

ImagePtr mpImage
bool mbTileable

Function documentation

bool UTFWin::ButtonDrawableStandard::GetTexCoords(int state, Math::Rectangle& dst) const virtual

Gets the texture coordinates that must be used to render the image that corresponds to the given state.

Parameters
state The state of the window.
dst out The Rectangle where the texture coordinates will be written.
Returns Whether there's a valid image or not.

void UTFWin::ButtonDrawableStandard::Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) override

Paints this drawable onto the given UIRenderer.

Parameters
pRenderer The UIRenderer where this must be drawn.
area The area of the window to draw.
params RenderParams that contain additional information (e.g. what image do draw, the current state, etc).

bool UTFWin::ButtonDrawableStandard::IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) override

Tells whether the point specified is colliding in this drawable or not.

Parameters
area The area of the window that is using this drawable.
point The Point to check whether it collides or not. Its coordinates are relative to the window position.
params Additional information, probably unused.

This method is useful for drawables that use hitmasks.

bool UTFWin::ButtonDrawableStandard::GetDimensions(Dimensions& dst, int state, int index) override

Used to get the dimensions of an image contained in this drawable.

Parameters
dst out The Dimensions where the result must be written.
state The current state flags of the window.
index The index of the image whose dimensions must be returned.
Returns True if the dimensions were got, false otherwise.

bool UTFWin::ButtonDrawableStandard::UseCollision(uint32_t type, bool& dst) override

Tells whether the collision of a window should be handled by this drawable or not.

Parameters
type The type, usually kDefaultCollisionType.
dst out If the collision type is supported, whether it must be handled by this drawable or not.
Returns True if the collision type is supported (even if it's not handled by this drawable), false otherwise.

void UTFWin::ButtonDrawableStandard::SetImage(Image* pImage, bool bTileable) override

Set the image used by this drawable.

Parameters
pImage The image to use in this drawable.
bTileable Specifies whether the image should be edge tiled.

The image must be composed of 4 or 6 different images of the same dimensions, that represent different states. For standard buttons: Disabled | Normal | Highlighted | Depressed. For radio buttons: Normal | Highlighted | Depressed | Selected | Selected Highlighted | Selected Depressed.