gui.h |
gui.h |
typedef enum gui_event gui_event_t
A GUI event number.
Initialise the GUI subsystem.
Shutdown the GUI subsystem.
Run the GUI subsystem. This will not return until gui_quit is called.See also: gui_quit.
Stop running the GUI subsystem. After this, you can rerun the system with gui_main, or clean up with gui_shutdown.
typedef struct gui_window gui_window_t
Opaque data type representing a window.
gui_window_t *gui_window_create (int x, int y, int w, int h, int flags)
Create a window with the specified position and dimensions. Flags can be a combination of the following OR'd together:- GUI_HINT_NOFRAME: the window will have no frame
- GUI_HINT_STEALFOCUS: the window steals the focus as soon as the mouse moves over it (no click required)
- GUI_HINT_GHOSTABLE: the user can "ghost" the window, making the window translucent, and allowing focus to pass through the window.
void gui_window_destroy (gui_window_t *)
Free the memory associated with a window.
void gui_window_move (gui_window_t *, int x, int y)
Move a window to a specified position.
void gui_window_move_relative (gui_window_t *, int dx, int dy)
Move a window, relative to its current position.
void gui_window_resize (gui_window_t *, int w, int h)
Resize a window.
void gui_window_lower (gui_window_t *)
Lower a window.
void gui_window_raise (gui_window_t *)
Raise a window.
void gui_window_show (gui_window_t *)
Unhide a window after being hidden. Note that windows are not hidden by default.
void gui_window_hide (gui_window_t *)
Hide a window. The window will disappear off the screen, and will not be able to receive focus.
void gui_window_dirty (gui_window_t *)
Mark a window as "dirty", so it will be redrawn.
void gui_window_set_title (gui_window_t *, const char *title)
Set the title of a window.
void gui_window_set_depth (gui_window_t *, int depth)
Set the depth of a window. Windows of a higher depth value will always appear above windows of a lower depth value. The default depth is zero.
void gui_window_set_alpha (gui_window_t *, int alpha)
Set the alpha level (translucency) of a window (0 - 255). Windows are opaque by default (alpha value of 255). Note that alpha levels below a certain value will be rounded up, so you cannot use zero to get a completely transparent window.
void gui_window_set_self (gui_window_t *, void *self)
Set the `self' field of a window, which is passed to draw and event procs. By default, `self' is the window itself.
void gui_window_set_draw_proc (gui_window_t *, void (*draw) (void *self, struct BITMAP *))
Set the callback for window redrawing. It will be called with the window's `self' value, and the bitmap to draw to. The bitmap is not the screen, but a private bitmap.
Set the callback to handle window events. It will be called with the window's `self' value, the event number, and any extra event data.
int gui_window_x (gui_window_t *)
Return the x position of a window.
int gui_window_y (gui_window_t *)
Return the y position of a window.
int gui_window_w (gui_window_t *)
Return the width of a window.
int gui_window_h (gui_window_t *)
Return the height of a window.
int gui_window_hidden (gui_window_t *)
Return non-zero if the window is hidden.
typedef struct gui_accel gui_accel_t
Opaque data type representing an accelerator key.
gui_accel_t *gui_accel_create (int key, void (*proc) (void))
Create an accelerator key. KEY can be either a character, or output of the GUI_ACCEL_CTRL macro.Example:
accel = gui_accel_create (GUI_ACCEL_CTRL ('z'), foo);
void gui_accel_destroy (gui_accel_t *)
Free the memory associated with an accelerator key.
extern struct gui_mouse_state gui_mouse
This variable lets you inspect the current state of the mouse. It contains the following read-only fields:- x, y: x and y positions of the mouse cursor
- z: mouse wheel "position". One 'tick' of the wheel upwards increases the value by 1.
- dx, dy, dz: amount of change in the x, y, z values since the last update.
- b[0].down, b[0].up: non-zero if the left mouse button has been pressed or released since the last update. Note that one is the complement of the other.
- b[0].state: non-zero if the left mouse button is being held down
- b[1].down, b[1].up, b[1].state: right mouse button
- b[2].down, b[2].up, b[2].state: middle mouse button
void gui_mouse_restrict (gui_window_t *)
Restrict the movement of the mouse to the confines of a window.
void gui_mouse_unrestrict (void)
Allow the mouse to move around the entire screen).