|
Odamex
Setting the Standard in Multiplayer Doom
|
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_t * | TXT_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. | |
Windows.
| 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) |
| void TXT_CloseWindow | ( | txt_window_t * | window | ) |
Close a window.
| window | Tine window to close. |
| txt_window_t* TXT_NewWindow | ( | char * | title | ) |
Open a new window.
| title | Title to display in the titlebar of 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.
| window | The window. |
| key_listener | Callback function. |
| user_data | User-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.
| window | The window. |
| mouse_listener | Callback function. |
| user_data | User-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.
| window | The window. |
| position | The window action slot to set (left, center or right). |
| action | The 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).
| window | The window. |
| horiz_align | Horizontal position on the screen to which the coordinates are relative (left side, right side or center). |
| vert_align | Vertical position on the screen to which the coordinates are relative (top, bottom or center). |
| x | X coordinate (horizonal axis) for window position. |
| y | Y coordinate (vertical axis) for window position. |