UTFWin::IDrawable class

A class that is capable of drawing a user interface component.

IDrawables are used by IWindow objects to render. The most important method is the IDrawable::Paint() method, which is the only one that is really required.

An IDrawable::Paint() call doesn't need to paint the entire component at once; some components might do multiple calls varying the RenderParams object that is passed as an argument. This way the IWindow can draw different images, for example, on different positions (for example, in a WinScrollbar you first want to draw the background, then the handle at the handle position, etc).

An IDrawable can also take care of collision detection. This can be useful in buttons, for example, where the shape might not necessarily be a rectangle.

Base classes

class UTFWinObject

Derived classes

class ButtonDrawableRadio
The standard IDrawable for a standard, simple radio or checkbox button component.
class ButtonDrawableStandard
The standard IDrawable for a standard, simple button component.
class ComboBoxDrawable
The standard IDrawable for a combo box component.
class DefaultDrawable
A class that implements all the methods of an IDrawable.
class DialogDrawable
The standard IDrawable for a dialog component.
class FrameDrawable
FrameDrawable is a procedural drawable that renders multiple frame styles depending on the current state.
class ImageDrawable
A standard IDrawable that renders an image.
class ScrollbarDrawable
The standard IDrawable for a scrollbar component.
class SliderDrawable
The standard IDrawable for a slider component.
class SpinnerDrawable
The standard IDrawable for a spinner component.
class StdDrawable
The standard IDrawable for user interactive components.
class VariableWidthDrawable
A drawable that completely fills the window of variable width with a graphic without a horizontal stretch.

Public types

enum CollisionTypes { kDefaultCollisionType = 0x19C46FB }

Public static variables

static const uint32_t TYPE

Public functions

auto Cast(uint32_t) const -> void* override
auto Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) -> void pure virtual
Paints this drawable onto the given UIRenderer.
auto IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) -> bool pure virtual
Tells whether the point specified is colliding in this drawable or not.
auto GetDimensions(Dimensions& dst, int state, int index) -> bool pure virtual
Used to get the dimensions of an image contained in this drawable.
auto UseCollision(uint32_t type, bool& dst) -> bool pure virtual
Tells whether the collision of a window should be handled by this drawable or not.

Function documentation

void UTFWin::IDrawable::Paint(UIRenderer* pRenderer, const Math::Rectangle& area, const RenderParams& params) pure virtual

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::IDrawable::IsColliding(const Math::Rectangle& area, const Math::Point& point, RenderParams& params) pure virtual

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::IDrawable::GetDimensions(Dimensions& dst, int state, int index) pure virtual

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::IDrawable::UseCollision(uint32_t type, bool& dst) pure virtual

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.