NetSurf
|
Automated RISC OS WIMP event handling (implementation). More...
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "oslib/os.h"
#include "oslib/osbyte.h"
#include "oslib/serviceinternational.h"
#include "oslib/wimp.h"
#include "utils/log.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
#include "riscos/menus.h"
#include "riscos/ucstables.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
Go to the source code of this file.
Data Structures | |
struct | event_data_numeric_field |
struct | event_data_menu_gright |
struct | icon_event |
struct | event_window |
Macros | |
#define | WIN_HASH_SIZE 32 |
#define | WIN_HASH(w) (((unsigned)(w) >> 5) % WIN_HASH_SIZE) |
Enumerations | |
enum | event_type { EVENT_NUMERIC_FIELD , EVENT_TEXT_FIELD , EVENT_UP_ARROW , EVENT_DOWN_ARROW , EVENT_MENU_GRIGHT , EVENT_CHECKBOX , EVENT_RADIO , EVENT_BUTTON , EVENT_CANCEL , EVENT_OK } |
Functions | |
static void | ro_gui_wimp_event_ok_click (struct event_window *window, wimp_mouse_state state) |
Perform the necessary actions following a click on the OK button. More... | |
static struct event_window * | ro_gui_wimp_event_get_window (wimp_w w) |
Finds the event data associated with a given window handle, or creates a new one. More... | |
static struct event_window * | ro_gui_wimp_event_find_window (wimp_w w) |
Find the event data associated with a given window handle. More... | |
static struct icon_event * | ro_gui_wimp_event_get_event (wimp_w w, wimp_i i, event_type type) |
static void | ro_gui_wimp_event_prepare_gright_menu (wimp_w w, struct icon_event *event) |
Prepare a menu ready for use. More... | |
static struct event_window * | ro_gui_wimp_event_remove_window (wimp_w w) |
Removes the event data associated with a given handle from the hash tables, but does not delete it. More... | |
bool | ro_gui_wimp_event_memorise (wimp_w w) |
Memorises the current state of any registered components in a window. More... | |
bool | ro_gui_wimp_event_restore (wimp_w w) |
Restore the state of any registered components in a window to their memorised state. More... | |
bool | ro_gui_wimp_event_validate (wimp_w w) |
Ensures all values are within pre-determined boundaries. More... | |
bool | ro_gui_wimp_event_transfer (wimp_w from, wimp_w to) |
Transfer event data from one window to another. More... | |
void | ro_gui_wimp_event_finalise (wimp_w w) |
Free any resources associated with a window. More... | |
void | ro_gui_wimp_event_deregister (wimp_w w, wimp_i i) |
Free any resources associated with a specific icon in a window. More... | |
bool | ro_gui_wimp_event_set_help_prefix (wimp_w w, const char *help_prefix) |
Set the associated help prefix for a given window. More... | |
const char * | ro_gui_wimp_event_get_help_prefix (wimp_w w) |
Get the associated help prefix. More... | |
bool | ro_gui_wimp_event_register_help_suffix (wimp_w w, const char *(*get_help_suffix)(wimp_w w, wimp_i i, os_coord *pos, wimp_mouse_state buttons)) |
Register a handler to decode help suffixes for a given window. More... | |
const char * | ro_gui_wimp_event_get_help_suffix (wimp_w w, wimp_i i, os_coord *pos, wimp_mouse_state buttons) |
Get the associated help suffix. More... | |
bool | ro_gui_wimp_event_set_user_data (wimp_w w, void *user) |
Sets the user data associated with a window. More... | |
void * | ro_gui_wimp_event_get_user_data (wimp_w w) |
Gets the user data associated with a window. More... | |
bool | ro_gui_wimp_event_menu_selection (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
Handles a menu selection event. More... | |
bool | ro_gui_wimp_event_mouse_click (wimp_pointer *pointer) |
Handles a mouse click event in a registered window. More... | |
bool | ro_gui_wimp_event_keypress (wimp_key *key) |
Handle any registered keypresses, and the standard RISC OS ones. More... | |
bool | ro_gui_wimp_event_open_window (wimp_open *open) |
Handle any open window requests. More... | |
bool | ro_gui_wimp_event_close_window (wimp_w w) |
Service any close window handlers. More... | |
bool | ro_gui_wimp_event_redraw_window (wimp_draw *redraw) |
Handle any redraw window requests. More... | |
bool | ro_gui_wimp_event_scroll_window (wimp_scroll *scroll) |
Handle any scroll window requests. More... | |
bool | ro_gui_wimp_event_pointer_entering_window (wimp_entering *entering) |
Handle any pointer entering window requests. More... | |
bool | ro_gui_wimp_event_process_window_menu_click (wimp_pointer *pointer) |
Process a Menu click in a window, by checking for a registered window menu and opening it if one is found. More... | |
bool | ro_gui_wimp_event_prepare_menu (wimp_w w, wimp_i i, wimp_menu *menu) |
Trigger a window's Prepare Menu event. More... | |
bool | ro_gui_wimp_event_register_menu (wimp_w w, wimp_menu *m, bool menu_auto, bool position_ibar) |
Register a window menu to be (semi-)automatically handled. More... | |
bool | ro_gui_wimp_event_register_numeric_field (wimp_w w, wimp_i i, wimp_i up, wimp_i down, int min, int max, int stepping, int decimal_places) |
Register a numeric field to be automatically handled. More... | |
bool | ro_gui_wimp_event_register_text_field (wimp_w w, wimp_i i) |
Register a text field to be automatically handled. More... | |
bool | ro_gui_wimp_event_register_menu_gright (wimp_w w, wimp_i i, wimp_i gright, wimp_menu *menu) |
Register an icon menu to be automatically handled. More... | |
bool | ro_gui_wimp_event_register_checkbox (wimp_w w, wimp_i i) |
Register a checkbox to be automatically handled. More... | |
bool | ro_gui_wimp_event_register_radio (wimp_w w, wimp_i *i) |
Register a group of radio icons to be automatically handled. More... | |
bool | ro_gui_wimp_event_register_button (wimp_w w, wimp_i i, void(*callback)(wimp_pointer *pointer)) |
Register a function to be called when a particular button is pressed. More... | |
bool | ro_gui_wimp_event_register_cancel (wimp_w w, wimp_i i) |
Register a function to be called for the Cancel action on a window. More... | |
bool | ro_gui_wimp_event_register_ok (wimp_w w, wimp_i i, bool(*callback)(wimp_w w)) |
Register a function to be called for the OK action on a window. More... | |
bool | ro_gui_wimp_event_register_mouse_click (wimp_w w, bool(*callback)(wimp_pointer *pointer)) |
Register a function to be called for all mouse-clicks to icons in a window that don't have registered actions. More... | |
bool | ro_gui_wimp_event_register_keypress (wimp_w w, bool(*callback)(wimp_key *key)) |
Register a function to be called for all keypresses within a particular window. More... | |
bool | ro_gui_wimp_event_register_open_window (wimp_w w, void(*callback)(wimp_open *open)) |
Register a function to be called for all window opening requests. More... | |
bool | ro_gui_wimp_event_register_close_window (wimp_w w, void(*callback)(wimp_w w)) |
Register a function to be called after the window has been closed. More... | |
bool | ro_gui_wimp_event_register_redraw_window (wimp_w w, void(*callback)(wimp_draw *redraw)) |
Register a function to be called for all window redraw operations. More... | |
bool | ro_gui_wimp_event_register_scroll_window (wimp_w w, void(*callback)(wimp_scroll *scroll)) |
Register a function to be called for all window scroll requests. More... | |
bool | ro_gui_wimp_event_register_pointer_entering_window (wimp_w w, void(*callback)(wimp_entering *entering)) |
Register a function to be called for all pointer entering window requests. More... | |
bool | ro_gui_wimp_event_register_menu_prepare (wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_pointer *p)) |
Register a function to be called before a menu is (re-)opened. More... | |
bool | ro_gui_wimp_event_register_menu_selection (wimp_w w, bool(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a)) |
Register a function to be called following a menu selection. More... | |
bool | ro_gui_wimp_event_register_menu_warning (wimp_w w, void(*callback)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a)) |
Register a function to be called when a sub-menu warning is received. More... | |
bool | ro_gui_wimp_event_register_menu_close (wimp_w w, void(*callback)(wimp_w w, wimp_i i, wimp_menu *m)) |
Register a function to be called before a menu is finally closed. More... | |
bool | ro_gui_wimp_event_submenu_warning (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
void | ro_gui_wimp_event_menus_closed (wimp_w w, wimp_i i, wimp_menu *menu) |
Handle menus being closed. More... | |
void | ro_gui_wimp_event_register_submenu (wimp_w w) |
Register a submenu as being opened. More... | |
Variables | |
static struct event_window * | ro_gui_wimp_event_windows [WIN_HASH_SIZE] |
static wimp_w | ro_gui_wimp_event_submenu |
Automated RISC OS WIMP event handling (implementation).
Definition in file wimp_event.c.
#define WIN_HASH | ( | w | ) | (((unsigned)(w) >> 5) % WIN_HASH_SIZE) |
Definition at line 46 of file wimp_event.c.
#define WIN_HASH_SIZE 32 |
Definition at line 45 of file wimp_event.c.
enum event_type |
Enumerator | |
---|---|
EVENT_NUMERIC_FIELD | |
EVENT_TEXT_FIELD | |
EVENT_UP_ARROW | |
EVENT_DOWN_ARROW | |
EVENT_MENU_GRIGHT | |
EVENT_CHECKBOX | |
EVENT_RADIO | |
EVENT_BUTTON | |
EVENT_CANCEL | |
EVENT_OK |
Definition at line 48 of file wimp_event.c.
bool ro_gui_wimp_event_close_window | ( | wimp_w | w | ) |
Service any close window handlers.
w | the window being closed |
Definition at line 1107 of file wimp_event.c.
References event_window::close_window, NSLOG, ro_gui_wimp_event_find_window(), ro_gui_wimp_event_submenu, and event_window::w.
Referenced by ro_gui_close_window_request(), ro_gui_dialog_close_persistent(), ro_gui_wimp_event_keypress(), ro_gui_wimp_event_mouse_click(), ro_gui_wimp_event_ok_click(), and ro_gui_wimp_event_register_submenu().
void ro_gui_wimp_event_deregister | ( | wimp_w | w, |
wimp_i | i | ||
) |
Free any resources associated with a specific icon in a window.
w | The window containing the icon. |
i | The icon to free resources for. |
Definition at line 334 of file wimp_event.c.
References EVENT_NUMERIC_FIELD, EVENT_TEXT_FIELD, event_window::first, icon_event::i, icon_event::next, NSLOG, parent, and ro_gui_wimp_event_get_window().
Referenced by ro_gui_url_bar_icon_update().
void ro_gui_wimp_event_finalise | ( | wimp_w | w | ) |
Free any resources associated with a window.
w | the window to free resources for |
Definition at line 296 of file wimp_event.c.
References EVENT_NUMERIC_FIELD, EVENT_TEXT_FIELD, event_window::first, icon_event::next, NSLOG, icon_event::previous_value, ro_gui_wimp_event_remove_window(), icon_event::textual, and icon_event::type.
Referenced by gui_window_destroy(), ro_corewindow_fini(), ro_gui_configure_initialise(), ro_gui_download_window_destroy(), ro_gui_options_image_finalise(), ro_gui_options_theme_finalise(), ro_gui_progress_bar_destroy(), ro_gui_query_close(), ro_gui_status_bar_destroy(), ro_textarea_destroy(), and ro_toolbar_destroy().
|
static |
Find the event data associated with a given window handle.
w | the window to find data for |
Definition at line 1702 of file wimp_event.c.
References event_window::next, ro_gui_wimp_event_windows, event_window::w, and WIN_HASH.
Referenced by ro_gui_wimp_event_close_window(), ro_gui_wimp_event_get_help_prefix(), ro_gui_wimp_event_get_help_suffix(), ro_gui_wimp_event_get_user_data(), ro_gui_wimp_event_get_window(), ro_gui_wimp_event_keypress(), ro_gui_wimp_event_memorise(), ro_gui_wimp_event_menu_selection(), ro_gui_wimp_event_menus_closed(), ro_gui_wimp_event_mouse_click(), ro_gui_wimp_event_open_window(), ro_gui_wimp_event_pointer_entering_window(), ro_gui_wimp_event_prepare_menu(), ro_gui_wimp_event_process_window_menu_click(), ro_gui_wimp_event_redraw_window(), ro_gui_wimp_event_restore(), ro_gui_wimp_event_scroll_window(), ro_gui_wimp_event_submenu_warning(), and ro_gui_wimp_event_validate().
|
static |
Definition at line 1715 of file wimp_event.c.
References event_window::first, icon_event::i, icon_event::next, ro_gui_wimp_event_get_window(), and type.
Referenced by ro_gui_wimp_event_register_button(), ro_gui_wimp_event_register_cancel(), ro_gui_wimp_event_register_checkbox(), ro_gui_wimp_event_register_menu_gright(), ro_gui_wimp_event_register_numeric_field(), ro_gui_wimp_event_register_ok(), ro_gui_wimp_event_register_radio(), and ro_gui_wimp_event_register_text_field().
const char * ro_gui_wimp_event_get_help_prefix | ( | wimp_w | w | ) |
Get the associated help prefix.
w | the window to get the prefix for |
Definition at line 408 of file wimp_event.c.
References event_window::help_prefix, ro_gui_wimp_event_find_window(), and event_window::w.
Referenced by ro_gui_interactive_help_request().
const char * ro_gui_wimp_event_get_help_suffix | ( | wimp_w | w, |
wimp_i | i, | ||
os_coord * | pos, | ||
wimp_mouse_state | buttons | ||
) |
Get the associated help suffix.
w | The window to get the suffix for |
i | The icon |
pos | The os coordinates |
buttons | The button state. |
Definition at line 448 of file wimp_event.c.
References event_window::get_help_suffix, ro_gui_wimp_event_find_window(), and event_window::w.
Referenced by ro_gui_interactive_help_request().
void * ro_gui_wimp_event_get_user_data | ( | wimp_w | w | ) |
Gets the user data associated with a window.
w | the window to retrieve the data for |
Definition at line 486 of file wimp_event.c.
References ro_gui_wimp_event_find_window(), event_window::user_data, and event_window::w.
Referenced by cookie_menu_prepare(), cookie_menu_select(), global_history_menu_prepare(), global_history_menu_select(), hotlist_menu_prepare(), hotlist_menu_select(), ro_cw_keypress(), ro_cw_mouse_at(), ro_cw_mouse_click(), ro_cw_open(), ro_cw_pointer_leaving(), ro_cw_redraw(), ro_cw_scroll(), ro_gui_download_click(), ro_gui_download_close(), ro_gui_download_keypress(), ro_gui_progress_bar_redraw(), ro_gui_query_apply(), ro_gui_query_click(), ro_gui_query_close(), ro_gui_status_bar_open(), ro_gui_status_bar_redraw(), ro_gui_window_click(), ro_gui_window_close(), ro_gui_window_keypress(), ro_gui_window_menu_prepare(), ro_gui_window_menu_select(), ro_gui_window_menu_warning(), ro_gui_window_open(), ro_gui_window_redraw(), ro_textarea_key_press(), ro_textarea_mouse_click(), ro_textarea_redraw_internal(), ro_toolbar_click(), ro_toolbar_get_help_suffix(), ro_toolbar_keypress(), ro_toolbar_menu_prepare(), ro_toolbar_menu_select(), and ro_toolbar_redraw().
|
static |
Finds the event data associated with a given window handle, or creates a new one.
w | the window to find data for |
Definition at line 1643 of file wimp_event.c.
References event_window::next, NSLOG, ro_gui_wimp_event_find_window(), ro_gui_wimp_event_windows, event_window::w, and WIN_HASH.
Referenced by ro_gui_wimp_event_deregister(), ro_gui_wimp_event_get_event(), ro_gui_wimp_event_register_close_window(), ro_gui_wimp_event_register_help_suffix(), ro_gui_wimp_event_register_keypress(), ro_gui_wimp_event_register_menu(), ro_gui_wimp_event_register_menu_close(), ro_gui_wimp_event_register_menu_prepare(), ro_gui_wimp_event_register_menu_selection(), ro_gui_wimp_event_register_menu_warning(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_ok(), ro_gui_wimp_event_register_open_window(), ro_gui_wimp_event_register_pointer_entering_window(), ro_gui_wimp_event_register_radio(), ro_gui_wimp_event_register_redraw_window(), ro_gui_wimp_event_register_scroll_window(), ro_gui_wimp_event_set_help_prefix(), and ro_gui_wimp_event_set_user_data().
bool ro_gui_wimp_event_keypress | ( | wimp_key * | key | ) |
Handle any registered keypresses, and the standard RISC OS ones.
key | the key state |
Definition at line 885 of file wimp_event.c.
References EVENT_CANCEL, event_window::first, IS_WIMP_KEY, event_window::keypress, icon_event::next, NSLOG, event_window::ok_click, ro_gui_dialog_close(), ro_gui_menu_destroy(), ro_gui_wimp_check_window_furniture(), ro_gui_wimp_event_close_window(), ro_gui_wimp_event_find_window(), ro_gui_wimp_event_mouse_click(), ro_gui_wimp_event_ok_click(), icon_event::type, and ucstable_from_alphabet().
Referenced by ro_gui_keypress(), and ro_gui_keypress_cb().
bool ro_gui_wimp_event_memorise | ( | wimp_w | w | ) |
Memorises the current state of any registered components in a window.
w | the window to memorise |
Definition at line 139 of file wimp_event.c.
References EVENT_CHECKBOX, EVENT_MENU_GRIGHT, EVENT_NUMERIC_FIELD, EVENT_RADIO, EVENT_TEXT_FIELD, event_window::first, icon_event::i, icon_event::next, NSLOG, icon_event::previous_value, ro_gui_get_icon_selected_state(), ro_gui_get_icon_shaded_state(), ro_gui_get_icon_string(), ro_gui_wimp_event_find_window(), icon_event::textual, icon_event::type, and event_window::w.
Referenced by ro_gui_dialog_prepare_open_url(), ro_gui_dialog_prepare_zoom(), ro_gui_options_cache_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_content_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_language_initialise(), ro_gui_options_security_initialise(), ro_gui_options_theme_click(), ro_gui_options_theme_initialise(), ro_gui_options_theme_ok(), ro_gui_print_prepare(), ro_gui_save_prepare(), ro_gui_search_prepare(), and ro_gui_wimp_event_ok_click().
bool ro_gui_wimp_event_menu_selection | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_menu * | menu, | ||
wimp_selection * | selection, | ||
menu_action | action | ||
) |
Handles a menu selection event.
(At present, this is tied to being called from menus.c and relies on that module decoding the menu into an action code. If menus.c loses its menu handling in the future, such decoding might need to move here.)
The order of execution is:
w | the window to owning the menu |
i | the icon owning the menu |
menu | the menu that has been selected |
selection | the selection information |
action | the menu action info from menus.c |
Definition at line 520 of file wimp_event.c.
References icon_event::data, EVENT_MENU_GRIGHT, event_data_menu_gright::field, event_window::first, icon_event::i, event_window::keypress, icon_event::menu_gright, event_window::menu_prepare, event_window::menu_selection, icon_event::next, NSLOG, ro_gui_set_icon_string(), ro_gui_wimp_event_find_window(), ro_gui_wimp_event_prepare_gright_menu(), ro_warn_user(), icon_event::type, and event_window::w.
Referenced by ro_gui_menu_selection().
void ro_gui_wimp_event_menus_closed | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_menu * | menu | ||
) |
Handle menus being closed.
This is called from the menus modules, in every scenario when one of our own menus is open.
w | the window to owning the menu |
i | the icon owning the menu |
menu | the menu that has been selected |
Definition at line 1807 of file wimp_event.c.
References icon_event::data, EVENT_MENU_GRIGHT, event_window::first, icon_event::i, event_data_menu_gright::menu, event_window::menu_close, icon_event::menu_gright, icon_event::next, ro_gui_wimp_event_find_window(), ro_gui_wimp_event_register_submenu(), icon_event::type, and event_window::window_menu.
Referenced by ro_gui_menu_closed().
bool ro_gui_wimp_event_mouse_click | ( | wimp_pointer * | pointer | ) |
Handles a mouse click event in a registered window.
The order of execution is:
pointer | the current pointer state |
Definition at line 639 of file wimp_event.c.
References icon_event::callback, current_menu, current_menu_window, icon_event::data, event_data_numeric_field::decimal_places, EVENT_BUTTON, EVENT_CANCEL, EVENT_CHECKBOX, EVENT_DOWN_ARROW, EVENT_MENU_GRIGHT, EVENT_NUMERIC_FIELD, EVENT_OK, EVENT_RADIO, EVENT_TEXT_FIELD, EVENT_UP_ARROW, event_window::first, icon_event::i, icon_event::linked_icon, event_data_numeric_field::max, max, event_data_menu_gright::menu, icon_event::menu_gright, event_window::menu_prepare, event_data_numeric_field::min, min, event_window::mouse_click, icon_event::next, NSLOG, icon_event::numeric_field, PTR_WIMP_OPEN, icon_event::radio_group, ro_gui_dialog_add_persistent(), ro_gui_dialog_close(), ro_gui_get_icon_decimal(), ro_gui_menu_destroy(), ro_gui_popup_menu(), ro_gui_set_icon_decimal(), ro_gui_set_icon_selected_state(), ro_gui_wimp_event_close_window(), ro_gui_wimp_event_find_window(), ro_gui_wimp_event_ok_click(), ro_gui_wimp_event_prepare_gright_menu(), ro_gui_wimp_event_process_window_menu_click(), ro_gui_wimp_event_restore(), ro_warn_user(), event_data_numeric_field::stepping, icon_event::type, event_window::window_menu, and event_window::window_menu_auto.
Referenced by ro_gui_handle_event(), and ro_gui_wimp_event_keypress().
|
static |
Perform the necessary actions following a click on the OK button.
/param window the window to perform the action on /param state the mouse button state
Definition at line 852 of file wimp_event.c.
References EVENT_OK, event_window::first, icon_event::i, icon_event::next, event_window::ok_click, ro_gui_dialog_close(), ro_gui_get_icon_shaded_state(), ro_gui_menu_destroy(), ro_gui_wimp_event_close_window(), ro_gui_wimp_event_memorise(), ro_gui_wimp_event_validate(), icon_event::type, and event_window::w.
Referenced by ro_gui_wimp_event_keypress(), and ro_gui_wimp_event_mouse_click().
bool ro_gui_wimp_event_open_window | ( | wimp_open * | open | ) |
Handle any open window requests.
open | the window open request |
Definition at line 1089 of file wimp_event.c.
References event_window::open_window, and ro_gui_wimp_event_find_window().
Referenced by ro_gui_open_window_request().
bool ro_gui_wimp_event_pointer_entering_window | ( | wimp_entering * | entering | ) |
Handle any pointer entering window requests.
entering | the pointer entering window request |
Definition at line 1165 of file wimp_event.c.
References event_window::entering_window, and ro_gui_wimp_event_find_window().
Referenced by ro_gui_handle_event().
|
static |
Prepare a menu ready for use.
/param w the window owning the menu /param event the icon event owning the menu
Definition at line 809 of file wimp_event.c.
References icon_event::data, event_data_menu_gright::field, icon_event::i, icon_event::menu_gright, NSLOG, ro_gui_get_icon_string(), ro_warn_user(), and text().
Referenced by ro_gui_wimp_event_menu_selection(), and ro_gui_wimp_event_mouse_click().
bool ro_gui_wimp_event_prepare_menu | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_menu * | menu | ||
) |
Trigger a window's Prepare Menu event.
w | The window to use. |
i | The icon to use. |
*menu | The menu handle to use. |
Definition at line 1239 of file wimp_event.c.
References event_window::menu_prepare, ro_gui_wimp_event_find_window(), and event_window::w.
Referenced by ro_gui_menu_refresh().
bool ro_gui_wimp_event_process_window_menu_click | ( | wimp_pointer * | pointer | ) |
Process a Menu click in a window, by checking for a registered window menu and opening it if one is found.
pointer | The pointer block from the mouse click event. |
Definition at line 1186 of file wimp_event.c.
References line_height(), event_window::menu_prepare, ro_gui_menu_create(), ro_gui_wimp_event_find_window(), event_window::w, event_window::window_menu, and event_window::window_menu_iconbar.
Referenced by ro_cw_mouse_click(), and ro_gui_wimp_event_mouse_click().
bool ro_gui_wimp_event_redraw_window | ( | wimp_draw * | redraw | ) |
Handle any redraw window requests.
redraw | the window redraw request |
Definition at line 1129 of file wimp_event.c.
References event_window::redraw_window, and ro_gui_wimp_event_find_window().
Referenced by ro_gui_handle_event().
bool ro_gui_wimp_event_register_button | ( | wimp_w | w, |
wimp_i | i, | ||
void(*)(wimp_pointer *pointer) | callback | ||
) |
Register a function to be called when a particular button is pressed.
Definition at line 1387 of file wimp_event.c.
References icon_event::callback, EVENT_BUTTON, icon_event::i, and ro_gui_wimp_event_get_event().
Referenced by ro_gui_dialog_init(), ro_gui_options_connection_initialise(), ro_gui_options_content_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_language_initialise(), and ro_gui_options_security_initialise().
bool ro_gui_wimp_event_register_cancel | ( | wimp_w | w, |
wimp_i | i | ||
) |
Register a function to be called for the Cancel action on a window.
Definition at line 1403 of file wimp_event.c.
References EVENT_CANCEL, icon_event::i, and ro_gui_wimp_event_get_event().
Referenced by query_user_xy(), ro_gui_dialog_init(), ro_gui_dialog_open_url_init(), ro_gui_options_cache_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_content_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_language_initialise(), ro_gui_options_security_initialise(), ro_gui_options_theme_initialise(), ro_gui_print_init(), and ro_gui_search_init().
bool ro_gui_wimp_event_register_checkbox | ( | wimp_w | w, |
wimp_i | i | ||
) |
Register a checkbox to be automatically handled.
Definition at line 1349 of file wimp_event.c.
References EVENT_CHECKBOX, icon_event::i, and ro_gui_wimp_event_get_event().
Referenced by ro_gui_dialog_init(), ro_gui_options_content_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_security_initialise(), ro_gui_print_init(), and ro_gui_search_init().
bool ro_gui_wimp_event_register_close_window | ( | wimp_w | w, |
void(*)(wimp_w w) | callback | ||
) |
Register a function to be called after the window has been closed.
Definition at line 1492 of file wimp_event.c.
References event_window::close_window, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_download_window_create(), gui_window_create(), query_user_xy(), ro_gui_configure_click(), ro_gui_search_init(), and theme_install_start().
bool ro_gui_wimp_event_register_help_suffix | ( | wimp_w | w, |
const char *(*)(wimp_w w, wimp_i i, os_coord *pos, wimp_mouse_state buttons) | get_help_suffix | ||
) |
Register a handler to decode help suffixes for a given window.
Definition at line 424 of file wimp_event.c.
References event_window::get_help_suffix, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_keypress | ( | wimp_w | w, |
bool(*)(wimp_key *key) | callback | ||
) |
Register a function to be called for all keypresses within a particular window.
Important: the character code passed to the callback in key->c is UTF-32 (i.e. in the range [0, &10ffff]). WIMP keys (e.g. F1) will have bit 31 set.
Definition at line 1461 of file wimp_event.c.
References event_window::keypress, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_download_window_create(), gui_window_create(), ro_corewindow_init(), ro_gui_search_init(), ro_textarea_create(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_menu | ( | wimp_w | w, |
wimp_menu * | m, | ||
bool | menu_auto, | ||
bool | position_ibar | ||
) |
Register a window menu to be (semi-)automatically handled.
w | The window to attach the menu to. |
m | The menu to be attached. |
menu_auto | true if the menu should be opened autimatically on Menu clicks with no task intervention; false to pass clicks to the window's Mouse Event handler and leave that to pass the menu click back to us for handling and menu opening. |
position_ibar | true if the menu should open in an iconbar position; false to open at the pointer. |
Definition at line 1270 of file wimp_event.c.
References ro_gui_wimp_event_get_window(), event_window::w, event_window::window_menu, event_window::window_menu_auto, and event_window::window_menu_iconbar.
Referenced by gui_window_create(), ro_cookie_init(), ro_global_history_init(), ro_gui_iconbar_initialise(), ro_hotlist_init(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_menu_close | ( | wimp_w | w, |
void(*)(wimp_w w, wimp_i i, wimp_menu *m) | callback | ||
) |
Register a function to be called before a menu is finally closed.
*w | The window for which events should be returned. |
*callback | A function to be called when the menu is closed. |
Definition at line 1624 of file wimp_event.c.
References event_window::menu_close, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create().
bool ro_gui_wimp_event_register_menu_gright | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_i | gright, | ||
wimp_menu * | menu | ||
) |
Register an icon menu to be automatically handled.
Definition at line 1331 of file wimp_event.c.
References EVENT_MENU_GRIGHT, icon_event::i, ro_gui_wimp_event_get_event(), and ro_gui_wimp_event_register_text_field().
Referenced by ro_gui_dialog_open_url_init(), ro_gui_options_connection_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_language_initialise(), ro_gui_search_init(), and ro_gui_url_bar_icon_update().
bool ro_gui_wimp_event_register_menu_prepare | ( | wimp_w | w, |
bool(*)(wimp_w w, wimp_i i, wimp_menu *m, wimp_pointer *p) | callback | ||
) |
Register a function to be called before a menu is (re-)opened.
*w | The window for which events should be returned. |
*callback | A function to be called beofre the menu is (re-)opened. |
Definition at line 1559 of file wimp_event.c.
References event_window::menu_prepare, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_cookie_init(), ro_global_history_init(), ro_gui_dialog_open_url_init(), ro_gui_options_home_initialise(), ro_gui_search_init(), ro_hotlist_init(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_menu_selection | ( | wimp_w | w, |
bool(*)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a) | callback | ||
) |
Register a function to be called following a menu selection.
*w | The window for which events should be returned. |
*callback | A function to be called when a selection is made. |
Definition at line 1581 of file wimp_event.c.
References event_window::menu_selection, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_cookie_init(), ro_global_history_init(), ro_gui_iconbar_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_image_initialise(), ro_hotlist_init(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_menu_warning | ( | wimp_w | w, |
void(*)(wimp_w w, wimp_i i, wimp_menu *m, wimp_selection *s, menu_action a) | callback | ||
) |
Register a function to be called when a sub-menu warning is received.
*w | The window for which events should be returned. |
*callback | A function to be called whenever a submenu warning is received for the menu. |
Definition at line 1603 of file wimp_event.c.
References event_window::menu_warning, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_cookie_init(), ro_global_history_init(), ro_gui_iconbar_initialise(), ro_hotlist_init(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_mouse_click | ( | wimp_w | w, |
bool(*)(wimp_pointer *pointer) | callback | ||
) |
Register a function to be called for all mouse-clicks to icons in a window that don't have registered actions.
Definition at line 1439 of file wimp_event.c.
References event_window::mouse_click, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_download_window_create(), gui_window_create(), query_user_xy(), ro_corewindow_init(), ro_gui_configure_initialise(), ro_gui_dialog_init(), ro_gui_iconbar_initialise(), ro_gui_options_cache_initialise(), ro_gui_options_image_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_theme_initialise(), ro_gui_print_init(), ro_gui_search_init(), ro_gui_status_bar_create(), ro_textarea_create(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_numeric_field | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_i | up, | ||
wimp_i | down, | ||
int | min, | ||
int | max, | ||
int | stepping, | ||
int | decimal_places | ||
) |
Register a numeric field to be automatically handled.
Definition at line 1287 of file wimp_event.c.
References EVENT_DOWN_ARROW, EVENT_NUMERIC_FIELD, EVENT_UP_ARROW, icon_event::i, max, min, and ro_gui_wimp_event_get_event().
Referenced by ro_gui_dialog_init(), ro_gui_options_cache_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_security_initialise(), and ro_gui_print_init().
bool ro_gui_wimp_event_register_ok | ( | wimp_w | w, |
wimp_i | i, | ||
bool(*)(wimp_w w) | callback | ||
) |
Register a function to be called for the OK action on a window.
Definition at line 1417 of file wimp_event.c.
References icon_event::callback, EVENT_OK, icon_event::i, event_window::ok_click, ro_gui_wimp_event_get_event(), and ro_gui_wimp_event_get_window().
Referenced by query_user_xy(), ro_gui_dialog_init(), ro_gui_dialog_open_url_init(), ro_gui_options_cache_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_content_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_language_initialise(), ro_gui_options_security_initialise(), ro_gui_options_theme_initialise(), ro_gui_print_init(), and ro_gui_search_init().
bool ro_gui_wimp_event_register_open_window | ( | wimp_w | w, |
void(*)(wimp_open *open) | callback | ||
) |
Register a function to be called for all window opening requests.
Definition at line 1477 of file wimp_event.c.
References event_window::open_window, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_corewindow_init(), ro_gui_configure_initialise(), ro_gui_status_bar_create(), and ro_textarea_create().
bool ro_gui_wimp_event_register_pointer_entering_window | ( | wimp_w | w, |
void(*)(wimp_entering *entering) | callback | ||
) |
Register a function to be called for all pointer entering window requests.
Definition at line 1539 of file wimp_event.c.
References event_window::entering_window, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_corewindow_init(), and ro_gui_dialog_init().
bool ro_gui_wimp_event_register_radio | ( | wimp_w | w, |
wimp_i * | i | ||
) |
Register a group of radio icons to be automatically handled.
Definition at line 1363 of file wimp_event.c.
References EVENT_RADIO, icon_event::i, event_window::max_radio_group, ro_gui_wimp_event_get_event(), ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by ro_gui_options_theme_load(), and ro_gui_print_init().
bool ro_gui_wimp_event_register_redraw_window | ( | wimp_w | w, |
void(*)(wimp_draw *redraw) | callback | ||
) |
Register a function to be called for all window redraw operations.
Definition at line 1507 of file wimp_event.c.
References event_window::redraw_window, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by gui_window_create(), ro_corewindow_init(), ro_gui_dialog_init(), ro_gui_options_image_initialise(), ro_gui_progress_bar_create(), ro_gui_status_bar_create(), ro_textarea_create(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_register_scroll_window | ( | wimp_w | w, |
void(*)(wimp_scroll *scroll) | callback | ||
) |
Register a function to be called for all window scroll requests.
Definition at line 1523 of file wimp_event.c.
References ro_gui_wimp_event_get_window(), event_window::scroll_window, and event_window::w.
Referenced by gui_window_create(), and ro_corewindow_init().
void ro_gui_wimp_event_register_submenu | ( | wimp_w | w | ) |
Register a submenu as being opened.
Definition at line 1844 of file wimp_event.c.
References ro_gui_wimp_event_close_window(), and ro_gui_wimp_event_submenu.
Referenced by ro_gui_menu_warning(), ro_gui_wimp_event_menus_closed(), and ro_gui_wimp_event_submenu_warning().
bool ro_gui_wimp_event_register_text_field | ( | wimp_w | w, |
wimp_i | i | ||
) |
Register a text field to be automatically handled.
Definition at line 1318 of file wimp_event.c.
References EVENT_TEXT_FIELD, icon_event::i, and ro_gui_wimp_event_get_event().
Referenced by ro_gui_dialog_init(), ro_gui_options_connection_initialise(), ro_gui_print_init(), ro_gui_search_init(), and ro_gui_wimp_event_register_menu_gright().
|
static |
Removes the event data associated with a given handle from the hash tables, but does not delete it.
w | the window to be removed |
Definition at line 1675 of file wimp_event.c.
References event_window::next, ro_gui_wimp_event_windows, event_window::w, and WIN_HASH.
Referenced by ro_gui_wimp_event_finalise(), and ro_gui_wimp_event_transfer().
bool ro_gui_wimp_event_restore | ( | wimp_w | w | ) |
Restore the state of any registered components in a window to their memorised state.
w | the window to restore |
Definition at line 186 of file wimp_event.c.
References icon_event::boolean, EVENT_CHECKBOX, EVENT_MENU_GRIGHT, EVENT_NUMERIC_FIELD, EVENT_RADIO, EVENT_TEXT_FIELD, event_window::first, icon_event::i, icon_event::next, icon_event::previous_shaded, icon_event::previous_value, ro_gui_set_icon_selected_state(), ro_gui_set_icon_shaded_state(), ro_gui_set_icon_string(), ro_gui_wimp_event_find_window(), icon_event::textual, icon_event::type, and event_window::w.
Referenced by ro_gui_options_image_click(), ro_gui_options_theme_click(), and ro_gui_wimp_event_mouse_click().
bool ro_gui_wimp_event_scroll_window | ( | wimp_scroll * | scroll | ) |
Handle any scroll window requests.
scroll | the window scroll request |
Definition at line 1147 of file wimp_event.c.
References ro_gui_wimp_event_find_window(), and event_window::scroll_window.
Referenced by ro_gui_handle_event().
bool ro_gui_wimp_event_set_help_prefix | ( | wimp_w | w, |
const char * | help_prefix | ||
) |
Set the associated help prefix for a given window.
w | the window to get the prefix for |
help_prefix | the prefix to associate with the window (used directly) |
Definition at line 390 of file wimp_event.c.
References event_window::help_prefix, ro_gui_wimp_event_get_window(), and event_window::w.
Referenced by ro_gui_configure_initialise(), ro_gui_dialog_init(), ro_gui_dialog_open_url_init(), ro_gui_options_cache_initialise(), ro_gui_options_connection_initialise(), ro_gui_options_content_initialise(), ro_gui_options_fonts_initialise(), ro_gui_options_home_initialise(), ro_gui_options_image_initialise(), ro_gui_options_interface_initialise(), ro_gui_options_language_initialise(), ro_gui_options_security_initialise(), ro_gui_options_theme_initialise(), ro_gui_print_init(), ro_gui_search_init(), ro_gui_status_bar_create(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_set_user_data | ( | wimp_w | w, |
void * | user | ||
) |
Sets the user data associated with a window.
w | the window to associate the data with |
user | the data to associate |
Definition at line 467 of file wimp_event.c.
References ro_gui_wimp_event_get_window(), event_window::user_data, and event_window::w.
Referenced by gui_download_window_create(), gui_window_create(), query_user_xy(), ro_corewindow_init(), ro_gui_progress_bar_create(), ro_gui_status_bar_create(), ro_textarea_create(), and ro_toolbar_rebuild().
bool ro_gui_wimp_event_submenu_warning | ( | wimp_w | w, |
wimp_i | i, | ||
wimp_menu * | menu, | ||
wimp_selection * | selection, | ||
menu_action | action | ||
) |
Definition at line 1754 of file wimp_event.c.
References icon_event::data, EVENT_MENU_GRIGHT, event_window::first, icon_event::i, event_data_menu_gright::menu, event_window::menu_close, icon_event::menu_gright, event_window::menu_warning, icon_event::next, ro_gui_wimp_event_find_window(), ro_gui_wimp_event_register_submenu(), icon_event::type, and event_window::window_menu.
Referenced by ro_gui_menu_warning().
bool ro_gui_wimp_event_transfer | ( | wimp_w | from, |
wimp_w | to | ||
) |
Transfer event data from one window to another.
This can be used as an alternative to ro_gui_wimp_event_finalise() and re-registering, if events need to continue across a change of window handle.
All aspects of the registered events MUST remain the same in the new window!
from | The current window, which is to be deleted. |
to | The window to which the events should transfer. |
Definition at line 267 of file wimp_event.c.
References from, event_window::next, NSLOG, ro_gui_menu_window_changed(), ro_gui_wimp_event_remove_window(), ro_gui_wimp_event_windows, to, event_window::w, and WIN_HASH.
Referenced by ro_toolbar_rebuild().
bool ro_gui_wimp_event_validate | ( | wimp_w | w | ) |
Ensures all values are within pre-determined boundaries.
w | the window to memorise |
Definition at line 225 of file wimp_event.c.
References icon_event::data, event_data_numeric_field::decimal_places, EVENT_NUMERIC_FIELD, event_window::first, icon_event::i, event_data_numeric_field::max, icon_event::next, icon_event::numeric_field, ro_gui_get_icon_decimal(), ro_gui_set_icon_decimal(), ro_gui_wimp_event_find_window(), icon_event::type, and event_window::w.
Referenced by ro_gui_wimp_event_ok_click().
|
static |
Definition at line 131 of file wimp_event.c.
Referenced by ro_gui_wimp_event_close_window(), and ro_gui_wimp_event_register_submenu().
|
static |
Definition at line 129 of file wimp_event.c.
Referenced by ro_gui_wimp_event_find_window(), ro_gui_wimp_event_get_window(), ro_gui_wimp_event_remove_window(), and ro_gui_wimp_event_transfer().