35#define ICON_QUERY_MESSAGE 0
36#define ICON_QUERY_YES 1
37#define ICON_QUERY_NO 2
38#define ICON_QUERY_HELP 3
92 while (qw && qw->
id !=
id)
114 const char *yes,
const char *no)
116 wimp_pointer pointer;
117 if (xwimp_get_pointer_info(&pointer))
118 pointer.pos.y = pointer.pos.x = -1;
121 pointer.pos.x, pointer.pos.y);
144 const char *yes,
const char *no,
148 char query_buffer[300];
154 char *local_text = NULL;
178 NSLOG(netsurf, INFO,
"utf8_to_local_encoding_failed");
183 len = strlen(local_text ? local_text : yes);
184 len =
max(len, icn->data.indirected_text.size - 1);
185 memcpy(icn->data.indirected_text.text,
186 local_text ? local_text: yes, len);
187 icn->data.indirected_text.text[len] =
'\0';
192 error = xwimptextop_string_width(icn->data.indirected_text.text, len, &
width);
194 NSLOG(netsurf, INFO,
"xwimptextop_string_width: 0x%x:%s",
195 error->errnum, error->errmess);
202 icn->extent.x0 = tx = icn->extent.x1 -
width;
208 NSLOG(netsurf, INFO,
"utf8_to_local_encoding_failed");
213 len = strlen(local_text ? local_text : no);
214 len =
max(len, icn->data.indirected_text.size - 1);
215 memcpy(icn->data.indirected_text.text,
216 local_text ? local_text : no, len);
217 icn->data.indirected_text.text[len] =
'\0';
223 icn->extent.x1 = tx - 16;
224 error = xwimptextop_string_width(icn->data.indirected_text.text, len, &
width);
226 NSLOG(netsurf, INFO,
"xwimptextop_string_width: 0x%x:%s",
227 error->errnum, error->errmess);
233 icn->extent.x0 = icn->extent.x1 -
width;
242 snprintf(query_buffer,
sizeof query_buffer,
"%s %s",
244 query_buffer[
sizeof query_buffer - 1] = 0;
250 wimp_ICON_DELETED, wimp_ICON_DELETED);
252 if (x >= 0 && y >= 0) {
266 error = xwimp_set_caret_position(qw->
window, (wimp_i)-1, 0, 0, 1 << 25, -1);
268 NSLOG(netsurf, INFO,
"xwimp_get_caret_position: 0x%x : %s",
269 error->errnum, error->errmess);
311 error = xwimp_set_caret_position(qw->
window, (wimp_i)-1, 0, 0, 1 << 25, -1);
314 "xwimp_get_caret_position: 0x%x : %s",
334 error = xwimp_delete_window(qw->
window);
336 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x:%s",
337 error->errnum, error->errmess);
380 switch (pointer->i) {
wimp_window * ro_gui_dialog_load_template(const char *template_name)
Load a template without creating a window.
void ro_gui_dialog_open(wimp_w w)
Open a dialog box, centred on the screen.
void ro_gui_dialog_close(wimp_w close)
Close a dialog box.
void ro_gui_dialog_open_xy(wimp_w w, int x, int y)
Open window at a specified location.
nserror
Enumeration of error codes.
@ NSERROR_BAD_ENCODING
The character set is unknown.
nserror utf8_to_local_encoding(const char *string, size_t len, char **result)
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
static int query_yes_width
Widths of Yes and No buttons.
void ro_gui_query_init(void)
static struct gui_query_window * gui_query_window_list
List of all query windows.
static bool ro_gui_query_click(wimp_pointer *pointer)
Handle clicks in query dialog.
void ro_gui_query_window_bring_to_front(query_id id)
#define ICON_QUERY_MESSAGE
void query_close(query_id id)
Close a query window without waiting for a response from the user.
static bool ro_gui_query_apply(wimp_w w)
Handle acceptance of query dialog.
static struct gui_query_window * ro_gui_query_window_lookup_id(query_id id)
Lookup a query window using its ID number.
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,...
static query_id next_id
Next unallocated query id.
static void ro_gui_query_close(wimp_w w)
Handle closing of query dialog.
static int query_no_width
static struct wimp_window * query_template
Template for a query window.
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 req...
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
Interface to utility string handling.
wimp_w window
unique ID number for this query
void * pw
Table of callback functions.
query_id id
Next query in list.
struct gui_query_window * next
Previous query in list.
const query_callback * cb
RISC OS window handle.
bool default_confirm
Handle passed to callback functions.
struct gui_query_window * prev
void(* cancel)(query_id, enum query_response res, void *pw)
void(* confirm)(query_id id, enum query_response res, void *pw)
UCS conversion tables (interface) This is only used if nothing claims Service_International,...
UTF-8 manipulation functions (interface).
Interface to a number of general purpose functionality.
void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text, bool is_utf8)
Set the contents of a text or sprite icon to a string.
General RISC OS WIMP/OS library functions (interface).
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
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.
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...
bool ro_gui_wimp_event_set_user_data(wimp_w w, void *user)
Sets the user data associated with a window.
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.
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.
Automated RISC OS WIMP event handling (interface).