libui
A portable GUI library for C
Loading...
Searching...
No Matches
uiGrid Struct Reference

Description

A control container to arrange containing controls in a grid.

Contained controls are arranged on an imaginary grid of rows and columns. Controls can be placed anywhere on this grid, spanning multiple rows and/or columns.

Additionally placed controls can be programmed to expand horizontally and/or vertically, sharing the remaining space among other expanded controls.

Alignment options are available via uiAlign attributes to determine the controls placement within the reserved area, should the area be bigger than the control itself.

Controls can also be placed in relation to other controls using uiAt attributes.

#include <ui.h>

Public Member Functions

void uiGridAppend (uiGrid *g, uiControl *c, int left, int top, int xspan, int yspan, int hexpand, uiAlign halign, int vexpand, uiAlign valign)
 Appends a control to the grid.
 
void uiGridInsertAt (uiGrid *g, uiControl *c, uiControl *existing, uiAt at, int xspan, int yspan, int hexpand, uiAlign halign, int vexpand, uiAlign valign)
 Inserts a control positioned in relation to another control within the grid.
 
int uiGridPadded (uiGrid *g)
 Returns whether or not controls within the grid are padded.
 
void uiGridSetPadded (uiGrid *g, int padded)
 Sets whether or not controls within the grid are padded.
 
- Public Member Functions inherited from uiControl
void uiControlDestroy (uiControl *c)
 Dispose and free all allocated resources.
 
uintptr_t uiControlHandle (uiControl *c)
 Returns the control's OS-level handle.
 
uiControluiControlParent (uiControl *c)
 Returns the parent control.
 
void uiControlSetParent (uiControl *c, uiControl *parent)
 Sets the control's parent.
 
int uiControlToplevel (uiControl *c)
 Returns whether or not the control is a top level control.
 
int uiControlVisible (uiControl *c)
 Returns whether or not the control is visible.
 
void uiControlShow (uiControl *c)
 Shows the control.
 
void uiControlHide (uiControl *c)
 Hides the control.
 
int uiControlEnabled (uiControl *c)
 Returns whether or not the control is enabled.
 
void uiControlEnable (uiControl *c)
 Enables the control.
 
void uiControlDisable (uiControl *c)
 Disables the control.
 
void uiFreeControl (uiControl *c)
 Frees the memory associated with the control reference.
 
void uiControlVerifySetParent (uiControl *c, uiControl *parent)
 Makes sure the control's parent can be set to parent.
 
int uiControlEnabledToUser (uiControl *c)
 Returns whether or not the control can be interacted with by the user.
 
void uiControlSetTooltip (uiControl *c, const char *tooltip)
 Sets the control tooltip.
 

Static Public Member Functions

uiGriduiNewGrid (void)
 Creates a new grid.
 
- Static Public Member Functions inherited from uiControl
uiControluiAllocControl (size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
 Allocates a uiControl.
 

Additional Inherited Members

- Public Attributes inherited from uiControl
uint32_t Signature
 
uint32_t OSSignature
 
uint32_t TypeSignature
 
void(* Destroy )(uiControl *)
 
uintptr_t(* Handle )(uiControl *)
 
uiControl *(* Parent )(uiControl *)
 
void(* SetParent )(uiControl *, uiControl *)
 
int(* Toplevel )(uiControl *)
 
int(* Visible )(uiControl *)
 
void(* Show )(uiControl *)
 
void(* Hide )(uiControl *)
 
int(* Enabled )(uiControl *)
 
void(* Enable )(uiControl *)
 
void(* Disable )(uiControl *)
 

Member Function Documentation

◆ uiGridAppend()

void uiGridAppend ( uiGrid * g,
uiControl * c,
int left,
int top,
int xspan,
int yspan,
int hexpand,
uiAlign halign,
int vexpand,
uiAlign valign )

Appends a control to the grid.

Parameters
guiGrid instance.
cThe control to insert.
leftPlacement as number of columns from the left. Integer in range of [INT_MIN, INT_MAX].
topPlacement as number of rows from the top. Integer in range of [INT_MIN, INT_MAX].
xspanNumber of columns to span. Integer in range of [0, INT_MAX].
yspanNumber of rows to span. Integer in range of [0, INT_MAX].
hexpandTRUE to expand reserved area horizontally, FALSE otherwise.
halignHorizontal alignment of the control within the reserved space.
vexpandTRUE to expand reserved area vertically, FALSE otherwise.
valignVertical alignment of the control within the reserved space.

◆ uiGridInsertAt()

void uiGridInsertAt ( uiGrid * g,
uiControl * c,
uiControl * existing,
uiAt at,
int xspan,
int yspan,
int hexpand,
uiAlign halign,
int vexpand,
uiAlign valign )

Inserts a control positioned in relation to another control within the grid.

Parameters
guiGrid instance.
cThe control to insert.
existingThe existing control to position relatively to.
atPlacement specifier in relation to existing control.
xspanNumber of columns to span. Integer in range of [0, INT_MAX].
yspanNumber of rows to span. Integer in range of [0, INT_MAX].
hexpandTRUE to expand reserved area horizontally, FALSE otherwise.
halignHorizontal alignment of the control within the reserved space.
vexpandTRUE to expand reserved area vertically, FALSE otherwise.
valignVertical alignment of the control within the reserved space.

◆ uiGridPadded()

int uiGridPadded ( uiGrid * g)

Returns whether or not controls within the grid are padded.

Padding is defined as space between individual controls.

Parameters
guiGrid instance.
Returns
TRUE if controls are padded, FALSE otherwise. [Default: TODO]

◆ uiGridSetPadded()

void uiGridSetPadded ( uiGrid * g,
int padded )

Sets whether or not controls within the grid are padded.

Padding is defined as space between individual controls. The padding size is determined by the OS defaults.

Parameters
guiGrid instance.
paddedTRUE to make controls padded, FALSE otherwise.

◆ uiNewGrid()

uiGrid * uiNewGrid ( void )
static

Creates a new grid.

Returns
A new uiGrid instance.

The documentation for this struct was generated from the following file: