NetSurf
Enumerations | Functions
url_bar.h File Reference

URL bars (interface). More...

#include <stdbool.h>
#include "riscos/menus.h"
#include "riscos/theme.h"
Include dependency graph for url_bar.h:
This graph shows which files directly or indirectly include this file:

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_barro_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...
 

Detailed Description

URL bars (interface).

Definition in file url_bar.h.

Enumeration Type Documentation

◆ url_bar_action

Enumerator
TOOLBAR_URL_NONE 
TOOLBAR_URL_DRAG_URL 
TOOLBAR_URL_DRAG_FAVICON 
TOOLBAR_URL_SELECT_HOTLIST 
TOOLBAR_URL_ADJUST_HOTLIST 
TOOLBAR_URL_SELECT_PGINFO 
TOOLBAR_URL_ADJUST_PGINFO 

Definition at line 33 of file url_bar.h.

Function Documentation

◆ ro_gui_url_bar_click()

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.

Parameters
*url_barThe URL bar to use.
*pointerThe Wimp mouse click event data.
*stateThe toolbar window state.
*actionReturns the selected action, or TOOLBAR_URL_NONE.
Returns
true if the event was handled exclusively; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_create()

struct url_bar * ro_gui_url_bar_create ( struct theme_descriptor theme)

Create a new url bar widget.

Parameters
*themeThe theme to apply (or NULL for the default).
Returns
A url bar handle, or NULL on failure.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_destroy()

void ro_gui_url_bar_destroy ( struct url_bar url_bar)

Destroy a url bar widget.

Parameters
*url_barThe 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().

Here is the caller graph for this function:

◆ ro_gui_url_bar_fini()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_get_dims()

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.

Parameters
*url_barThe URL bar of interest.
*widthReturn the required width.
*heightReturn the required height.
Returns
true if values are returned; else false.

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().

Here is the caller graph for this function:

◆ ro_gui_url_bar_get_url()

const char * ro_gui_url_bar_get_url ( struct url_bar url_bar)

Return a pointer to the URL contained in a URL bar.

Parameters
*url_barThe URL Bar to look up the URL from.
Returns
Pointer to the URL, or NULL.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_get_url_extent()

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.

Parameters
*url_barThe URL bar to check.
*extentReturns the field extent.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_help_suffix()

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.

Parameters
*url_barThe URL bar to process.
iThe wimp icon under the pointer.
*mouseThe mouse position.
*stateThe toolbar window state.
buttonsThe mouse button state.
**suffixReturn a help token suffix, or "" for none.
Returns
true if handled exclusively; else false.

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().

Here is the caller graph for this function:

◆ ro_gui_url_bar_hide()

bool ro_gui_url_bar_hide ( struct url_bar url_bar,
bool  hide 
)

Show or hide a URL bar.

Parameters
*url_barThe URL bar to hide.
hidetrue to hide the bar; false to show it.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_init()

bool ro_gui_url_bar_init ( void  )

Initialise the url bar module.

Returns
True iff success, else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_menu_prepare()

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.

Parameters
*url_barThe URL bar in question.
iThe icon owning the menu.
*menuThe menu to be prepared.
*pointerThe Wimp Pointer data from the event.
Returns
true if the event is claimed; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_menu_select()

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.

Parameters
*url_barThe URL bar in question.
iThe icon owning the menu.
*menuThe menu to be prepared.
*selectionThe wimp menu selection data.
actionThe selected menu action.
Returns
true if the event is claimed; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_page_info_change()

bool ro_gui_url_bar_page_info_change ( struct url_bar url_bar)

Update the page info icon.

Parameters
url_barThe URL bar to update.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_rebuild()

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.

Parameters
*url_barThe URL bar to rebuild.
*themeThe theme to apply (or NULL for current).
styleThe theme style to apply.
windowThe window that the bar is in.
displaytrue if the bar should be for display only.
shadedtrue if the bar should be shaded; else false.
Returns
true on success; 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_redraw()

void ro_gui_url_bar_redraw ( struct url_bar url_bar,
wimp_draw *  redraw 
)

Handle redraw event rectangles in a URL bar.

Parameters
*url_barThe URL bar to use.
*redrawThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_set_content_favicon()

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.

Parameters
*url_barThe URL Bar to update the favicon on.
*gThe window with the content to use.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_set_extent()

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.

Parameters
*url_barThe URL bar to update.
x0The minimum X window position.
y0The minimum Y window position.
x1The maximum X window position.
y1The maximum Y window position.
Returns
true if size updated; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_set_site_favicon()

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.

Parameters
*url_barThe URL Bar to update the favicon on.
*hThe content to use, or NULL to unset.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_set_url()

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.

Parameters
*url_barThe URL Bar to update.
*urlThe new url to insert.
is_utf8true if the string is in utf8 encoding; false if it is in local encoding.
set_carettrue 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_take_caret()

bool ro_gui_url_bar_take_caret ( struct url_bar url_bar)

Give a URL bar input focus.

Parameters
*url_barThe URL bar to give focus to.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_test_for_text_field_click()

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.

Parameters
url_barThe URL Bar to test.
pointerThe pointer event data to test.
Returns
true if the click was in the field; else false.

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().

Here is the caller graph for this function:

◆ ro_gui_url_bar_test_for_text_field_keypress()

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.

Parameters
url_barThe URL Bar to test.
keyThe key pressed
Returns
true if the keypress was in the field; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_update_hotlist()

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.

Parameters
*url_barThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_url_bar_update_urlsuggest()

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.

Parameters
*url_barThe URL bar to update.
Returns
true if successful; else false.

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().

Here is the call graph for this function:
Here is the caller graph for this function: