Struct UIElementΒΆ

struct UIElement

A struct, representing an UI element in a View.

Subclassed by Button, ColorRect, ComboBox, DialogueArea, ImageRect, Label, NinePatchImageRect, TextBox, ValueSlider

Public Functions

UIElement()

Empty constructor.

UIElement(const std::string &typeName)

Constructor with a name for the element type. Shall be used by derived structs.

inline virtual ~UIElement()

Virtual destructor.

virtual void init()

Initialize the properties and callbacks.

virtual void config()

Routine to update the element after a property has been changed.

virtual void update() = 0

Update routine.

virtual void draw(Rectangle rect) = 0

Draw routine using a rect.

virtual void onNotify(Event event)

Notify routine, element responds to an event.

Public Members

std::unordered_map<std::string, ElementProperty> props = {}

A map of the properties of this element.

std::unordered_map<std::string, std::function<void()>> callbacks = {}

A map of the callbacks that this element has.

std::string typeName = ""

Name of the type of this UI element.