29#include "oslib/dragasprite.h"
31#include "oslib/osgbpb.h"
32#include "oslib/osfile.h"
33#include "oslib/osfind.h"
34#include "oslib/osspriteop.h"
35#include "oslib/wimpspriteop.h"
36#include "oslib/squash.h"
37#include "oslib/wimp.h"
38#include "oslib/wimpextend.h"
39#include "oslib/wimpspriteop.h"
63#define TOOLBAR_WIDGET_GUTTER 8
64#define TOOLBAR_DEFAULT_WIDTH 16384
69#define TOOLBAR_ROW_TOP 0
70#define TOOLBAR_ROW_DIV1 1
71#define TOOLBAR_ROW_EDIT 2
72#define TOOLBAR_MAX_ROWS 3
149 wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_NO_BOUNDS |
150 wimp_WINDOW_FURNITURE_WINDOW |
151 wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT,
153 wimp_COLOUR_LIGHT_GREY,
154 wimp_COLOUR_LIGHT_GREY,
155 wimp_COLOUR_VERY_LIGHT_GREY,
156 wimp_COLOUR_DARK_GREY,
157 wimp_COLOUR_MID_LIGHT_GREY,
159 wimp_WINDOW_NEVER3D | 0x16u ,
162 wimp_BUTTON_DOUBLE_CLICK_DRAG << wimp_ICON_BUTTON_TYPE_SHIFT,
186 wimp_pointer *pointer);
202 static const struct ns_menu toolbar_definition = {
213 &toolbar_definition);
230 NSLOG(netsurf, INFO,
"No memory for malloc()");
349 wimp_icon_create icon;
350 wimp_w old_window = NULL;
369 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x: %s",
370 error->errnum, error->errmess);
379 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
380 error->errnum, error->errmess);
391 if (old_window == NULL) {
482 icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
483 wimp_ICON_VCENTRED | wimp_ICON_BORDER |
484 (wimp_COLOUR_BLACK <<
485 wimp_ICON_FG_COLOUR_SHIFT) |
486 (wimp_COLOUR_VERY_LIGHT_GREY <<
487 wimp_ICON_BG_COLOUR_SHIFT);
488 icon.icon.extent.x0 = 0;
489 icon.icon.extent.x1 = 0;
490 icon.icon.extent.y1 = 0;
491 icon.icon.extent.y0 = 0;
493 icon.icon.data.indirected_text.validation =
495 icon.icon.data.indirected_text.size = 1;
498 NSLOG(netsurf, INFO,
"xwimp_create_icon: 0x%x: %s",
499 error->errnum, error->errmess);
526 wimp_outline outline;
527 wimp_window_state state;
541 xwimp_get_window_outline(&outline);
543 xwimp_get_window_state(&state);
545 state.visible.x1 = outline.outline.x1 - 2;
546 state.visible.y0 = state.visible.y1 + 2 -
551 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
552 << wimp_CHILD_XORIGIN_SHIFT |
553 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
554 << wimp_CHILD_YORIGIN_SHIFT |
555 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
556 << wimp_CHILD_LS_EDGE_SHIFT |
557 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
558 << wimp_CHILD_BS_EDGE_SHIFT |
559 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
560 << wimp_CHILD_RS_EDGE_SHIFT |
561 wimp_CHILD_LINKS_PARENT_VISIBLE_TOP_OR_RIGHT
562 << wimp_CHILD_TS_EDGE_SHIFT);
565 "xwimp_open_window_nested: 0x%x: %s",
577 NSLOG(netsurf, INFO,
"xwimp_close_window: 0x%x: %s",
578 error->errnum, error->errmess);
591 wimp_outline outline;
592 wimp_window_state state;
594 int old_height, old_width;
609 error = xwimp_get_window_outline(&outline);
612 "xwimp_get_window_outline: 0x%x: %s",
620 outline.outline.x0 - 2;
622 }
else if (
width != -1) {
632 error = xwimp_get_window_state(&state);
635 "xwimp_get_window_state: 0x%x: %s",
664 "xwimp_get_window_state: 0x%x: %s",
727 int row_width, row_height;
823 if (row_height > 0) {
861 int left_margin, right_margin;
871 if (right_margin < left_margin + toolbar->
editor_size.x)
907 if (right_margin < left_margin + toolbar->
buttons_size.x)
920 if (right_margin < left_margin + toolbar->
url_size.x)
954 NSLOG(netsurf, INFO,
"Destroying toolbar 0x%x", (
unsigned int)
toolbar);
1011 error = xwimp_redraw_window(redraw, &more);
1013 NSLOG(netsurf, INFO,
"xwimp_redraw_window: 0x%x: %s",
1014 error->errnum, error->errmess);
1031 error = xwimp_get_rectangle(redraw, &more);
1033 NSLOG(netsurf, INFO,
"xwimp_get_rectangle: 0x%x: %s",
1034 error->errnum, error->errmess);
1053 wimp_window_state state;
1065 error = xwimp_get_window_state(&state);
1067 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
1068 error->errnum, error->errmess);
1090 &state, &action.
button)) {
1102 &state, &action.
url)) {
1114 &state, &action.
button)) {
1118 if (pointer->buttons != wimp_DRAG_SELECT &&
1119 pointer->buttons != wimp_DRAG_ADJUST) {
1190 wimp_pointer *pointer)
1337 wimp_window_state state;
1347 error = xwimp_get_window_state(&state);
1349 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
1350 error->errnum, error->errmess);
1359 pos, &state,
buttons, &suffix))
1364 pos, &state,
buttons, &suffix))
1369 pos, &state,
buttons, &suffix))
1392 while (bar != NULL) {
1441 while (bar != NULL) {
1455 if (bar->
theme == NULL) {
1610 bool is_utf8,
bool set_caret)
1635 while (bar != NULL) {
RISc OS global history interface.
Window themes(interface).
@ THEME_ELEMENT_BACKGROUND
theme_style
Theme styles, collecting groups of attributes for different locations.
Browser window handling (interface).
#define NSLOG(catname, level, logmsg, args...)
Interface to riscos cookie viewing using riscos core window.
bool ro_gui_throbber_stop(struct throbber *throbber)
Stop the amimation of a throbber.
bool ro_gui_throbber_set_extent(struct throbber *throbber, int x0, int y0, int x1, int y1)
Set or update the dimensions to be used by the throbber in RO units.
void ro_gui_throbber_destroy(struct throbber *throbber)
Destroy a throbber widget.
bool ro_gui_throbber_hide(struct throbber *throbber, bool hide)
Show or hide a throbber.
bool ro_gui_throbber_animate(struct throbber *throbber)
Start or update the amimation of a throbber.
bool ro_gui_throbber_get_dims(struct throbber *throbber, int *width, int *height)
Return the MINIMUM dimensions required by the throbber, in RO units, allowing for the current theme.
bool ro_gui_throbber_rebuild(struct throbber *throbber, struct theme_descriptor *theme, theme_style style, wimp_w window, bool shaded)
Place a throbber into a toolbar window and initialise any theme-specific settings.
struct throbber * ro_gui_throbber_create(struct theme_descriptor *theme)
Create a new throbber widget.
bool ro_gui_throbber_help_suffix(struct throbber *throbber, wimp_i i, os_coord *mouse, wimp_window_state *state, wimp_mouse_state buttons, const char **suffix)
Translate mouse data into an interactive help message for the throbber.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
File/object/selection saving (Interface).
osspriteop_area * ro_gui_theme_get_sprites(struct theme_descriptor *descriptor)
Returns a sprite area for use with the given theme.
int ro_gui_theme_get_style_element(struct theme_descriptor *descriptor, theme_style style, theme_element element)
Returns an interger element from the specified theme, or the current theme if the descriptor is NULL.
bool ro_gui_theme_get_throbber_data(struct theme_descriptor *descriptor, int *frames, int *width, int *height, bool *right, bool *redraw)
Returns details of the throbber as defined in a theme.
static BList * callbacks
List of all callbacks.
Interface to utility string handling.
first entry in window list
bool ro_gui_url_bar_test_for_text_field_click(struct url_bar *url_bar, wimp_pointer *pointer)
Test a pointer click to see if it was in the URL bar's text field.
bool ro_gui_url_bar_page_info_change(struct url_bar *url_bar)
Update the page info icon.
bool ro_gui_url_bar_get_url_extent(struct url_bar *url_bar, os_box *extent)
Return the current work area coordinates of the URL and favicon field's bounding box.
bool ro_gui_url_bar_take_caret(struct url_bar *url_bar)
Give a URL bar input focus.
bool ro_gui_url_bar_set_extent(struct url_bar *url_bar, int x0, int y0, int x1, int y1)
Set or update the dimensions to be used by the URL bar, in RO units.
const char * ro_gui_url_bar_get_url(struct url_bar *url_bar)
Return a pointer to the URL contained in a URL bar.
void ro_gui_url_bar_redraw(struct url_bar *url_bar, wimp_draw *redraw)
Handle redraw event rectangles in a URL bar.
bool ro_gui_url_bar_hide(struct url_bar *url_bar, bool hide)
Show or hide a URL bar.
bool ro_gui_url_bar_menu_prepare(struct url_bar *url_bar, wimp_i i, wimp_menu *menu, wimp_pointer *pointer)
Process offered menu prepare events from the parent window.
void ro_gui_url_bar_set_url(struct url_bar *url_bar, const char *url, bool is_utf8, bool set_caret)
Set the content of a URL Bar field.
bool ro_gui_url_bar_get_dims(struct url_bar *url_bar, int *width, int *height)
Return the MINIMUM dimensions required by the URL bar, in RO units, allowing for the current theme.
bool ro_gui_url_bar_set_site_favicon(struct url_bar *url_bar, struct hlcache_handle *h)
Set the favicon to a site supplied favicon image, or remove the image and return to using filetype-ba...
bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar, wimp_key *key)
Test a keypress to see if it was in the URL bar's text field.
void ro_gui_url_bar_update_hotlist(struct url_bar *url_bar)
Update the state of a URL Bar's hotlist icon to reflect any changes to the URL or the contents of the...
struct url_bar * ro_gui_url_bar_create(struct theme_descriptor *theme)
Create a new url bar widget.
bool ro_gui_url_bar_rebuild(struct url_bar *url_bar, struct theme_descriptor *theme, theme_style style, wimp_w window, bool display, bool shaded)
Place a URL bar into a toolbar window and initialise any theme-specific settings.
bool ro_gui_url_bar_set_content_favicon(struct url_bar *url_bar, struct gui_window *g)
Set the favicon to a RISC OS filetype sprite based on the type of the content within the supplied win...
bool ro_gui_url_bar_update_urlsuggest(struct url_bar *url_bar)
Update the state of the URL suggestion pop-up menu icon on a URL bar.
bool ro_gui_url_bar_help_suffix(struct url_bar *url_bar, wimp_i i, os_coord *mouse, wimp_window_state *state, wimp_mouse_state buttons, const char **suffix)
Translate mouse data into an interactive help message for the URL bar.
bool ro_gui_url_bar_menu_select(struct url_bar *url_bar, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action)
Process offered menu select events from the parent window.
bool ro_gui_url_bar_click(struct url_bar *url_bar, wimp_pointer *pointer, wimp_window_state *state, url_bar_action *action)
Handle mouse clicks in a URL bar.
void ro_gui_url_bar_destroy(struct url_bar *url_bar)
Destroy a url bar widget.
void ro_gui_url_complete_start(struct toolbar *toolbar)
Should be called when the caret is placed into a URL completion icon.
bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
Handles a keypress for URL completion.
bool ro_gui_url_complete_close(void)
Try to close the current url completion window.
Central repository for URL data (interface).
Option reading and saving interface.
General RISC OS WIMP/OS library functions (interface).
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.
bool ro_gui_wimp_event_set_help_prefix(wimp_w w, const char *help_prefix)
Set the associated help prefix for a given window.
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.
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_transfer(wimp_w from, wimp_w to)
Transfer event data from one window to another.
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.
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_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.
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_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.
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.
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.
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)