libui
A portable GUI library for C
|
A control that represents a top-level window.
A window contains exactly one child control that occupied the entire window.
#include <ui.h>
Public Member Functions | |
char * | uiWindowTitle (uiWindow *w) |
Returns the window title. | |
void | uiWindowSetTitle (uiWindow *w, const char *title) |
Sets the window title. | |
void | uiWindowPosition (uiWindow *w, int *x, int *y) |
Gets the window position. | |
void | uiWindowSetPosition (uiWindow *w, int x, int y) |
Moves the window to the specified position. | |
void | uiWindowOnPositionChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data) |
Registers a callback for when the window moved. | |
void | uiWindowContentSize (uiWindow *w, int *width, int *height) |
Gets the window content size. | |
void | uiWindowSetContentSize (uiWindow *w, int width, int height) |
Sets the window content size. | |
int | uiWindowFullscreen (uiWindow *w) |
Returns whether or not the window is full screen. | |
void | uiWindowSetFullscreen (uiWindow *w, int fullscreen) |
Sets whether or not the window is full screen. | |
void | uiWindowOnContentSizeChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data) |
Registers a callback for when the window content size is changed. | |
void | uiWindowOnClosing (uiWindow *w, int(*f)(uiWindow *sender, void *senderData), void *data) |
Registers a callback for when the window is to be closed. | |
void | uiWindowOnFocusChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data) |
Registers a callback for when the window focus changes. | |
int | uiWindowFocused (uiWindow *w) |
Returns whether or not the window is focused. | |
int | uiWindowBorderless (uiWindow *w) |
Returns whether or not the window is borderless. | |
void | uiWindowSetBorderless (uiWindow *w, int borderless) |
Sets whether or not the window is borderless. | |
void | uiWindowSetChild (uiWindow *w, uiControl *child) |
Sets the window's child. | |
int | uiWindowMargined (uiWindow *w) |
Returns whether or not the window has a margin. | |
void | uiWindowSetMargined (uiWindow *w, int margined) |
Sets whether or not the window has a margin. | |
int | uiWindowResizeable (uiWindow *w) |
Returns whether or not the window is user resizeable. | |
void | uiWindowSetResizeable (uiWindow *w, int resizeable) |
Sets whether or not the window is user resizeable. | |
![]() | |
void | uiControlDestroy (uiControl *c) |
Dispose and free all allocated resources. | |
uintptr_t | uiControlHandle (uiControl *c) |
Returns the control's OS-level handle. | |
uiControl * | uiControlParent (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 | |
uiWindow * | uiNewWindow (const char *title, int width, int height, int hasMenubar) |
Creates a new uiWindow. | |
![]() | |
uiControl * | uiAllocControl (size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr) |
Allocates a uiControl. | |
Additional Inherited Members | |
![]() | |
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 *) |
|
static |
int uiWindowBorderless | ( | uiWindow * | w | ) |
Returns whether or not the window is borderless.
w | uiWindow instance. |
TRUE
if window is borderless, FALSE
otherwise. [Default: TODO
] void uiWindowContentSize | ( | uiWindow * | w, |
int * | width, | ||
int * | height ) |
Gets the window content size.
w | uiWindow instance. | |
[out] | width | Window content width. |
[out] | height | Window content height. |
int uiWindowFocused | ( | uiWindow * | w | ) |
Returns whether or not the window is focused.
w | uiWindow instance. |
TRUE
if window is focused, FALSE
otherwise. int uiWindowFullscreen | ( | uiWindow * | w | ) |
Returns whether or not the window is full screen.
w | uiWindow instance. |
TRUE
if full screen, FALSE
otherwise. [Default: FALSE
] int uiWindowMargined | ( | uiWindow * | w | ) |
Returns whether or not the window has a margin.
w | uiWindow instance. |
TRUE
if window has a margin, FALSE
otherwise. [Default: FALSE
] Registers a callback for when the window is to be closed.
w | uiWindow instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.senderData User data registered with the sender instance.Return: TRUE to destroys the window.FALSE to abort closing and keep the window alive and visible. |
data | User data to be passed to the callback. |
void uiWindowOnContentSizeChanged | ( | uiWindow * | w, |
void(* | f )(uiWindow *sender, void *senderData), | ||
void * | data ) |
Registers a callback for when the window content size is changed.
w | uiWindow instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiWindowOnFocusChanged | ( | uiWindow * | w, |
void(* | f )(uiWindow *sender, void *senderData), | ||
void * | data ) |
Registers a callback for when the window focus changes.
w | uiWindow instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiWindowOnPositionChanged | ( | uiWindow * | w, |
void(* | f )(uiWindow *sender, void *senderData), | ||
void * | data ) |
Registers a callback for when the window moved.
w | uiWindow instance. |
f | Callback function.sender Back reference to the instance that triggered the callback.senderData User data registered with the sender instance. |
data | User data to be passed to the callback. |
void uiWindowPosition | ( | uiWindow * | w, |
int * | x, | ||
int * | y ) |
Gets the window position.
Coordinates are measured from the top left corner of the screen.
w | uiWindow instance. | |
[out] | x | X position of the window. |
[out] | y | Y position of the window. |
int uiWindowResizeable | ( | uiWindow * | w | ) |
Returns whether or not the window is user resizeable.
w | uiWindow instance. |
TRUE
if window is resizable, FALSE
otherwise. [Default: TRUE
] void uiWindowSetBorderless | ( | uiWindow * | w, |
int | borderless ) |
Sets whether or not the window is borderless.
w | uiWindow instance. |
borderless | TRUE to make window borderless, FALSE otherwise. |
Sets the window's child.
w | uiWindow instance. |
child | Control to be made child. |
void uiWindowSetContentSize | ( | uiWindow * | w, |
int | width, | ||
int | height ) |
Sets the window content size.
w | uiWindow instance. |
width | Window content width to set. |
height | Window content height to set. |
void uiWindowSetFullscreen | ( | uiWindow * | w, |
int | fullscreen ) |
Sets whether or not the window is full screen.
w | uiWindow instance. |
fullscreen | TRUE to make window full screen, FALSE otherwise. |
void uiWindowSetMargined | ( | uiWindow * | w, |
int | margined ) |
Sets whether or not the window has a margin.
The margin size is determined by the OS defaults.
w | uiWindow instance. |
margined | TRUE to set a window margin, FALSE otherwise. |
void uiWindowSetPosition | ( | uiWindow * | w, |
int | x, | ||
int | y ) |
Moves the window to the specified position.
Coordinates are measured from the top left corner of the screen.
w | uiWindow instance. |
x | New x position of the window. |
y | New y position of the window. |
void uiWindowSetResizeable | ( | uiWindow * | w, |
int | resizeable ) |
Sets whether or not the window is user resizeable.
w | uiWindow instance. |
resizeable | TRUE to make window resizable, FALSE otherwise. |
void uiWindowSetTitle | ( | uiWindow * | w, |
const char * | title ) |
Sets the window title.
w | uiWindow instance. |
title | Window title text. A valid, NUL terminated UTF-8 string.Data is copied internally. Ownership is not transferred. |
char * uiWindowTitle | ( | uiWindow * | w | ) |
Returns the window title.
w | uiWindow instance. |
NUL
terminated UTF-8 string.uiFreeText()
.