NetSurf
|
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "riscos/gui.h"
#include "riscos/query.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/ucstables.h"
#include "riscos/dialog.h"
Go to the source code of this file.
Data Structures | |
struct | gui_query_window |
Data for a query window. More... | |
Macros | |
#define | ICON_QUERY_MESSAGE 0 |
#define | ICON_QUERY_YES 1 |
#define | ICON_QUERY_NO 2 |
#define | ICON_QUERY_HELP 3 |
Functions | |
static struct gui_query_window * | ro_gui_query_window_lookup_id (query_id id) |
Lookup a query window using its ID number. More... | |
static bool | ro_gui_query_click (wimp_pointer *pointer) |
Handle clicks in query dialog. More... | |
static void | ro_gui_query_close (wimp_w w) |
Handle closing of query dialog. More... | |
static bool | ro_gui_query_apply (wimp_w w) |
Handle acceptance of query dialog. More... | |
void | ro_gui_query_init (void) |
query_id | query_user (const char *query, const char *detail, const query_callback *cb, void *pw, const char *yes, const char *no) |
Display a query to the user, requesting a response, near the current pointer position to keep the required mouse travel small, but also protecting against spurious mouse clicks. More... | |
query_id | query_user_xy (const char *query, const char *detail, const query_callback *cb, void *pw, const char *yes, const char *no, int x, int y) |
Display a query to the user, requesting a response, at a specified screen position (x,y). More... | |
void | query_close (query_id id) |
Close a query window without waiting for a response from the user. More... | |
void | ro_gui_query_window_bring_to_front (query_id id) |
Variables | |
static query_id | next_id = (query_id)1 |
Next unallocated query id. More... | |
static struct gui_query_window * | gui_query_window_list = 0 |
List of all query windows. More... | |
static struct wimp_window * | query_template |
Template for a query window. More... | |
static int | query_yes_width = 0 |
Widths of Yes and No buttons. More... | |
static int | query_no_width = 0 |
void query_close | ( | query_id | id | ) |
Close a query window without waiting for a response from the user.
(should normally only be called if the user has responded in some other way of which the query window in unaware.)
id | id of query window to close |
Definition at line 293 of file query.c.
References ro_gui_query_close(), ro_gui_query_window_lookup_id(), and gui_query_window::window.
Referenced by ro_gui_download_window_destroy(), ro_gui_download_window_destroy_wrapper(), and ro_gui_hotlist_remove_page().
query_id query_user | ( | const char * | query, |
const char * | detail, | ||
const query_callback * | cb, | ||
void * | pw, | ||
const char * | yes, | ||
const char * | no | ||
) |
Display a query to the user, requesting a response, near the current pointer position to keep the required mouse travel small, but also protecting against spurious mouse clicks.
query | message token of query |
detail | parameter used in expanding tokenised message |
cb | table of callback functions to be called when user responds |
pw | handle to be passed to callback functions |
yes | text to use for 'Yes' button' (or NULL for default) |
no | text to use for 'No' button (or NULL for default) |
Definition at line 112 of file query.c.
References gui_query_window::cb, gui_query_window::pw, and query_user_xy().
Referenced by ro_gui_download_save(), ro_gui_download_window_destroy(), ro_gui_hotlist_remove_page(), and ro_gui_save_content().
query_id query_user_xy | ( | const char * | query, |
const char * | detail, | ||
const query_callback * | cb, | ||
void * | pw, | ||
const char * | yes, | ||
const char * | no, | ||
int | x, | ||
int | y | ||
) |
Display a query to the user, requesting a response, at a specified screen position (x,y).
The window is positioned relative to the given location such that the required mouse travel is small, but non-zero for protection spurious double-clicks.
query | message token of query |
detail | parameter used in expanding tokenised message |
cb | table of callback functions to be called when user responds |
pw | handle to be passed to callback functions |
yes | text to use for 'Yes' button' (or NULL for default) |
no | text to use for 'No' button (or NULL for default) |
x | x position in screen coordinates (-1 = centred on screen) |
y | y position in screen coordinates (-1 = centred on screen) |
Definition at line 142 of file query.c.
References gui_query_window::cb, gui_query_window::default_confirm, gui_query_window_list, ICON_QUERY_HELP, ICON_QUERY_MESSAGE, ICON_QUERY_NO, ICON_QUERY_YES, gui_query_window::id, max, messages_get(), gui_query_window::next, next_id, NSERROR_BAD_ENCODING, NSERROR_OK, NSLOG, gui_query_window::prev, gui_query_window::pw, QUERY_INVALID, query_no_width, query_template, query_yes_width, ro_gui_dialog_open(), ro_gui_dialog_open_xy(), ro_gui_query_apply(), ro_gui_query_click(), ro_gui_query_close(), ro_gui_set_icon_string(), ro_gui_wimp_event_register_cancel(), ro_gui_wimp_event_register_close_window(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_ok(), ro_gui_wimp_event_set_user_data(), ro_warn_user(), utf8_to_local_encoding(), width, and gui_query_window::window.
Referenced by query_user().
|
static |
Handle acceptance of query dialog.
Definition at line 357 of file query.c.
References gui_query_window::cb, query_callback::confirm, gui_query_window::id, gui_query_window::pw, QUERY_YES, and ro_gui_wimp_event_get_user_data().
Referenced by query_user_xy().
|
static |
Handle clicks in query dialog.
Definition at line 372 of file query.c.
References query_callback::cancel, gui_query_window::cb, ICON_QUERY_NO, gui_query_window::id, gui_query_window::pw, QUERY_NO, and ro_gui_wimp_event_get_user_data().
Referenced by query_user_xy().
|
static |
Handle closing of query dialog.
Definition at line 326 of file query.c.
References gui_query_window_list, gui_query_window::next, NSLOG, gui_query_window::prev, ro_gui_dialog_close(), ro_gui_wimp_event_finalise(), ro_gui_wimp_event_get_user_data(), ro_warn_user(), and gui_query_window::window.
Referenced by query_close(), and query_user_xy().
void ro_gui_query_init | ( | void | ) |
Definition at line 76 of file query.c.
References query_template, and ro_gui_dialog_load_template().
Referenced by gui_init().
void ro_gui_query_window_bring_to_front | ( | query_id | id | ) |
Definition at line 303 of file query.c.
References NSLOG, ro_gui_dialog_open(), ro_gui_query_window_lookup_id(), ro_warn_user(), and gui_query_window::window.
Referenced by ro_gui_download_window_destroy().
|
static |
Lookup a query window using its ID number.
id | id to search for |
Definition at line 89 of file query.c.
References gui_query_window_list, gui_query_window::id, and gui_query_window::next.
Referenced by query_close(), and ro_gui_query_window_bring_to_front().
|
static |
List of all query windows.
Definition at line 60 of file query.c.
Referenced by query_user_xy(), ro_gui_query_close(), and ro_gui_query_window_lookup_id().
|
static |
Definition at line 67 of file query.c.
Referenced by query_user_xy().
|
static |
Template for a query window.
Definition at line 63 of file query.c.
Referenced by query_user_xy(), and ro_gui_query_init().
|
static |