TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
GUI Management API

Create and manage menu screens, widgets and input callbacks. More...

Functions

void GfuiDisplayNothing (void)
 GLUT display callback that performs no drawing or buffer swap.
void GfuiIdle (void)
 Process held-mouse-button repeat actions on the active screen.
void GfuiDisplay (void)
 Draw the active GUI screen and swap the GLUT buffers.
void GfuiMouseHide (void)
 Disallow the software mouse cursor on the active screen.
void GfuiMouseShow (void)
 Allow the software mouse cursor on the active screen.
tMouseInfo * GfuiMouseInfo (void)
 Get the GUI's current mouse state.
void GfuiMouseSetPos (int x, int y)
 Set the mouse position.
int GfuiScreenIsActive (void *screen)
 Tell if the screen is active or not.
void GfuiScreenActivate (void *screen)
 Activate a screen and make it current.
void GfuiScreenReplace (void *screen)
 Activate a screen and make it current plus release the current screen.
void GfuiScreenDeactivate (void)
 Deactivate the current screen.
void * GfuiScreenCreate (void)
 Create a new screen.
void * GfuiScreenCreateExAction (float *bgColor, const tGfuiAction &onActivate, const tGfuiAction &onDeactivate, int mouseAllowed)
 Create a screen.
void GfuiScreenRelease (void *scr)
 Release the given screen.
void * GfuiHookCreateAction (const tGfuiAction &onActivate)
 Create a callback hook.
void GfuiHookRelease (void *hook)
 Release the given hook.
void GfuiAddKeyAction (void *scr, unsigned char key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Keyboard callback to a screen.
void GfuiRegisterKeyAction (unsigned char key, char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Keyboard callback to the current screen.
void GfuiAddSKeyAction (void *scr, int key, const char *descr, const tGfuiAction &onKeyPressed, const tGfuiAction &onKeyReleased)
 Add a Special Keyboard shortcut to the screen.
void GfuiScreenAddBgImg (void *scr, const char *filename)
 Add an image background to a screen.
int GfuiGrButtonCreateAction (void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed, int x, int y, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
 Add a graphical button to a screen.
int GfuiButtonStateCreate (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Add a state button to a screen.
int GfuiButtonCreateAction (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
 Add a button to a screen.
void GfuiButtonSetText (void *scr, int id, const char *text)
 Change the label of a button.
int GfuiButtonGetFocused (void)
 Get the Id of the button focused in the current screen.
int GfuiEditboxCreateAction (void *scr, const char *text, int font, int x, int y, int width, int maxlen, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost, int margin)
 Add an edit box to a screen.
int GfuiEditboxGetFocused (void)
 Get the Id of the editbox focused in the current screen.
char * GfuiEditboxGetString (void *scr, int id)
 Get the current text of an edit box.
void GfuiEditboxSetString (void *scr, int id, const char *text)
 Set a new string.
void GfuiHelpScreen (void *prevScreen)
 Generate a help screen.
int GfuiStaticImageCreate (void *scr, int x, int y, int w, int h, char *name)
 Create a new static image.
void GfuiStaticImageSet (void *scr, int id, char *name)
 Replace an image by another one.
int GfuiLabelCreateEx (void *scr, const char *text, float *fgColor, int font, int x, int y, int align, int maxlen)
 Create a new label (extended version).
int GfuiLabelCreate (void *scr, const char *text, int font, int x, int y, int align, int maxlen)
 Add a label to a screen.
int GfuiTipCreate (void *scr, const char *text, int maxlen)
 Add a Tip (generally associated with a button).
int GfuiTitleCreate (void *scr, const char *text, int maxlen)
 Add a Title to the screen.
void GfuiLabelSetText (void *scr, int id, const char *text)
 Change the text of a label.
void GfuiLabelSetColor (void *scr, int id, float *color)
 Change the color of a label.
void GfuiMenuDefaultKeysAdd (void *scr)
 Add the default menu keyboard callback to a screen.
void * GfuiMenuScreenCreate (const char *title)
 Create a new menu screen.
int GfuiMenuButtonCreateActionWithDisabledTip (void *scr, const char *text, const char *tip, const char *disabledTip, const tGfuiAction &onpush)
 Add a button to a menu screen.
int GfuiMenuBackQuitButtonCreateAction (void *scr, const char *text, const char *tip, const tGfuiAction &onpush)
 Add the "Back" or "Quit" button at the bottom of the menu screen.
void GfuiUnSelectCurrent (void)
 Remove focus from the active screen's current widget.
int GfuiVisibilitySet (void *scr, int id, int visible)
 Set/unset the visibility attribute of an object.
int GfuiEnable (void *scr, int id, int flag)
 Enable / Disable an object.
int GfuiScrollBarCreate (void *scr, int x, int y, int align, int width, int orientation, int min, int max, int len, int start, void *userData, tfuiSBCallback onScroll)
 Create a new scroll bar.
int GfuiScrollBarPosGet (void *scr, int id)
 Get the current position of a scroll bar.
void GfuiScrollBarPosSet (void *scr, int id, int min, int max, int len, int start)
 Set new values for position.
int GfuiScrollListCreateAction (void *scr, int font, int x, int y, int align, int width, int height, int scrollBarPos, const tGfuiAction &onSelect)
 Create a new scroll list.
char * GfuiScrollListGetSelectedElement (void *scr, int Id, void **userData)
 Get the selected element from the scroll list.
char * GfuiScrollListGetElement (void *scr, int Id, int index, void **userData)
 Get the specified element from the scroll list.
char * GfuiScrollListExtractSelectedElement (void *scr, int Id, void **userData)
 Extract the selected element from the scroll list (removed).
char * GfuiScrollListExtractElement (void *scr, int Id, int index, void **userData)
 Extract the specified element from the scroll list.
int GfuiScrollListInsertElement (void *scr, int Id, char *element, int index, void *userData)
 Insert an element in a scroll list.
int GfuiScrollListMoveSelectedElement (void *scr, int Id, int delta)
 Move the selected element within the scroll list.
void * GfuiScreenCreateEx (float *bgColor, void *userDataOnActivate, tfuiCallback onActivate, void *userDataOnDeactivate, tfuiCallback onDeactivate, int mouseAllowed)
 Create a screen using callbacks with caller-supplied data.
void * GfuiHookCreate (void *userDataOnActivate, tfuiCallback onActivate)
 Create a callback-only screen hook.
void GfuiAddKey (void *scr, unsigned char key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind an ordinary key on a screen using callbacks with caller-supplied data.
void GfuiRegisterKey (unsigned char key, char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind an ordinary key on the currently active screen.
void GfuiAddSKey (void *scr, int key, const char *descr, void *userData, tfuiCallback onKeyPressed, tfuiCallback onKeyReleased)
 Bind a GLUT special key, such as an arrow or function key, on a screen.
void GfuiKeyEventRegister (void *scr, tfuiKeyCallback onKeyAction)
 Set the ordinary-key event interceptor for a screen.
void GfuiSKeyEventRegister (void *scr, tfuiSKeyCallback onSKeyAction)
 Set the special-key event interceptor for a screen.
void GfuiKeyEventRegisterCurrent (tfuiKeyCallback onKeyAction)
 Set the ordinary-key interceptor on the currently active screen.
void GfuiSKeyEventRegisterCurrent (tfuiSKeyCallback onSKeyAction)
 Set the special-key interceptor on the currently active screen.
void GfuiPrintString (const char *text, float *fgColor, int font, int x, int y, int align)
 Draw text immediately in the current OpenGL context without creating a widget.
int GfuiFontHeight (int font)
 Get the height of an initialized GUI font.
int GfuiFontWidth (int font, const char *text)
 Measure text using an initialized GUI font.
int GfuiButtonCreate (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Create a text button using callbacks with caller-supplied data.
int GfuiLeanButtonCreateAction (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
 Create a text button without horizontal margins.
int GfuiLeanButtonCreate (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Create a marginless text button using callbacks with caller-supplied data.
int GfuiButtonStateCreateAction (void *scr, const char *text, int font, int x, int y, int width, int align, int mouse, const tGfuiAction &onPush, const tGfuiAction &onFocus, const tGfuiAction &onFocusLost)
 Create a text button that toggles between pressed and released while focused.
int GfuiGrButtonCreate (void *scr, const char *disabled, const char *enabled, const char *focused, const char *pushed, int x, int y, int align, int mouse, void *userDataOnPush, tfuiCallback onPush, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost)
 Create an image button using callbacks with caller-supplied data.
int GfuiEditboxCreate (void *scr, const char *text, int font, int x, int y, int width, int maxlen, void *userDataOnFocus, tfuiCallback onFocus, tfuiCallback onFocusLost, int margin=10)
 Create an edit box using callbacks with caller-supplied data.
int GfuiScrollListCreate (void *scr, int font, int x, int y, int align, int width, int height, int scrollbar, void *userDataOnSelect, tfuiCallback onSelect)
 Create a scrolling list using a callback with caller-supplied data.
int GfuiMenuButtonCreateAction (void *menu, const char *text, const char *tip, const tGfuiAction &onpush)
 Add a menu button with a focus tip.
int GfuiMenuButtonCreate (void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
 Add a menu button using a callback with caller-supplied data.
int GfuiMenuBackQuitButtonCreate (void *menu, const char *text, const char *tip, void *userdata, tfuiCallback onpush)
 Add the bottom Back/Quit menu button using a callback with caller-supplied data.

Detailed Description

Create and manage menu screens, widgets and input callbacks.

Include tgfclient.h and use the API after the GUI/fonts and OpenGL context have been initialized, on the GUI event thread.

Screens and widgets
Create a screen with GfuiScreenCreate, GfuiScreenCreateExAction or GfuiMenuScreenCreate, add widgets, then call GfuiScreenActivate. Widget identifiers are local to their owning screen. Release a screen and its widgets with GfuiScreenRelease; GfuiScreenDeactivate only stops its use. GfuiScreenReplace releases the old screen before activating a different one. Callback-only hooks use GfuiHookCreateAction and GfuiHookRelease. Unless a function explicitly documents otherwise, pass a valid, non-NULL screen handle and identifiers of the required widget type. Functions that operate on the current screen require an active screen.
Coordinates and text
Screens use a 640 by 480 logical coordinate system, scaled to the viewport, with the origin at the lower-left corner. GfuiMouseSetPos is an exception: it accepts GLUT window pixels with a top-left origin. Alignment support is widget-specific; text labels/buttons use horizontal alignment only. Text capacities are byte counts excluding the terminating NUL, not Unicode character counts. Label/edit-box text is copied; scroll-list element names and associated data are borrowed from the caller.
Callbacks and ownership
The Action variants copy a tGfuiAction (std::function), allowing lambdas. The callback variants store a function pointer and caller-supplied data. Captured references and borrowed data must remain valid while callbacks can run. Empty actions and NULL callbacks do nothing; they do not automatically disable widgets. Use GfuiEnable with GFUI_DISABLE for that. Releasing a screen destroys its stored actions, but does not free raw user data pointers. Callbacks run synchronously during GUI event processing.
Parameter directions
Input values and borrowed pointers are marked [in]. A screen whose contents are modified is marked [in,out]. Output pointers, such as a scroll-list lookup's userData argument, are marked [out] and are written only on success. These markers do not transfer memory ownership.

Function Documentation

◆ GfuiAddKey()

void GfuiAddKey ( void * scr,
unsigned char key,
const char * descr,
void * userData,
tfuiCallback onKeyPressed,
tfuiCallback onKeyReleased )
extern

Bind an ordinary key on a screen using callbacks with caller-supplied data.

Parameters
[in,out]scrScreen handle whose key bindings are updated.
[in]keyCharacter key code.
[in]descrDescription displayed on the help screen.
[in]userDataData passed to both callbacks.
[in]onKeyPressedCallback on key press, or NULL.
[in]onKeyReleasedCallback on key release, or NULL.
See also
GfuiAddKeyAction

Definition at line 859 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiAddKeyAction()

void GfuiAddKeyAction ( void * scr,
unsigned char key,
const char * descr,
const tGfuiAction & onKeyPressed,
const tGfuiAction & onKeyReleased )

Add a Keyboard callback to a screen.

Parameters
[in,out]scrScreen receiving the binding.
[in]keyOrdinary character key code (not a GLUT special key).
[in]descrHelp-screen description, copied; NULL means empty text.
[in]onKeyPressedAction on key press; may be empty.
[in]onKeyReleasedAction on key release; may be empty.
Note
Adds a binding, rather than replacing an existing binding for the key.

Definition at line 809 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiAddSKey()

void GfuiAddSKey ( void * scr,
int key,
const char * descr,
void * userData,
tfuiCallback onKeyPressed,
tfuiCallback onKeyReleased )
extern

Bind a GLUT special key, such as an arrow or function key, on a screen.

Parameters
[in,out]scrScreen handle whose key bindings are updated.
[in]keyGLUT special-key code.
[in]descrDescription displayed on the help screen.
[in]userDataData passed to both callbacks.
[in]onKeyPressedCallback on key press, or NULL.
[in]onKeyReleasedCallback on key release, or NULL.
See also
GfuiAddSKeyAction

Definition at line 989 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiAddSKeyAction()

void GfuiAddSKeyAction ( void * scr,
int key,
const char * descr,
const tGfuiAction & onKeyPressed,
const tGfuiAction & onKeyReleased )

Add a Special Keyboard shortcut to the screen.

(see glut for normal and special keys)

Parameters
[in,out]scrScreen receiving the binding.
[in]keyGLUT special-key code, such as GLUT_KEY_UP or GLUT_KEY_F1.
[in]descrHelp-screen description, copied; NULL means empty text.
[in]onKeyPressedAction on key press; may be empty.
[in]onKeyReleasedAction on key release; may be empty.
Note
Adds a binding, rather than replacing an existing binding for the key.

Definition at line 895 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiButtonCreate()

int GfuiButtonCreate ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
void * userDataOnPush,
tfuiCallback onPush,
void * userDataOnFocus,
tfuiCallback onFocus,
tfuiCallback onFocusLost )
extern

Create a text button using callbacks with caller-supplied data.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Parameters
[in]userDataOnPushData passed to onPush.
[in]userDataOnFocusData passed to onFocus and onFocusLost.

Definition at line 310 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiButtonCreateAction()

int GfuiButtonCreateAction ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
const tGfuiAction & onPush,
const tGfuiAction & onFocus,
const tGfuiAction & onFocusLost )

Add a button to a screen.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.

Definition at line 228 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiButtonGetFocused()

int GfuiButtonGetFocused ( void )

Get the Id of the button focused in the current screen.

Returns
Focused text-button identifier, or -1 if there is no active screen or no focused text button. Graphical buttons are not included.

Definition at line 386 of file guibutton.cpp.

◆ GfuiButtonSetText()

void GfuiButtonSetText ( void * scr,
int id,
const char * text )

Change the label of a button.

Parameters
[in,out]scrScreen containing the text button.
[in]idText-button identifier; graphical buttons are not supported.
[in]textNew label, copied and truncated to 99 bytes; NULL leaves it unchanged.
Note
The button's clickable bounds are preserved. Unknown identifiers and non-text-button widgets are ignored.

Definition at line 356 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiButtonStateCreate()

int GfuiButtonStateCreate ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
void * userDataOnPush,
tfuiCallback onPush,
void * userDataOnFocus,
tfuiCallback onFocus,
tfuiCallback onFocusLost )

Add a state button to a screen.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Note
Starts released. Activation toggles its state; onPush is called only when changing to pressed, not when toggling back to released. Losing focus resets the button to released without invoking onPush.
Parameters
[in]userDataOnPushBorrowed data passed to onPush.
[in]userDataOnFocusBorrowed data passed to onFocus and onFocusLost.

Definition at line 170 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiButtonStateCreateAction()

int GfuiButtonStateCreateAction ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
const tGfuiAction & onPush,
const tGfuiAction & onFocus,
const tGfuiAction & onFocusLost )
extern

Create a text button that toggles between pressed and released while focused.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Note
Starts released. Activation toggles its state; onPush is called only when changing to pressed, not when toggling back to released. Losing focus resets the button to released without invoking onPush.

Definition at line 180 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiDisplay()

void GfuiDisplay ( void )

Draw the active GUI screen and swap the GLUT buffers.

Draws the background, widgets and software cursor. Installed as the display callback by GfuiScreenActivate for normal screens. Changes OpenGL state and matrices; requires an active normal screen and a current rendering context.

Definition at line 175 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiDisplayNothing()

void GfuiDisplayNothing ( void )

GLUT display callback that performs no drawing or buffer swap.

Install this when redisplay events should not render a GUI screen.

Definition at line 142 of file gui.cpp.

◆ GfuiEditboxCreate()

int GfuiEditboxCreate ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int maxlen,
void * userDataOnFocus,
tfuiCallback onFocus,
tfuiCallback onFocusLost,
int margin = 10 )
extern

Create an edit box using callbacks with caller-supplied data.

Parameters
[in,out]scrScreen receiving the edit box
[in]textInitial text, copied and truncated to maxlen bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width; zero reserves the width of maxlen 'W' glyphs
[in]maxlenCapacity in bytes excluding NUL; zero uses strlen(text)
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
[in]marginHorizontal margin on each side in GUI units (default 10)
Returns
Editbox Id
-1 Error
Parameters
[in]userDataOnFocusData passed to onFocus and onFocusLost.

Definition at line 127 of file guiedit.cpp.

Here is the call graph for this function:

◆ GfuiEditboxCreateAction()

int GfuiEditboxCreateAction ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int maxlen,
const tGfuiAction & onFocus,
const tGfuiAction & onFocusLost,
int margin )

Add an edit box to a screen.

Parameters
[in,out]scrScreen receiving the edit box
[in]textInitial text, copied and truncated to maxlen bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width; zero reserves the width of maxlen 'W' glyphs
[in]maxlenCapacity in bytes excluding NUL; zero uses strlen(text)
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
[in]marginHorizontal margin on each side in GUI units (default 10)
Returns
Editbox Id
-1 Error

Definition at line 53 of file guiedit.cpp.

Here is the call graph for this function:

◆ GfuiEditboxGetFocused()

int GfuiEditboxGetFocused ( void )

Get the Id of the editbox focused in the current screen.

Returns
Editbox Id
-1 if no editbox or no screen or the focus is not on a editbox

Definition at line 142 of file guiedit.cpp.

◆ GfuiEditboxGetString()

char * GfuiEditboxGetString ( void * scr,
int id )

Get the current text of an edit box.

Parameters
[in]scrScreen containing the edit box.
[in]idEdit-box identifier.
Returns
Borrowed pointer to the widget's text buffer, or NULL for an unknown identifier or wrong widget type. Do not free it; use GfuiEditboxSetString to change the text. The buffer is invalid after screen release.

Definition at line 364 of file guiedit.cpp.

Here is the call graph for this function:

◆ GfuiEditboxSetString()

void GfuiEditboxSetString ( void * scr,
int id,
const char * text )

Set a new string.

Parameters
[in,out]scrScreen containing the edit box.
[in]idEdit-box identifier.
[in]textNon-NULL text, copied and truncated to the capacity set at creation.
Note
Unknown identifiers and non-edit-box widgets are ignored. This setter does not invoke focus callbacks or reposition the editing cursor.

Definition at line 390 of file guiedit.cpp.

Here is the call graph for this function:

◆ GfuiEnable()

int GfuiEnable ( void * scr,
int id,
int flag )

Enable / Disable an object.

Parameters
[in,out]scrScreen containing the widget.
[in]idWidget identifier.
[in]flagGFUI_ENABLE or GFUI_DISABLE (use the constants, not a boolean).
Returns
0 on success, -1 for an unknown identifier or invalid flag.

Definition at line 415 of file guiobject.cpp.

Here is the call graph for this function:

◆ GfuiFontHeight()

int GfuiFontHeight ( int font)
extern

Get the height of an initialized GUI font.

Parameters
[in]fontGFUI_FONT_* identifier.
Returns
Font height in GUI coordinate units.

Definition at line 65 of file guiobject.cpp.

◆ GfuiFontWidth()

int GfuiFontWidth ( int font,
const char * text )
extern

Measure text using an initialized GUI font.

Parameters
[in]fontGFUI_FONT_* identifier.
[in]textText to measure.
Returns
Text width in GUI coordinate units.

Definition at line 70 of file guiobject.cpp.

◆ GfuiGrButtonCreate()

int GfuiGrButtonCreate ( void * scr,
const char * disabled,
const char * enabled,
const char * focused,
const char * pushed,
int x,
int y,
int align,
int mouse,
void * userDataOnPush,
tfuiCallback onPush,
void * userDataOnFocus,
tfuiCallback onFocus,
tfuiCallback onFocusLost )
extern

Create an image button using callbacks with caller-supplied data.

Supply four loadable PNGs of identical dimensions. Their pixel dimensions determine the button size in GUI units; images are loaded during creation.

Parameters
[in,out]scrScreen receiving the button
[in]disabledfilename of the image when the button is disabled
[in]enabledfilename of the image when the button is enabled
[in]focusedfilename of the image when the button is focused
[in]pushedfilename of the image when the button is pushed
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]alignGFUI_ALIGN_* horizontal and vertical anchor alignment.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Parameters
[in]userDataOnPushData passed to onPush.
[in]userDataOnFocusData passed to onFocus and onFocusLost.

Definition at line 153 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiGrButtonCreateAction()

int GfuiGrButtonCreateAction ( void * scr,
const char * disabled,
const char * enabled,
const char * focused,
const char * pushed,
int x,
int y,
int align,
int mouse,
const tGfuiAction & onPush,
const tGfuiAction & onFocus,
const tGfuiAction & onFocusLost )

Add a graphical button to a screen.

Supply four loadable PNGs of identical dimensions. Their pixel dimensions determine the button size in GUI units; images are loaded during creation.

Parameters
[in,out]scrScreen receiving the button
[in]disabledfilename of the image when the button is disabled
[in]enabledfilename of the image when the button is enabled
[in]focusedfilename of the image when the button is focused
[in]pushedfilename of the image when the button is pushed
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]alignGFUI_ALIGN_* horizontal and vertical anchor alignment.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.

Definition at line 58 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiHelpScreen()

void GfuiHelpScreen ( void * prevScreen)

Generate a help screen.

Parameters
[in,out]prevScreenScreen whose key bindings are displayed and which is reactivated by Back or Escape; keep it alive while help is shown.
Note
Creates and activates a help screen, deactivating the previous screen.

Definition at line 47 of file guihelp.cpp.

Here is the call graph for this function:

◆ GfuiHookCreate()

void * GfuiHookCreate ( void * userDataOnActivate,
tfuiCallback onActivate )
extern

Create a callback-only screen hook.

Parameters
[in]userDataOnActivateData passed to onActivate.
[in]onActivateCallback invoked when the hook is activated, or NULL.
Returns
Hook handle, to be released with GfuiHookRelease.
See also
GfuiHookCreateAction

Definition at line 748 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiHookCreateAction()

void * GfuiHookCreateAction ( const tGfuiAction & onActivate)

Create a callback hook.

Parameters
[in]onActivateAction called by GfuiScreenActivate; may be empty.
Returns
Callback-only hook handle; release it with GfuiHookRelease.
Note
A hook runs an activation action without drawing a menu or containing widgets.

Definition at line 736 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiHookRelease()

void GfuiHookRelease ( void * hook)

Release the given hook.

Parameters
[in,out]hookInactive callback hook to destroy; invalid after this call.
Precondition
Deactivate the hook or activate another screen first. Unlike GfuiScreenRelease, this function does not deactivate the current screen.

Definition at line 760 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiIdle()

void GfuiIdle ( void )

Process held-mouse-button repeat actions on the active screen.

Suitable as a GLUT idle callback. GfuiScreenActivate clears the idle callback; install this explicitly if repetition is wanted. Requires an active screen.

Definition at line 152 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiKeyEventRegister()

void GfuiKeyEventRegister ( void * scr,
tfuiKeyCallback onKeyAction )
extern

Set the ordinary-key event interceptor for a screen.

Parameters
[in,out]scrScreen handle whose event interceptor is updated.
[in]onKeyActionCallback receiving the key, GLUT modifiers and GFUI_KEY_DOWN or GFUI_KEY_UP; NULL removes the interceptor. Return nonzero to consume the event before normal key handling.

Definition at line 769 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiKeyEventRegisterCurrent()

void GfuiKeyEventRegisterCurrent ( tfuiKeyCallback onKeyAction)
extern

Set the ordinary-key interceptor on the currently active screen.

Parameters
[in]onKeyActionEvent callback, or NULL to remove it; see GfuiKeyEventRegister.

Definition at line 786 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiLabelCreate()

int GfuiLabelCreate ( void * scr,
const char * text,
int font,
int x,
int y,
int align,
int maxlen )

Add a label to a screen.

Uses the default label color.

Parameters
[in,out]scrScreen receiving the label.
[in]textInitial text, copied and truncated to maxlen bytes.
[in]fontGFUI_FONT_* identifier.
[in]xHorizontal anchor in GUI coordinates.
[in]yBottom of the label in GUI coordinates.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored.
[in]maxlenText capacity in bytes excluding NUL; zero uses strlen(text).
Returns
Label identifier, local to scr.
See also
GfuiLabelCreateEx, GfuiLabelSetText

Definition at line 121 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiLabelCreateEx()

int GfuiLabelCreateEx ( void * scr,
const char * text,
float * fgColor,
int font,
int x,
int y,
int align,
int maxlen )

Create a new label (extended version).

Parameters
[in,out]scrScreen receiving the label.
[in]textInitial text, copied and truncated to maxlen bytes.
[in]fgColorFour RGBA floats, copied into the label.
[in]fontGFUI_FONT_* identifier.
[in]xHorizontal anchor in GUI coordinates.
[in]yBottom of the label in GUI coordinates.
[in]alignGFUI_ALIGN_HL_VB, GFUI_ALIGN_HC_VB or GFUI_ALIGN_HR_VB for left, centered or right alignment. Vertical alignment bits are ignored.
[in]maxlenText capacity in bytes excluding NUL; zero uses strlen(text).
Returns
Label identifier, local to scr.
See also
GfuiLabelSetText, GfuiLabelSetColor

Definition at line 51 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiLabelSetColor()

void GfuiLabelSetColor ( void * scr,
int id,
float * color )

Change the color of a label.

Parameters
[in,out]scrScreen containing the label.
[in]idLabel identifier.
[in]colorFour RGBA floats, copied into the label.
Note
Unknown identifiers and non-label widgets are ignored.
See also
GfuiLabelCreateEx

Definition at line 221 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiLabelSetText()

void GfuiLabelSetText ( void * scr,
int id,
const char * text )

Change the text of a label.

Parameters
[in,out]scrScreen containing the label.
[in]idLabel identifier.
[in]textNew text, copied and truncated to the capacity set at creation; NULL leaves the label unchanged.
Note
Unknown identifiers and non-label widgets are ignored.
See also
GfuiLabelCreate, GfuiLabelCreateEx

Definition at line 193 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiLeanButtonCreate()

int GfuiLeanButtonCreate ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
void * userDataOnPush,
tfuiCallback onPush,
void * userDataOnFocus,
tfuiCallback onFocus,
tfuiCallback onFocusLost )
extern

Create a marginless text button using callbacks with caller-supplied data.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Note
Unlike a standard button, this variant removes both horizontal margins and uses the focused background color even when enabled but unfocused.
Parameters
[in]userDataOnPushData passed to onPush.
[in]userDataOnFocusData passed to onFocus and onFocusLost.

Definition at line 320 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiLeanButtonCreateAction()

int GfuiLeanButtonCreateAction ( void * scr,
const char * text,
int font,
int x,
int y,
int width,
int align,
int mouse,
const tGfuiAction & onPush,
const tGfuiAction & onFocus,
const tGfuiAction & onFocusLost )
extern

Create a text button without horizontal margins.

Parameters
[in,out]scrScreen receiving the button
[in]textButton label, copied with a maximum of 99 bytes
[in]fontFont id
[in]xX position on screen
[in]yY position on screen (0 = bottom)
[in]widthContent width in GUI units; zero measures the initial text. Standard buttons add a 10-unit margin on each side.
[in]alignHorizontal GFUI_ALIGN_* alignment; vertical bits are ignored and y always specifies the bottom of the button.
[in]mouseGFUI_MOUSE_UP for release or GFUI_MOUSE_DOWN for press. The right mouse button only changes focus; it does not activate widgets.
[in]onPushPush callback function
[in]onFocusFocus callback function
[in]onFocusLostFocus Lost callback function
Returns
Button identifier, local to scr.
Note
Unlike a standard button, this variant removes both horizontal margins and uses the focused background color even when enabled but unfocused.

Definition at line 329 of file guibutton.cpp.

Here is the call graph for this function:

◆ GfuiMenuBackQuitButtonCreate()

int GfuiMenuBackQuitButtonCreate ( void * menu,
const char * text,
const char * tip,
void * userdata,
tfuiCallback onpush )
extern

Add the bottom Back/Quit menu button using a callback with caller-supplied data.

Parameters
[in,out]menuMenu screen handle receiving the button.
[in]textButton label.
[in]tipFocus tip, or NULL for no text.
[in]userdataData passed to onpush.
[in]onpushCallback on button activation or Escape, or NULL for no action.
Returns
Button identifier.
Note
The callback must implement navigation or quitting; the button's label does not supply that behavior. Use GfuiEnable to disable the button.
See also
GfuiMenuBackQuitButtonCreateAction

Definition at line 219 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuBackQuitButtonCreateAction()

int GfuiMenuBackQuitButtonCreateAction ( void * scr,
const char * text,
const char * tip,
const tGfuiAction & onpush )

Add the "Back" or "Quit" button at the bottom of the menu screen.

Parameters
[in,out]scrMenu screen receiving the button and Escape binding.
[in]textButton label, copied.
[in]tipFocus tip and Escape help text, copied; NULL means empty text.
[in]onpushAction on button activation or Escape; may be empty.
Returns
Button identifier, local to scr.
Note
The action must implement navigation or quitting; the label alone does not supply either behavior.

Definition at line 187 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuButtonCreate()

int GfuiMenuButtonCreate ( void * menu,
const char * text,
const char * tip,
void * userdata,
tfuiCallback onpush )
extern

Add a menu button using a callback with caller-supplied data.

Parameters
[in,out]menuMenu screen handle receiving the button.
[in]textButton label.
[in]tipFocus tip, or NULL for no text.
[in]userdataData passed to onpush.
[in]onpushCallback on button activation, or NULL for no action.
Returns
Button identifier, or -1 when automatic menu slots are exhausted.
Note
Use GfuiEnable to disable the button explicitly.
See also
GfuiMenuButtonCreateAction

Definition at line 171 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuButtonCreateAction()

int GfuiMenuButtonCreateAction ( void * menu,
const char * text,
const char * tip,
const tGfuiAction & onpush )
extern

Add a menu button with a focus tip.

Parameters
[in,out]menuMenu screen handle receiving the button.
[in]textButton label.
[in]tipFocus tip, or NULL for no text.
[in]onpushAction on button activation; an empty action does nothing.
Returns
Button identifier, or -1 when automatic menu slots are exhausted.
Note
Use GfuiEnable to disable the button explicitly.
See also
GfuiMenuButtonCreateActionWithDisabledTip

Definition at line 165 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuButtonCreateActionWithDisabledTip()

int GfuiMenuButtonCreateActionWithDisabledTip ( void * scr,
const char * text,
const char * tip,
const char * disabledTip,
const tGfuiAction & onpush )

Add a button to a menu screen.

Parameters
[in,out]scrMenu screen receiving the next automatically positioned button.
[in]textButton label, copied.
[in]tipFocus tip, copied; NULL means empty text.
[in]disabledTipTip shown in red when focused and disabled; copied. NULL or empty text falls back to tip.
[in]onpushAction on activation; an empty action does nothing.
Returns
Button identifier, or -1 when the menu's automatic slots are exhausted.
Note
Use GfuiEnable to disable the button. Merely omitting onpush does not disable it or select the disabled tip.

Definition at line 124 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuDefaultKeysAdd()

void GfuiMenuDefaultKeysAdd ( void * scr)

Add the default menu keyboard callback to a screen.

The keys are:
Up Arrow .... Select Previous Entry
Down Arrow .. Select Next Entry
F1 .......... Help
Tab ......... Select Next Entry
Enter ....... Perform Action
Page Up/Down Select Previous/Next Entry
F12 ......... Save a screenshot Escape is not registered here; GfuiMenuBackQuitButtonCreateAction adds it.

Parameters
[in,out]scrScreen receiving the default bindings.

Definition at line 56 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMenuScreenCreate()

void * GfuiMenuScreenCreate ( const char * title)

Create a new menu screen.

Set the title of the menu Add the default keyboard callbacks to the menu.

Parameters
[in]titleNon-NULL title text, copied into the title label.
Returns
Inactive menu screen handle; release with GfuiScreenRelease.

Definition at line 77 of file guimenu.cpp.

Here is the call graph for this function:

◆ GfuiMouseHide()

void GfuiMouseHide ( void )

Disallow the software mouse cursor on the active screen.

Does not hide the operating system's hardware cursor or disable mouse input.

Definition at line 259 of file gui.cpp.

◆ GfuiMouseInfo()

tMouseInfo * GfuiMouseInfo ( void )

Get the GUI's current mouse state.

Returns
Borrowed pointer to the internal mouse state; do not free it. X and Y use GUI coordinates. The three button entries follow GLUT's left/middle/right indices and contain 1 when pressed, 0 when released.

Definition at line 419 of file gui.cpp.

◆ GfuiMouseSetPos()

void GfuiMouseSetPos ( int x,
int y )

Set the mouse position.

Parameters
[in]xHorizontal position in GLUT window pixels, measured from the left.
[in]yVertical position in GLUT window pixels, measured from the top.
Note
These are not the logical coordinates returned by GfuiMouseInfo.

Definition at line 430 of file gui.cpp.

◆ GfuiMouseShow()

void GfuiMouseShow ( void )

Allow the software mouse cursor on the active screen.

Actual drawing also depends on the global visibility and hardware-cursor flags.

Definition at line 269 of file gui.cpp.

◆ GfuiPrintString()

void GfuiPrintString ( const char * text,
float * fgColor,
int font,
int x,
int y,
int align )
extern

Draw text immediately in the current OpenGL context without creating a widget.

Parameters
[in]textText to draw.
[in]fgColorRGBA text color.
[in]fontGFUI_FONT_* identifier of an initialized font.
[in]xHorizontal anchor in GUI coordinates.
[in]yBaseline in GUI coordinates.
[in]alignGFUI_ALIGN_* value; only horizontal alignment is used.

Definition at line 43 of file guiobject.cpp.

◆ GfuiRegisterKey()

void GfuiRegisterKey ( unsigned char key,
char * descr,
void * userData,
tfuiCallback onKeyPressed,
tfuiCallback onKeyReleased )
extern

Bind an ordinary key on the currently active screen.

Parameters
[in]keyCharacter key code.
[in]descrDescription displayed on the help screen.
[in]userDataData passed to both callbacks.
[in]onKeyPressedCallback on key press, or NULL.
[in]onKeyReleasedCallback on key release, or NULL.
See also
GfuiRegisterKeyAction

Definition at line 879 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiRegisterKeyAction()

void GfuiRegisterKeyAction ( unsigned char key,
char * descr,
const tGfuiAction & onKeyPressed,
const tGfuiAction & onKeyReleased )

Add a Keyboard callback to the current screen.

Parameters
[in]keyOrdinary character key code.
[in]descrHelp-screen description, copied; NULL means empty text.
[in]onKeyPressedAction on key press; may be empty.
[in]onKeyReleasedAction on key release; may be empty.
See also
GfuiAddKeyAction

Definition at line 873 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenActivate()

void GfuiScreenActivate ( void * screen)

Activate a screen and make it current.

Parameters
[in,out]screenScreen or callback hook to activate.
Note
Calls the previous screen's deactivation action, installs GUI GLUT callbacks, and calls the new screen's activation action. The previous screen is not released. Normal screens are displayed immediately.

Definition at line 508 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenAddBgImg()

void GfuiScreenAddBgImg ( void * scr,
const char * filename )

Add an image background to a screen.

Parameters
[in,out]scrScreen whose background texture is replaced.
[in]filenamePNG filename to load.
Note
The old texture is deleted before loading; a load failure therefore removes the old background. Rendering assumes 16:10 artwork stored in a texture and crops it to the viewport's aspect ratio.

Definition at line 1058 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenCreate()

void * GfuiScreenCreate ( void )

Create a new screen.

Returns
Inactive screen handle with default background and mouse enabled. Release it with GfuiScreenRelease.

Definition at line 588 of file gui.cpp.

◆ GfuiScreenCreateEx()

void * GfuiScreenCreateEx ( float * bgColor,
void * userDataOnActivate,
tfuiCallback onActivate,
void * userDataOnDeactivate,
tfuiCallback onDeactivate,
int mouseAllowed )
extern

Create a screen using callbacks with caller-supplied data.

Parameters
[in]bgColorBackground RGBA color, or NULL for the default color.
[in]userDataOnActivateData passed to onActivate.
[in]onActivateCallback on activation, or NULL.
[in]userDataOnDeactivateData passed to onDeactivate.
[in]onDeactivateCallback on deactivation, or NULL.
[in]mouseAllowedNonzero to display the mouse cursor.
Returns
Screen handle, to be released with GfuiScreenRelease.
See also
GfuiScreenCreateExAction

Definition at line 652 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenCreateExAction()

void * GfuiScreenCreateExAction ( float * bgColor,
const tGfuiAction & onActivate,
const tGfuiAction & onDeactivate,
int mouseAllowed )

Create a screen.

Parameters
[in]bgColorFour RGBA floats, copied; NULL selects the default color.
[in]onActivateAction called on activation; may be empty.
[in]onDeactivateAction called on deactivation; may be empty.
[in]mouseAllowedNonzero to allow the mouse cursor to be displayed.
Returns
Inactive screen handle; release it with GfuiScreenRelease.

Definition at line 619 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenDeactivate()

void GfuiScreenDeactivate ( void )

Deactivate the current screen.

Calls its deactivation action and removes GUI input callbacks without releasing the screen. Requires an active screen.

Definition at line 565 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenIsActive()

int GfuiScreenIsActive ( void * screen)

Tell if the screen is active or not.

Parameters
[in]screenScreen handle to compare with the current screen.
Returns
1 if active and 0 if not.

Definition at line 495 of file gui.cpp.

◆ GfuiScreenRelease()

void GfuiScreenRelease ( void * scr)

Release the given screen.

Parameters
[in,out]scrScreen to destroy; the handle is invalid after this call.
Note
An active screen is deactivated first. Widgets, textures, key bindings and stored actions are released; borrowed user data is not freed.

Definition at line 670 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScreenReplace()

void GfuiScreenReplace ( void * screen)

Activate a screen and make it current plus release the current screen.

Parameters
[in,out]screenNew screen to activate; must differ from the current screen.
Note
The old screen and its widgets are released, invalidating their handles.

Definition at line 549 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiScrollBarCreate()

int GfuiScrollBarCreate ( void * scr,
int x,
int y,
int align,
int width,
int orientation,
int min,
int max,
int len,
int start,
void * userData,
tfuiSBCallback onScroll )

Create a new scroll bar.

Parameters
[in,out]scrScreen receiving the scroll bar.
[in]xHorizontal anchor in GUI coordinates.
[in]yVertical anchor in GUI coordinates.
[in]alignPosition of the specified point:
GFUI_ALIGN_HR_VB horizontal right, vertical bottom
GFUI_ALIGN_HR_VC horizontal right, vertical center
GFUI_ALIGN_HR_VT horizontal right, vertical top
GFUI_ALIGN_HC_VB horizontal center, vertical bottom
GFUI_ALIGN_HC_VC horizontal center, vertical center
GFUI_ALIGN_HC_VT horizontal center, vertical top
GFUI_ALIGN_HL_VB horizontal left, vertical bottom
GFUI_ALIGN_HL_VC horizontal left, vertical center
GFUI_ALIGN_HL_VT horizontal left, vertical top
[in]widthLength along the scroll axis, including arrows, in GUI units.
[in]orientationScroll bar orientation:
GFUI_HORI_SCROLLBAR Horizontal
GFUI_VERT_SCROLLBAR Vertical
[in]minMinimum position, inclusive.
[in]maxMaximum position, inclusive; must be at least min.
[in]lenVisible length, stored as metadata; arrow clicks step by one.
[in]startInitial position; caller must keep it within [min, max].
[in]userDataBorrowed data passed in tScrollBarInfo::userData.
[in]onScrollCallback on an arrow click that changes position, or NULL. The tScrollBarInfo pointer passed to it is valid only during the callback.
Returns
Scroll-bar identifier, local to scr.

Definition at line 118 of file guiscrollbar.cpp.

Here is the call graph for this function:

◆ GfuiScrollBarPosGet()

int GfuiScrollBarPosGet ( void * scr,
int id )

Get the current position of a scroll bar.

Parameters
[in]scrScreen containing the scroll bar.
[in]idIdentifier of a scroll-bar widget (type is not checked).
Returns
Current position, or -1 if id is unknown. If negative positions are allowed, -1 may also be a valid position.

Definition at line 239 of file guiscrollbar.cpp.

Here is the call graph for this function:

◆ GfuiScrollBarPosSet()

void GfuiScrollBarPosSet ( void * scr,
int id,
int min,
int max,
int len,
int start )

Set new values for position.

Parameters
[in,out]scrScreen containing the scroll bar.
[in]idIdentifier of a scroll-bar widget (type is not checked).
[in]minNew minimum position, inclusive.
[in]maxNew maximum position, inclusive; must be at least min.
[in]lenNew visible length metadata.
[in]startNew position; caller must keep it within [min, max].
Note
Values are stored without clamping or invoking onScroll. Unknown identifiers are ignored.

Definition at line 267 of file guiscrollbar.cpp.

Here is the call graph for this function:

◆ GfuiScrollListCreate()

int GfuiScrollListCreate ( void * scr,
int font,
int x,
int y,
int align,
int width,
int height,
int scrollbar,
void * userDataOnSelect,
tfuiCallback onSelect )
extern

Create a scrolling list using a callback with caller-supplied data.

Parameters
[in,out]scrScreen handle receiving the list.
[in]fontGFUI_FONT_* identifier.
[in]xHorizontal position in GUI coordinates.
[in]yVertical position in GUI coordinates (zero at the bottom).
[in]alignRetained for compatibility; currently ignored.
[in]widthList width.
[in]heightList height.
[in]scrollbarGFUI_SB_NONE, GFUI_SB_LEFT or GFUI_SB_RIGHT.
[in]userDataOnSelectData passed to onSelect.
[in]onSelectCallback on user selection, or NULL. Programmatic insertion, extraction and reordering do not invoke it.
Returns
Scroll list identifier.
See also
GfuiScrollListCreateAction

Definition at line 189 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListCreateAction()

int GfuiScrollListCreateAction ( void * scr,
int font,
int x,
int y,
int align,
int width,
int height,
int scrollBarPos,
const tGfuiAction & onSelect )

Create a new scroll list.

Parameters
[in,out]scrScreen receiving the list.
[in]fontGFUI_FONT_* identifier.
[in]xLeft edge in GUI coordinates.
[in]yBottom edge in GUI coordinates.
[in]alignRetained for compatibility; currently ignored.
[in]widthWidth in GUI units.
[in]heightHeight in GUI units; should fit at least one text row.
[in]scrollBarPosPosition of the scrollbar:
GFUI_SB_NONE No scroll bar
GFUI_SB_RIGHT Right scroll bar
GFUI_SB_LEFT Left scroll bar
[in]onSelectAction on user selection; may be empty. Programmatic insertion, extraction and reordering do not call it.
Returns
Scroll List Id

Definition at line 143 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListExtractElement()

char * GfuiScrollListExtractElement ( void * scr,
int Id,
int index,
void ** userData )

Extract the specified element from the scroll list.

Parameters
[in,out]scrScreen containing the list to modify.
[in]IdScroll-list identifier.
[in]indexZero-based element index.
[out]userDataNon-NULL address receiving the stored user-data pointer; unchanged on failure.
Returns
Original name pointer, or NULL for an invalid widget or index.
Note
Removes the list entry but does not free its name or user data. The caller retains ownership of both. No selection callback is invoked.

Definition at line 444 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListExtractSelectedElement()

char * GfuiScrollListExtractSelectedElement ( void * scr,
int Id,
void ** userData )

Extract the selected element from the scroll list (removed).

Parameters
[in,out]scrScreen containing the list to modify.
[in]IdScroll-list identifier.
[out]userDataNon-NULL address receiving the stored user-data pointer; unchanged on failure.
Returns
Original name pointer, or NULL for an invalid widget or no selection.
Note
Removes the list entry but does not free its name or user data. The caller retains ownership of both. No selection callback is invoked.

Definition at line 394 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListGetElement()

char * GfuiScrollListGetElement ( void * scr,
int Id,
int index,
void ** userData )

Get the specified element from the scroll list.

Parameters
[in]scrScreen containing the list.
[in]IdScroll-list identifier.
[in]indexZero-based element index.
[out]userDataNon-NULL address receiving the stored user-data pointer; unchanged on failure.
Returns
Borrowed name pointer supplied at insertion, or NULL for an invalid widget or index. Ownership is unchanged.

Definition at line 336 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListGetSelectedElement()

char * GfuiScrollListGetSelectedElement ( void * scr,
int Id,
void ** userData )

Get the selected element from the scroll list.

Parameters
[in]scrScreen containing the list.
[in]IdScroll-list identifier.
[out]userDataNon-NULL address receiving the stored user-data pointer; unchanged on failure.
Returns
Borrowed name pointer supplied at insertion, or NULL if the widget is not a list, is empty, or has no selected element. Ownership is unchanged.

Definition at line 277 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListInsertElement()

int GfuiScrollListInsertElement ( void * scr,
int Id,
char * element,
int index,
void * userData )

Insert an element in a scroll list.

Parameters
[in,out]scrScreen containing the list to modify.
[in]IdScroll-list identifier.
[in]elementNon-NULL display name, borrowed without copying. Keep it valid while the entry remains in the list.
[in]indexZero-based insertion position; negative or beyond the last entry appends. Zero inserts before the first entry.
[in]userDataBorrowed application data associated with the entry; may be NULL.
Returns
0 on success, -1 if Id does not identify a scroll list.
Note
Neither extraction nor screen release frees element or userData.

Definition at line 496 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiScrollListMoveSelectedElement()

int GfuiScrollListMoveSelectedElement ( void * scr,
int Id,
int delta )

Move the selected element within the scroll list.

Parameters
[in,out]scrScreen containing the list to modify.
[in]IdScroll-list identifier.
[in]deltaSigned displacement in entries; negative moves toward the start.
Returns
0 on success, -1 for an invalid widget, no selection, or a destination outside the list. The moved entry remains selected; no callback is invoked.

Definition at line 670 of file guiscrollist.cpp.

Here is the call graph for this function:

◆ GfuiSKeyEventRegister()

void GfuiSKeyEventRegister ( void * scr,
tfuiSKeyCallback onSKeyAction )
extern

Set the special-key event interceptor for a screen.

Parameters
[in,out]scrScreen handle whose event interceptor is updated.
[in]onSKeyActionCallback receiving the GLUT special-key code, modifiers and GFUI_KEY_DOWN or GFUI_KEY_UP; NULL removes the interceptor. Return nonzero to consume the event before normal key handling.

Definition at line 778 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiSKeyEventRegisterCurrent()

void GfuiSKeyEventRegisterCurrent ( tfuiSKeyCallback onSKeyAction)
extern

Set the special-key interceptor on the currently active screen.

Parameters
[in]onSKeyActionEvent callback, or NULL to remove it; see GfuiSKeyEventRegister.

Definition at line 793 of file gui.cpp.

Here is the call graph for this function:

◆ GfuiStaticImageCreate()

int GfuiStaticImageCreate ( void * scr,
int x,
int y,
int w,
int h,
char * name )

Create a new static image.

This kind of image is not clickable.

Parameters
[in,out]scrScreen receiving the image.
[in]xLeft edge in GUI coordinates.
[in]yBottom edge in GUI coordinates.
[in]wDisplay width in GUI units (independent of PNG dimensions).
[in]hDisplay height in GUI units (independent of PNG dimensions).
[in]namePNG filename, or NULL for an initially empty widget.
Returns
Image Id
-1 Allocation or invalid screen error
Note
If name cannot be loaded, an empty image widget is still created so a later GfuiStaticImageSet() call can recover.
Source dimensions must be supported by the current OpenGL context; legacy contexts may require power-of-two dimensions. Images need not be square.

Definition at line 48 of file guiimage.cpp.

Here is the call graph for this function:

◆ GfuiStaticImageSet()

void GfuiStaticImageSet ( void * scr,
int id,
char * name )

Replace an image by another one.

Parameters
[in,out]scrScreen containing the image.
[in]idImage-widget identifier.
[in]namePNG filename, or NULL to clear the image.
Note
If name cannot be loaded, the image is left empty until a later successful GfuiStaticImageSet() call.
Display bounds are unchanged. Unknown identifiers and other widget types are ignored. Source dimension requirements are as in GfuiStaticImageCreate.

Definition at line 90 of file guiimage.cpp.

Here is the call graph for this function:

◆ GfuiTipCreate()

int GfuiTipCreate ( void * scr,
const char * text,
int maxlen )

Add a Tip (generally associated with a button).

Parameters
[in,out]scrScreen where to add the label
[in]textText of the label
[in]maxlenMaximum length of the label string (0 for the text length)
Returns
label Id
See also
GfuiLabelSetText

Definition at line 135 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiTitleCreate()

int GfuiTitleCreate ( void * scr,
const char * text,
int maxlen )

Add a Title to the screen.

Places a centered GFUI_FONT_BIG label at (320, 440) in GUI coordinates.

Parameters
[in,out]scrScreen receiving the title.
[in]textInitial title, copied.
[in]maxlenText capacity in bytes excluding NUL; zero uses strlen(text).
Returns
label Id
See also
GfuiLabelSetText

Definition at line 150 of file guilabel.cpp.

Here is the call graph for this function:

◆ GfuiUnSelectCurrent()

void GfuiUnSelectCurrent ( void )

Remove focus from the active screen's current widget.

Does nothing if no widget has focus. Buttons and edit boxes are reset to their released state and their focus-lost action is invoked synchronously. Requires an active screen.

Definition at line 165 of file guiobject.cpp.

Here is the call graph for this function:

◆ GfuiVisibilitySet()

int GfuiVisibilitySet ( void * scr,
int id,
int visible )

Set/unset the visibility attribute of an object.

Parameters
[in,out]scrScreen containing the widget.
[in]idWidget identifier.
[in]visibleGFUI_VISIBLE or GFUI_INVISIBLE.
Returns
0 on success, -1 for an unknown identifier or invalid visibility value.

Definition at line 386 of file guiobject.cpp.

Here is the call graph for this function: