NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
url_bar.c File Reference

RISC OS URL bar implementation. More...

#include <stddef.h>
#include "oslib/wimp.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/content.h"
#include "content/hlcache.h"
#include "riscos/gui.h"
#include "riscos/hotlist.h"
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
#include "riscos/ucstables.h"
#include "riscos/filetype.h"
#include "riscos/gui/url_bar.h"
Include dependency graph for url_bar.c:

Go to the source code of this file.

Data Structures

struct  url_bar
 
struct  url_bar_resource
 Treeview content resource data. More...
 

Macros

#define URLBAR_HEIGHT   52
 
#define URLBAR_FAVICON_SIZE   16
 
#define URLBAR_HOTLIST_SIZE   17
 
#define URLBAR_PGINFO_WIDTH   ((26) * 2)
 
#define URLBAR_FAVICON_WIDTH   ((5 + URLBAR_FAVICON_SIZE + 5) * 2)
 
#define URLBAR_HOTLIST_WIDTH   ((5 + URLBAR_HOTLIST_SIZE + 5) * 2)
 
#define URLBAR_MIN_WIDTH   52
 
#define URLBAR_GRIGHT_GUTTER   8
 
#define URLBAR_PGINFO_NAME_LENGTH   12
 
#define URLBAR_FAVICON_NAME_LENGTH   12
 

Enumerations

enum  url_bar_resource_id { URLBAR_RES_HOTLIST_ADD = 0 , URLBAR_RES_HOTLIST_REMOVE , URLBAR_RES_LAST }
 

Functions

static bool ro_gui_url_bar_icon_resize (struct url_bar *url_bar, bool full)
 Position the icons in the URL bar to take account of the currently configured extent. More...
 
static bool ro_gui_url_bar_icon_update (struct url_bar *url_bar)
 Create or delete a URL bar's icons if required to bring it into sync with the current hidden setting. More...
 
static void ro_gui_url_bar_set_hotlist (struct url_bar *url_bar, bool set)
 Set the state of a URL Bar's hotlist icon. More...
 
static nserror ro_gui_url_bar_res_cb (hlcache_handle *handle, const hlcache_event *event, void *pw)
 Callback for hlcache. 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...
 
static bool is_point_in_box (os_coord *pos, os_box *box)
 check if os point is inside an os box 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_page_info_change (struct url_bar *url_bar)
 Update the page info icon. 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_init (void)
 Initialise the url bar module. More...
 
void ro_gui_url_bar_fini (void)
 Finalise the url bar module. More...
 

Variables

static char text_validation [] = "Pptr_write;KN"
 
static char suggest_icon [] = "gright"
 
static char suggest_validation [] = "R5;Sgright,pgright"
 
static char null_text_string [] = ""
 
static struct url_bar_resource url_bar_res [URLBAR_RES_LAST]
 Treeview content resources. More...
 

Detailed Description

RISC OS URL bar implementation.

The treeview resources are retrieved from resource url necessitating the use of the hlcache content interface.

Definition in file url_bar.c.

Macro Definition Documentation

◆ URLBAR_FAVICON_NAME_LENGTH

#define URLBAR_FAVICON_NAME_LENGTH   12

Definition at line 59 of file url_bar.c.

◆ URLBAR_FAVICON_SIZE

#define URLBAR_FAVICON_SIZE   16

Definition at line 50 of file url_bar.c.

◆ URLBAR_FAVICON_WIDTH

#define URLBAR_FAVICON_WIDTH   ((5 + URLBAR_FAVICON_SIZE + 5) * 2)

Definition at line 53 of file url_bar.c.

◆ URLBAR_GRIGHT_GUTTER

#define URLBAR_GRIGHT_GUTTER   8

Definition at line 56 of file url_bar.c.

◆ URLBAR_HEIGHT

#define URLBAR_HEIGHT   52

Definition at line 49 of file url_bar.c.

◆ URLBAR_HOTLIST_SIZE

#define URLBAR_HOTLIST_SIZE   17

Definition at line 51 of file url_bar.c.

◆ URLBAR_HOTLIST_WIDTH

#define URLBAR_HOTLIST_WIDTH   ((5 + URLBAR_HOTLIST_SIZE + 5) * 2)

Definition at line 54 of file url_bar.c.

◆ URLBAR_MIN_WIDTH

#define URLBAR_MIN_WIDTH   52

Definition at line 55 of file url_bar.c.

◆ URLBAR_PGINFO_NAME_LENGTH

#define URLBAR_PGINFO_NAME_LENGTH   12

Definition at line 58 of file url_bar.c.

◆ URLBAR_PGINFO_WIDTH

#define URLBAR_PGINFO_WIDTH   ((26) * 2)

Definition at line 52 of file url_bar.c.

Enumeration Type Documentation

◆ url_bar_resource_id

Enumerator
URLBAR_RES_HOTLIST_ADD 
URLBAR_RES_HOTLIST_REMOVE 
URLBAR_RES_LAST 

Definition at line 127 of file url_bar.c.

Function Documentation

◆ is_point_in_box()

static bool is_point_in_box ( os_coord *  pos,
os_box *  box 
)
inlinestatic

check if os point is inside an os box

Parameters
posThe coordinate of the point
boxThe box to check against
Returns
true if point is inside the box else false

Definition at line 923 of file url_bar.c.

References box::x, and box::y.

Referenced by ro_gui_url_bar_click().

Here is the caller graph for this function:

◆ 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_icon_resize()

static bool ro_gui_url_bar_icon_resize ( struct url_bar url_bar,
bool  full 
)
static

Position the icons in the URL bar to take account of the currently configured extent.

Parameters
*url_barThe URL bar to update.
fulltrue to resize everything; false to move only the right-hand end of the bar.
Returns
true if successful; else false.

Definition at line 149 of file url_bar.c.

References url_bar::container_icon, url_bar::extent, url_bar::favicon, url_bar::hotlist, url_bar::icon, NSLOG, url_bar::offset, url_bar::pginfo, ro_convert_pixels_to_os_units(), ro_warn_user(), url_bar::suggest, url_bar::text, URLBAR_FAVICON_WIDTH, URLBAR_GRIGHT_GUTTER, URLBAR_HEIGHT, URLBAR_HOTLIST_SIZE, URLBAR_HOTLIST_WIDTH, URLBAR_PGINFO_WIDTH, url_bar::window, url_bar::x, and url_bar::y.

Referenced by ro_gui_url_bar_icon_update(), and ro_gui_url_bar_set_extent().

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

◆ ro_gui_url_bar_icon_update()

static bool ro_gui_url_bar_icon_update ( struct url_bar url_bar)
static

Create or delete a URL bar's icons if required to bring it into sync with the current hidden setting.

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

Definition at line 288 of file url_bar.c.

References url_bar::buffer, url_bar::container_icon, url_bar::display, url_bar::hidden, url_bar::icon, ns_wimp_has_text_selection(), NSLOG, null_text_string, ro_gui_set_icon_shaded_state(), ro_gui_url_bar_icon_resize(), ro_gui_url_bar_update_urlsuggest(), ro_gui_url_suggest_menu, ro_gui_wimp_event_deregister(), ro_gui_wimp_event_register_menu_gright(), ro_warn_user(), url_bar::shaded, url_bar::size, url_bar::suggest, suggest_validation, url_bar::text, text_validation, and url_bar::window.

Referenced by ro_gui_url_bar_hide(), and ro_gui_url_bar_rebuild().

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

static nserror ro_gui_url_bar_res_cb ( hlcache_handle handle,
const hlcache_event event,
void *  pw 
)
static

Callback for hlcache.

Definition at line 495 of file url_bar.c.

References content_get_height(), CONTENT_MSG_DONE, CONTENT_MSG_READY, url_bar_resource::height, NSERROR_OK, url_bar_resource::ready, and hlcache_event::type.

Referenced by ro_gui_url_bar_init().

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

static void ro_gui_url_bar_set_hotlist ( struct url_bar url_bar,
bool  set 
)
static

Set the state of a URL Bar's hotlist icon.

Parameters
*url_barThe URL Bar to update.
setTRUE to set the hotlist icon; FALSE to clear it.

Definition at line 472 of file url_bar.c.

References url_bar::extent, url_bar::hidden, url_bar::hotlist, url_bar::set, and url_bar::window.

Referenced by ro_gui_url_bar_set_url(), ro_gui_url_bar_test_for_text_field_keypress(), and ro_gui_url_bar_update_hotlist().

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:

Variable Documentation

◆ null_text_string

char null_text_string[] = ""
static

Definition at line 117 of file url_bar.c.

Referenced by ro_gui_url_bar_icon_update(), and ro_gui_url_bar_redraw().

◆ suggest_icon

char suggest_icon[] = "gright"
static

Definition at line 115 of file url_bar.c.

Referenced by ro_gui_url_bar_rebuild().

◆ suggest_validation

char suggest_validation[] = "R5;Sgright,pgright"
static

Definition at line 116 of file url_bar.c.

Referenced by ro_gui_url_bar_icon_update().

◆ text_validation

char text_validation[] = "Pptr_write;KN"
static

Definition at line 114 of file url_bar.c.

Referenced by ro_gui_url_bar_icon_update().

◆ url_bar_res

struct url_bar_resource url_bar_res[URLBAR_RES_LAST]
static
Initial value:
= {
{ "resource:icons/hotlist-add.png", NULL, 0, false },
{ "resource:icons/hotlist-rmv.png", NULL, 0, false }
}

Treeview content resources.

Definition at line 134 of file url_bar.c.

Referenced by ro_gui_url_bar_fini(), ro_gui_url_bar_init(), and ro_gui_url_bar_redraw().