libui-ng
A portable GUI library for C
uiWindow Struct Reference

A control that represents a top-level window. More...

#include <ui.h>

Inheritance diagram for uiWindow:
uiControl

Public Member Functions

char * uiWindowTitle (uiWindow *w)
 Returns the window title. More...
 
void uiWindowSetTitle (uiWindow *w, const char *title)
 Sets the window title. More...
 
void uiWindowPosition (uiWindow *w, int *x, int *y)
 Gets the window position. More...
 
void uiWindowSetPosition (uiWindow *w, int x, int y)
 Moves the window to the specified position. More...
 
void uiWindowOnPositionChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data)
 Registers a callback for when the window moved. More...
 
void uiWindowContentSize (uiWindow *w, int *width, int *height)
 Gets the window content size. More...
 
void uiWindowSetContentSize (uiWindow *w, int width, int height)
 Sets the window content size. More...
 
int uiWindowFullscreen (uiWindow *w)
 Returns whether or not the window is full screen. More...
 
void uiWindowSetFullscreen (uiWindow *w, int fullscreen)
 Sets whether or not the window is full screen. More...
 
void uiWindowOnContentSizeChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data)
 Registers a callback for when the window content size is changed. More...
 
void uiWindowOnClosing (uiWindow *w, int(*f)(uiWindow *sender, void *senderData), void *data)
 Registers a callback for when the window is to be closed. More...
 
void uiWindowOnFocusChanged (uiWindow *w, void(*f)(uiWindow *sender, void *senderData), void *data)
 Registers a callback for when the window focus changes. More...
 
int uiWindowFocused (uiWindow *w)
 Returns whether or not the window is focused. More...
 
int uiWindowBorderless (uiWindow *w)
 Returns whether or not the window is borderless. More...
 
void uiWindowSetBorderless (uiWindow *w, int borderless)
 Sets whether or not the window is borderless. More...
 
void uiWindowSetChild (uiWindow *w, uiControl *child)
 Sets the window's child. More...
 
int uiWindowMargined (uiWindow *w)
 Returns whether or not the window has a margin. More...
 
void uiWindowSetMargined (uiWindow *w, int margined)
 Sets whether or not the window has a margin. More...
 
int uiWindowResizeable (uiWindow *w)
 Returns whether or not the window is user resizeable. More...
 
void uiWindowSetResizeable (uiWindow *w, int resizeable)
 Sets whether or not the window is user resizeable. More...
 
uiWindowuiNewWindow (const char *title, int width, int height, int hasMenubar)
 Creates a new uiWindow. More...
 
- Public Member Functions inherited from uiControl
void uiControlDestroy (uiControl *c)
 Dispose and free all allocated resources. More...
 
uintptr_t uiControlHandle (uiControl *c)
 Returns the control's OS-level handle. More...
 
uiControluiControlParent (uiControl *c)
 Returns the parent control. More...
 
void uiControlSetParent (uiControl *c, uiControl *parent)
 Sets the control's parent. More...
 
int uiControlToplevel (uiControl *c)
 Returns whether or not the control is a top level control. More...
 
int uiControlVisible (uiControl *c)
 Returns whether or not the control is visible. More...
 
void uiControlShow (uiControl *c)
 Shows the control. More...
 
void uiControlHide (uiControl *c)
 Hides the control. More...
 
int uiControlEnabled (uiControl *c)
 Returns whether or not the control is enabled. More...
 
void uiControlEnable (uiControl *c)
 Enables the control. More...
 
void uiControlDisable (uiControl *c)
 Disables the control. More...
 
uiControluiAllocControl (size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
 Allocates a uiControl. More...
 
void uiFreeControl (uiControl *c)
 Frees the memory associated with the control reference. More...
 
void uiControlVerifySetParent (uiControl *c, uiControl *parent)
 Makes sure the control's parent can be set to parent. More...
 
int uiControlEnabledToUser (uiControl *c)
 Returns whether or not the control can be interacted with by the user. More...
 

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 *)
 

Detailed Description

A control that represents a top-level window.

A window contains exactly one child control that occupied the entire window.

Note
Many of the uiWindow methods should be regarded as mere hints. The underlying system may override these or even choose to ignore them completely. This is especially true for many Unix systems.
Warning
A uiWindow can NOT be a child of another uiControl.

Member Function Documentation

◆ uiNewWindow()

uiWindow * uiNewWindow ( const char *  title,
int  width,
int  height,
int  hasMenubar 
)

Creates a new uiWindow.

Parameters
titleWindow title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
widthWindow width.
heightWindow height.
hasMenubarWhether or not the window should display a menu bar.
Returns
A new uiWindow instance.

◆ uiWindowBorderless()

int uiWindowBorderless ( uiWindow w)

Returns whether or not the window is borderless.

Parameters
wuiWindow instance.
Returns
TRUE if window is borderless, FALSE otherwise. [Default: TODO]

◆ uiWindowContentSize()

void uiWindowContentSize ( uiWindow w,
int *  width,
int *  height 
)

Gets the window content size.

Parameters
wuiWindow instance.
[out]widthWindow content width.
[out]heightWindow content height.
Note
The content size does NOT include window decorations like menus or title bars.

◆ uiWindowFocused()

int uiWindowFocused ( uiWindow w)

Returns whether or not the window is focused.

Parameters
wuiWindow instance.
Returns
TRUE if window is focused, FALSE otherwise.

◆ uiWindowFullscreen()

int uiWindowFullscreen ( uiWindow w)

Returns whether or not the window is full screen.

Parameters
wuiWindow instance.
Returns
TRUE if full screen, FALSE otherwise. [Default: FALSE]

◆ uiWindowMargined()

int uiWindowMargined ( uiWindow w)

Returns whether or not the window has a margin.

Parameters
wuiWindow instance.
Returns
TRUE if window has a margin, FALSE otherwise. [Default: FALSE]

◆ uiWindowOnClosing()

void uiWindowOnClosing ( uiWindow w,
int(*)(uiWindow *sender, void *senderData)  f,
void *  data 
)

Registers a callback for when the window is to be closed.

Parameters
wuiWindow instance.
fCallback 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.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.

◆ uiWindowOnContentSizeChanged()

void uiWindowOnContentSizeChanged ( uiWindow w,
void(*)(uiWindow *sender, void *senderData)  f,
void *  data 
)

Registers a callback for when the window content size is changed.

Parameters
wuiWindow instance.
fCallback function.
sender Back reference to the instance that triggered the callback.
senderData User data registered with the sender instance.
dataUser data to be passed to the callback.
Note
The callback is not triggered when calling uiWindowSetContentSize().
Only one callback can be registered at a time.

◆ uiWindowOnFocusChanged()

void uiWindowOnFocusChanged ( uiWindow w,
void(*)(uiWindow *sender, void *senderData)  f,
void *  data 
)

Registers a callback for when the window focus changes.

Parameters
wuiWindow instance.
fCallback function.
sender Back reference to the instance that triggered the callback.
senderData User data registered with the sender instance.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.

◆ uiWindowOnPositionChanged()

void uiWindowOnPositionChanged ( uiWindow w,
void(*)(uiWindow *sender, void *senderData)  f,
void *  data 
)

Registers a callback for when the window moved.

Parameters
wuiWindow instance.
fCallback function.
sender Back reference to the instance that triggered the callback.
senderData User data registered with the sender instance.
dataUser data to be passed to the callback.
Note
Only one callback can be registered at a time.
The callback is not triggered when calling uiWindowSetPosition().

◆ uiWindowPosition()

void uiWindowPosition ( uiWindow w,
int *  x,
int *  y 
)

Gets the window position.

Coordinates are measured from the top left corner of the screen.

Parameters
wuiWindow instance.
[out]xX position of the window.
[out]yY position of the window.
Note
This method may return inaccurate or dummy values on Unix platforms.

◆ uiWindowResizeable()

int uiWindowResizeable ( uiWindow w)

Returns whether or not the window is user resizeable.

Parameters
wuiWindow instance.
Returns
TRUE if window is resizable, FALSE otherwise. [Default: TRUE]

◆ uiWindowSetBorderless()

void uiWindowSetBorderless ( uiWindow w,
int  borderless 
)

Sets whether or not the window is borderless.

Parameters
wuiWindow instance.
borderlessTRUE to make window borderless, FALSE otherwise.
Note
This method is merely a hint and may be ignored by the system.

◆ uiWindowSetChild()

void uiWindowSetChild ( uiWindow w,
uiControl child 
)

Sets the window's child.

Parameters
wuiWindow instance.
childControl to be made child.

◆ uiWindowSetContentSize()

void uiWindowSetContentSize ( uiWindow w,
int  width,
int  height 
)

Sets the window content size.

Parameters
wuiWindow instance.
widthWindow content width to set.
heightWindow content height to set.
Note
The content size does NOT include window decorations like menus or title bars.
This method is merely a hint and may be ignored by the system.

◆ uiWindowSetFullscreen()

void uiWindowSetFullscreen ( uiWindow w,
int  fullscreen 
)

Sets whether or not the window is full screen.

Parameters
wuiWindow instance.
fullscreenTRUE to make window full screen, FALSE otherwise.
Note
This method is merely a hint and may be ignored by the system.

◆ uiWindowSetMargined()

void uiWindowSetMargined ( uiWindow w,
int  margined 
)

Sets whether or not the window has a margin.

The margin size is determined by the OS defaults.

Parameters
wuiWindow instance.
marginedTRUE to set a window margin, FALSE otherwise.

◆ uiWindowSetPosition()

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.

Parameters
wuiWindow instance.
xNew x position of the window.
yNew y position of the window.
Note
This method is merely a hint and may be ignored on Unix platforms.

◆ uiWindowSetResizeable()

void uiWindowSetResizeable ( uiWindow w,
int  resizeable 
)

Sets whether or not the window is user resizeable.

Parameters
wuiWindow instance.
resizeableTRUE to make window resizable, FALSE otherwise.
Note
This method is merely a hint and may be ignored by the system.

◆ uiWindowSetTitle()

void uiWindowSetTitle ( uiWindow w,
const char *  title 
)

Sets the window title.

Parameters
wuiWindow instance.
titleWindow title text.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
Note
This method is merely a hint and may be ignored on unix platforms.

◆ uiWindowTitle()

char * uiWindowTitle ( uiWindow w)

Returns the window title.

Parameters
wuiWindow instance.
Returns
The window title text.
A NUL terminated UTF-8 string.
Caller is responsible for freeing the data with uiFreeText().

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