NetSurf
|
URL bars (interface). More...
Go to the source code of this file.
Enumerations | |
enum | url_bar_action { TOOLBAR_URL_NONE = 0 , TOOLBAR_URL_DRAG_URL , TOOLBAR_URL_DRAG_FAVICON , TOOLBAR_URL_SELECT_HOTLIST , TOOLBAR_URL_ADJUST_HOTLIST , TOOLBAR_URL_SELECT_PGINFO , TOOLBAR_URL_ADJUST_PGINFO } |
Functions | |
bool | ro_gui_url_bar_init (void) |
Initialise the url bar module. More... | |
void | ro_gui_url_bar_fini (void) |
Finalise the url bar module. More... | |
struct url_bar * | ro_gui_url_bar_create (struct theme_descriptor *theme) |
Create a new url bar widget. More... | |
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. More... | |
void | ro_gui_url_bar_destroy (struct url_bar *url_bar) |
Destroy a url bar widget. More... | |
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. More... | |
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. More... | |
bool | ro_gui_url_bar_hide (struct url_bar *url_bar, bool hide) |
Show or hide a URL bar. More... | |
void | ro_gui_url_bar_redraw (struct url_bar *url_bar, wimp_draw *redraw) |
Handle redraw event rectangles in a URL bar. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
bool | ro_gui_url_bar_take_caret (struct url_bar *url_bar) |
Give a URL bar input focus. More... | |
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. More... | |
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 hotlist. More... | |
const char * | ro_gui_url_bar_get_url (struct url_bar *url_bar) |
Return a pointer to the URL contained in a URL bar. More... | |
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. More... | |
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. More... | |
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. More... | |
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-based icons. More... | |
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 window. More... | |
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. More... | |
bool | ro_gui_url_bar_page_info_change (struct url_bar *url_bar) |
Update the page info icon. More... | |
URL bars (interface).
Definition in file url_bar.h.
enum url_bar_action |
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.
*url_bar | The URL bar to use. |
*pointer | The Wimp mouse click event data. |
*state | The toolbar window state. |
*action | Returns the selected action, or TOOLBAR_URL_NONE. |
Definition at line 936 of file url_bar.c.
References url_bar::display, url_bar::extent, url_bar::favicon, url_bar::hidden, url_bar::hotlist, url_bar::icon, is_point_in_box(), ns_wimp_has_text_selection(), url_bar::pginfo, url_bar::shaded, url_bar::text, TOOLBAR_URL_ADJUST_HOTLIST, TOOLBAR_URL_ADJUST_PGINFO, TOOLBAR_URL_DRAG_FAVICON, TOOLBAR_URL_DRAG_URL, TOOLBAR_URL_SELECT_HOTLIST, and TOOLBAR_URL_SELECT_PGINFO.
Referenced by ro_toolbar_click().
struct url_bar * ro_gui_url_bar_create | ( | struct theme_descriptor * | theme | ) |
Create a new url bar widget.
*theme | The theme to apply (or NULL for the default). |
Definition at line 516 of file url_bar.c.
References url_bar::buffer, url_bar::buffer_utf8, url_bar::container_icon, url_bar::content, url_bar::display, url_bar::extent, url_bar::favicon, url_bar::height, url_bar::hidden, url_bar::hotlist, url_bar::icon, NSLOG, url_bar::pginfo, RO_GUI_MAX_URL_SIZE, ro_gui_theme_get_sprites(), url_bar::set, url_bar::shaded, url_bar::size, url_bar::sprite, url_bar::sprites, url_bar::suggest, url_bar::text, url_bar::theme, url_bar::type, URLBAR_FAVICON_NAME_LENGTH, URLBAR_FAVICON_WIDTH, URLBAR_HEIGHT, URLBAR_HOTLIST_WIDTH, URLBAR_MIN_WIDTH, URLBAR_PGINFO_NAME_LENGTH, url_bar::width, url_bar::window, url_bar::x_min, and url_bar::y_min.
Referenced by ro_toolbar_add_url().
void ro_gui_url_bar_destroy | ( | struct url_bar * | url_bar | ) |
Destroy a url bar widget.
*url_bar | The url bar to destroy. |
Definition at line 634 of file url_bar.c.
References url_bar::buffer, url_bar::buffer_utf8, and url_bar::text.
Referenced by ro_toolbar_destroy(), and ro_toolbar_rebuild().
void ro_gui_url_bar_fini | ( | void | ) |
Finalise the url bar module.
Definition at line 1603 of file url_bar.c.
References hlcache_handle_release(), url_bar_res, and URLBAR_RES_LAST.
Referenced by gui_quit().
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.
*url_bar | The URL bar of interest. |
*width | Return the required width. |
*height | Return the required height. |
Definition at line 653 of file url_bar.c.
References height, width, url_bar::x_min, and url_bar::y_min.
Referenced by ro_toolbar_refresh_widget_dimensions().
const char * ro_gui_url_bar_get_url | ( | struct url_bar * | url_bar | ) |
Return a pointer to the URL contained in a URL bar.
*url_bar | The URL Bar to look up the URL from. |
Definition at line 1280 of file url_bar.c.
References url_bar::buffer, url_bar::buffer_utf8, NSERROR_OK, url_bar::text, and utf8_from_local_encoding().
Referenced by ro_toolbar_get_url().
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.
*url_bar | The URL bar to check. |
*extent | Returns the field extent. |
Definition at line 1309 of file url_bar.c.
References url_bar::container_icon, url_bar::hidden, NSLOG, ro_warn_user(), gui_window::state, and url_bar::window.
Referenced by ro_toolbar_get_url_field_extent().
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.
*url_bar | The URL bar to process. |
i | The wimp icon under the pointer. |
*mouse | The mouse position. |
*state | The toolbar window state. |
buttons | The mouse button state. |
**suffix | Return a help token suffix, or "" for none. |
Definition at line 1081 of file url_bar.c.
References url_bar::extent, url_bar::favicon, url_bar::hidden, url_bar::hotlist, url_bar::icon, gui_window::mouse, gui_window::state, url_bar::suggest, and url_bar::text.
Referenced by ro_toolbar_get_help_suffix().
bool ro_gui_url_bar_hide | ( | struct url_bar * | url_bar, |
bool | hide | ||
) |
Show or hide a URL bar.
*url_bar | The URL bar to hide. |
hide | true to hide the bar; false to show it. |
Definition at line 732 of file url_bar.c.
References url_bar::hidden, and ro_gui_url_bar_icon_update().
Referenced by ro_toolbar_set_display_url().
bool ro_gui_url_bar_init | ( | void | ) |
Initialise the url bar module.
Definition at line 1578 of file url_bar.c.
References CONTENT_IMAGE, hlcache_handle_retrieve(), NSERROR_OK, nsurl_create(), nsurl_unref(), ro_gui_url_bar_res_cb(), url_bar_res, and URLBAR_RES_LAST.
Referenced by gui_init().
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.
*url_bar | The URL bar in question. |
i | The icon owning the menu. |
*menu | The menu to be prepared. |
*pointer | The Wimp Pointer data from the event. |
Definition at line 1013 of file url_bar.c.
References url_bar::icon, ro_gui_url_suggest_menu, ro_gui_url_suggest_prepare_menu(), and url_bar::suggest.
Referenced by ro_toolbar_menu_prepare().
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.
*url_bar | The URL bar in question. |
i | The icon owning the menu. |
*menu | The menu to be prepared. |
*selection | The wimp menu selection data. |
action | The selected menu action. |
Definition at line 1034 of file url_bar.c.
References browser_window_navigate(), gui_window::bw, BW_NAVIGATE_HISTORY, url_bar::icon, messages_get_errorcode(), NSERROR_OK, nsurl_create(), nsurl_unref(), ro_gui_toolbar_lookup(), ro_gui_url_suggest_get_selection(), ro_gui_url_suggest_menu, ro_gui_window_set_url(), ro_warn_user(), url_bar::suggest, gui_window::url, and url_bar::window.
Referenced by ro_toolbar_menu_select().
bool ro_gui_url_bar_page_info_change | ( | struct url_bar * | url_bar | ) |
Update the page info icon.
url_bar | The URL bar to update. |
Definition at line 1455 of file url_bar.c.
References browser_window_get_page_info_state(), gui_window::bw, url_bar::extent, url_bar::hidden, PAGE_STATE_INSECURE, PAGE_STATE_INTERNAL, PAGE_STATE_LOCAL, PAGE_STATE_SECURE, PAGE_STATE_SECURE_ISSUES, PAGE_STATE_SECURE_OVERRIDE, url_bar::pginfo, ro_gui_toolbar_lookup(), url_bar::sprite, URLBAR_PGINFO_NAME_LENGTH, and url_bar::window.
Referenced by ro_toolbar_page_info_change().
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.
Any previous incarnation of the bar will be forgotten: this is for use when a new toolbar is being created, or when a toolbar has been deleted and rebuilt following a theme change.
*url_bar | The URL bar to rebuild. |
*theme | The theme to apply (or NULL for current). |
style | The theme style to apply. |
window | The window that the bar is in. |
display | true if the bar should be for display only. |
shaded | true if the bar should be shaded; else false. |
Definition at line 593 of file url_bar.c.
References url_bar::container_icon, url_bar::display, url_bar::icon, ro_gui_url_bar_icon_update(), ro_gui_wimp_get_sprite_dimensions(), url_bar::shaded, url_bar::suggest, suggest_icon, url_bar::text, url_bar::theme, URLBAR_FAVICON_WIDTH, URLBAR_GRIGHT_GUTTER, URLBAR_HEIGHT, URLBAR_HOTLIST_WIDTH, URLBAR_MIN_WIDTH, URLBAR_PGINFO_WIDTH, url_bar::window, url_bar::x, url_bar::x_min, url_bar::y, and url_bar::y_min.
Referenced by ro_toolbar_rebuild().
void ro_gui_url_bar_redraw | ( | struct url_bar * | url_bar, |
wimp_draw * | redraw | ||
) |
Handle redraw event rectangles in a URL bar.
*url_bar | The URL bar to use. |
*redraw | The Wimp redraw rectangle to process. |
Definition at line 744 of file url_bar.c.
References content_redraw_data::background_colour, url_bar_resource::c, clip(), url_bar::content, content_redraw(), url_bar::extent, url_bar::favicon, url_bar::height, content_redraw_data::height, url_bar::hidden, url_bar::hotlist, url_bar::icon, redraw_context::interactive, null_text_string, url_bar::offset, url_bar::pginfo, url_bar_resource::ready, content_redraw_data::repeat_x, content_redraw_data::repeat_y, ro_plot_origin_x, ro_plot_origin_y, ro_plotters, content_redraw_data::scale, url_bar::set, url_bar::sprite, url_bar::sprites, url_bar_res, URLBAR_HOTLIST_SIZE, URLBAR_RES_HOTLIST_ADD, URLBAR_RES_HOTLIST_REMOVE, url_bar::width, content_redraw_data::width, content_redraw_data::x, and content_redraw_data::y.
Referenced by ro_toolbar_redraw().
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 window.
*url_bar | The URL Bar to update the favicon on. |
*g | The window with the content to use. |
Definition at line 1508 of file url_bar.c.
References browser_window_get_content(), gui_window::bw, url_bar::content, url_bar::extent, url_bar::favicon, url_bar::hidden, ro_content_filetype(), ro_gui_wimp_sprite_exists(), url_bar::sprite, type, url_bar::type, URLBAR_FAVICON_NAME_LENGTH, and url_bar::window.
Referenced by ro_toolbar_set_content_favicon().
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.
If these are greater than the minimum required, the URL bar will fill the extended space; if less, the call will fail.
*url_bar | The URL bar to update. |
x0 | The minimum X window position. |
y0 | The minimum Y window position. |
x1 | The maximum X window position. |
y1 | The maximum Y window position. |
Definition at line 677 of file url_bar.c.
References url_bar::extent, url_bar::hidden, ro_gui_url_bar_icon_resize(), URLBAR_FAVICON_WIDTH, URLBAR_PGINFO_WIDTH, url_bar::window, url_bar::x_min, and url_bar::y_min.
Referenced by ro_toolbar_reformat_widgets().
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-based icons.
*url_bar | The URL Bar to update the favicon on. |
*h | The content to use, or NULL to unset. |
Definition at line 1394 of file url_bar.c.
References url_bar::content, content_get_height(), content_get_type(), content_get_width(), CONTENT_IMAGE, CONTENT_NONE, url_bar::extent, url_bar::favicon, url_bar::height, url_bar::hidden, url_bar::offset, url_bar::sprite, type, url_bar::type, URLBAR_FAVICON_NAME_LENGTH, URLBAR_FAVICON_SIZE, url_bar::width, and url_bar::window.
Referenced by ro_toolbar_set_site_favicon().
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.
*url_bar | The URL Bar to update. |
*url | The new url to insert. |
is_utf8 | true if the string is in utf8 encoding; false if it is in local encoding. |
set_caret | true if the caret should be placed in the field; else false. |
Definition at line 1160 of file url_bar.c.
References url_bar::buffer, gui_window::caret, url_bar::icon, NSERROR_BAD_ENCODING, NSERROR_OK, NSLOG, nsurl_create(), nsurl_unref(), ro_gui_get_icon_string(), ro_gui_hotlist_has_page(), ro_gui_redraw_icon, ro_gui_url_bar_set_hotlist(), ro_warn_user(), url_bar::size, url_bar::text, gui_window::url, utf8_to_local_encoding(), and url_bar::window.
Referenced by ro_toolbar_set_url().
bool ro_gui_url_bar_take_caret | ( | struct url_bar * | url_bar | ) |
Give a URL bar input focus.
*url_bar | The URL bar to give focus to. |
Definition at line 1134 of file url_bar.c.
References url_bar::hidden, url_bar::icon, NSLOG, ro_warn_user(), url_bar::text, and url_bar::window.
Referenced by ro_toolbar_take_caret().
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.
url_bar | The URL Bar to test. |
pointer | The pointer event data to test. |
Definition at line 1344 of file url_bar.c.
References url_bar::hidden, url_bar::icon, url_bar::text, and url_bar::window.
Referenced by ro_toolbar_click().
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.
url_bar | The URL Bar to test. |
key | The key pressed |
Definition at line 1360 of file url_bar.c.
References url_bar::buffer, url_bar::hidden, url_bar::hotlist, url_bar::icon, NSERROR_OK, nsurl_create(), nsurl_unref(), ro_gui_hotlist_has_page(), ro_gui_url_bar_set_hotlist(), url_bar::set, url_bar::text, gui_window::url, and url_bar::window.
Referenced by ro_toolbar_keypress().
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 hotlist.
*url_bar | The URL Bar to update. |
Definition at line 1261 of file url_bar.c.
References url_bar::buffer, NSERROR_OK, nsurl_create(), nsurl_unref(), ro_gui_hotlist_has_page(), ro_gui_url_bar_set_hotlist(), url_bar::text, and gui_window::url.
Referenced by ro_toolbar_update_hotlist().
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.
*url_bar | The URL bar to update. |
Definition at line 1559 of file url_bar.c.
References url_bar::hidden, url_bar::icon, ro_gui_set_icon_shaded_state(), ro_gui_url_suggest_get_menu_available(), url_bar::suggest, and url_bar::window.
Referenced by ro_gui_url_bar_icon_update(), and ro_toolbar_update_urlsuggest().