Odamex
Setting the Standard in Multiplayer Doom
textscreen/txt_window.h File Reference

Windows. More...

Go to the source code of this file.

Data Structures

struct  txt_window_s

Typedefs

typedef struct txt_window_s txt_window_t
 A window.
typedef int(* TxtWindowKeyPress )(txt_window_t *window, int key, void *user_data)
typedef int(* TxtWindowMousePress )(txt_window_t *window, int x, int y, int b, void *user_data)

Functions

txt_window_tTXT_NewWindow (char *title)
 Open a new window.
void TXT_CloseWindow (txt_window_t *window)
 Close a window.
void TXT_SetWindowPosition (txt_window_t *window, txt_horiz_align_t horiz_align, txt_vert_align_t vert_align, int x, int y)
 Set the position of a window on the screen.
void TXT_SetWindowAction (txt_window_t *window, txt_horiz_align_t position, txt_window_action_t *action)
 Set a window action for a given window.
void TXT_SetKeyListener (txt_window_t *window, TxtWindowKeyPress key_listener, void *user_data)
 Set a callback function to be invoked whenever a key is pressed within a window.
void TXT_SetMouseListener (txt_window_t *window, TxtWindowMousePress mouse_listener, void *user_data)
 Set a callback function to be invoked whenever a mouse button is pressed within a window.

Detailed Description

Windows.


Typedef Documentation

typedef struct txt_window_s txt_window_t

A window.

A window contains widgets, and may also be treated as a table (txt_table_t) containing a single column.

Windows can be created using TXT_NewWindow and closed using TXT_CloseWindow. When a window is closed, it emits the "closed" signal.

In addition to the widgets within a window, windows also have a "tray" area at their bottom containing window action widgets. These widgets allow keyboard shortcuts to trigger common actions. Each window has three slots for keyboard shortcuts. By default, the left slot contains an action to close the window when the escape button is pressed, while the right slot contains an action to activate the currently-selected widget.

typedef int(* TxtWindowKeyPress)(txt_window_t *window, int key, void *user_data)
typedef int(* TxtWindowMousePress)(txt_window_t *window, int x, int y, int b, void *user_data)

Function Documentation

void TXT_CloseWindow ( txt_window_t window)

Close a window.

Parameters:
windowTine window to close.
txt_window_t* TXT_NewWindow ( char *  title)

Open a new window.

Parameters:
titleTitle to display in the titlebar of the new window.
Returns:
Pointer to a new txt_window_t structure representing the new window.
void TXT_SetKeyListener ( txt_window_t window,
TxtWindowKeyPress  key_listener,
void *  user_data 
)

Set a callback function to be invoked whenever a key is pressed within a window.

Parameters:
windowThe window.
key_listenerCallback function.
user_dataUser-specified pointer to pass to the callback function.
void TXT_SetMouseListener ( txt_window_t window,
TxtWindowMousePress  mouse_listener,
void *  user_data 
)

Set a callback function to be invoked whenever a mouse button is pressed within a window.

Parameters:
windowThe window.
mouse_listenerCallback function.
user_dataUser-specified pointer to pass to the callback function.
void TXT_SetWindowAction ( txt_window_t window,
txt_horiz_align_t  position,
txt_window_action_t action 
)

Set a window action for a given window.

Each window can have up to three window actions, which provide keyboard shortcuts that can be used within a given window.

Parameters:
windowThe window.
positionThe window action slot to set (left, center or right).
actionThe window action widget. If this is NULL, any current window action in the given slot is removed.
void TXT_SetWindowPosition ( txt_window_t window,
txt_horiz_align_t  horiz_align,
txt_vert_align_t  vert_align,
int  x,
int  y 
)

Set the position of a window on the screen.

The window is specified as coordinates relative to a predefined position on the screen (eg. center of the screen, top left of the screen, etc).

Parameters:
windowThe window.
horiz_alignHorizontal position on the screen to which the coordinates are relative (left side, right side or center).
vert_alignVertical position on the screen to which the coordinates are relative (top, bottom or center).
xX coordinate (horizonal axis) for window position.
yY coordinate (vertical axis) for window position.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends