libGumball 0.0.1
C23-Based, libGimbal-powered UI Library
Loading...
Searching...
No Matches
gumball_widget.h File Reference

Go to the source code of this file.

Macros

#define GUM_Widget_create(...)
Type System

Type UUID and cast operators

#define GUM_WIDGET_TYPE
#define GUM_WIDGET(self)
#define GUM_WIDGET_CLASS(klass)
#define GUM_WIDGET_CLASSOF(self)

Variables

Properties

Widget properties you can set/get at or after creation.

float x
float y
float w
float h
uint8_t r
uint8_t g
uint8_t b
uint8_t a
uint8_t border_r
uint8_t border_g
uint8_t border_b
uint8_t border_a
uint8_t border_width
float border_radius
bool border_highlight
bool isRelative
GblStringRef * label
GUM_Fontfont
GUM_TextAlignment textAlignment
GUM_Texturetexture
uint8_t font_size
uint8_t font_r
uint8_t font_g
uint8_t font_b
uint8_t font_a
uint8_t font_border_r
uint8_t font_border_g
uint8_t font_border_b
uint8_t font_border_a
uint8_t font_border_thickness
uint8_t z_index

Detailed Description

GUM_Widget data structure and hierarchy graph

GUM_Widget is the most basic, fundamental element.

It is the parent class for all drawable elements in libGumball, holding variables that are common to all drawable elements, such as position, size, and color.

Todo
  • Make variables private
  • Separate isRelative into position and size relative
  • Add GUM_Vector2 position and size as properties
  • Make border highlight configurable (color, thickness)
Author
2025 Agustín Bellagamba

Macro Definition Documentation

◆ GUM_WIDGET_TYPE

#define GUM_WIDGET_TYPE

Returns the GUM_Widget Type UUID.

◆ GUM_WIDGET

#define GUM_WIDGET ( self)

Casts an instance of a compatible element to a GUM_Widget.

◆ GUM_WIDGET_CLASS

#define GUM_WIDGET_CLASS ( klass)

Casts an class of a compatible element to a GUM_WidgetClass.

◆ GUM_WIDGET_CLASSOF

#define GUM_WIDGET_CLASSOF ( self)

Casts an instance of a compatible element to a GUM_Widget.

◆ GUM_Widget_create

#define GUM_Widget_create ( ...)

Returns a new GUM_Widget. Optionally takes in a list of Name/Value pairs for properties.

Variable Documentation

◆ x

float x

Horizontal position of the widget.

Default value is 0

◆ y

float y

Vertical position of the widget.

Default value is 0

◆ w

float w

Width of the widget.

Default value is 200

◆ h

float h

Height of the widget.

Default value is 200

◆ r

uint8_t r

Red component of the widget color.

Default value is 0

◆ g

uint8_t g

Green component of the widget color.

Default value is 255

◆ b

uint8_t b

Blue component of the widget color.

Default value is 0

◆ a

uint8_t a

Alpha component of the widget color.

Default value is 255

◆ border_r

uint8_t border_r

Red component of the border color.

Default value is 0

◆ border_g

uint8_t border_g

Green component of the border color.

Default value is 0

◆ border_b

uint8_t border_b

Blue component of the border color.

Default value is 0

◆ border_a

uint8_t border_a

Alpha component of the border color.

Default value is 0

◆ border_width

uint8_t border_width

Width of the border, in pixels.

Default value is 4

◆ border_radius

float border_radius

Radius of the border.

Default value is 0

◆ border_highlight

bool border_highlight

If the border should be highlighted.

Default value is false

◆ isRelative

bool isRelative

If the widget's position and size should be relative to its parent.

Default value is false

◆ label

GblStringRef* label

Optional text label of the widget.

Default value is nullptr

◆ font

GUM_Font* font

Optional font for the widget's label.

If not set, the default font is used. Default value is nullptr

◆ textAlignment

GUM_TextAlignment textAlignment

Alignment of the widget's label.

Default value is GUM_TEXT_ALIGN_CENTER

Bug
This is not working at the moment.

◆ texture

GUM_Texture* texture

Optional texture for rendering inside the widget.

Default value is nullptr

◆ font_size

uint8_t font_size

Font size of the widget's label.

Default value is 22

◆ font_r

uint8_t font_r

Red component of the font color.

Default value is 255

◆ font_g

uint8_t font_g

Green component of the font color.

Default value is 255

◆ font_b

uint8_t font_b

Blue component of the font color.

Default value is 255

◆ font_a

uint8_t font_a

Alpha component of the font color.

Default value is 255

◆ font_border_r

uint8_t font_border_r

Red component of the font border color.

Default value is 0

◆ font_border_g

uint8_t font_border_g

Green component of the font border color.

Default value is 0

◆ font_border_b

uint8_t font_border_b

Blue component of the font border color.

Default value is 0

◆ font_border_a

uint8_t font_border_a

Alpha component of the font border color.

Default value is 0

◆ font_border_thickness

uint8_t font_border_thickness

Width of the font border, in pixels.

Default value is 1

◆ z_index

uint8_t z_index

Z-index of the widget.

The higher the value, the higher the priority. Default value is 50