NetSurf
|
Window toolbars (implementation). More...
#include <alloca.h>
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "oslib/dragasprite.h"
#include "oslib/os.h"
#include "oslib/osgbpb.h"
#include "oslib/osfile.h"
#include "oslib/osfind.h"
#include "oslib/osspriteop.h"
#include "oslib/wimpspriteop.h"
#include "oslib/squash.h"
#include "oslib/wimp.h"
#include "oslib/wimpextend.h"
#include "utils/log.h"
#include "utils/nsoption.h"
#include "riscos/cookies.h"
#include "riscos/dialog.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/gui/button_bar.h"
#include "riscos/gui/throbber.h"
#include "riscos/gui/url_bar.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/save.h"
#include "riscos/theme.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/window.h"
Go to the source code of this file.
Data Structures | |
struct | toolbar |
Macros | |
#define | TOOLBAR_WIDGET_GUTTER 8 |
#define | TOOLBAR_DEFAULT_WIDTH 16384 |
#define | TOOLBAR_ROW_TOP 0 |
#define | TOOLBAR_ROW_DIV1 1 |
#define | TOOLBAR_ROW_EDIT 2 |
#define | TOOLBAR_MAX_ROWS 3 |
Functions | |
static void | ro_toolbar_update_current_widgets (struct toolbar *toolbar) |
Update the widgets currently on view in a toolbar. More... | |
static void | ro_toolbar_refresh_widget_dimensions (struct toolbar *toolbar) |
Get the minimum dimenstions required by the toolbar widgets after these have changed. More... | |
static void | ro_toolbar_reformat_widgets (struct toolbar *toolbar) |
Reformat (reflow) the widgets into the toolbar, based on the toolbar size and the previously calculated widget dimensions. More... | |
static void | ro_toolbar_redraw (wimp_draw *redraw) |
Handle redraw request events for a toolbar workarea. More... | |
static bool | ro_toolbar_click (wimp_pointer *pointer) |
Process clicks on a toolbar, passing details on to clients where necessary. More... | |
static bool | ro_toolbar_keypress (wimp_key *key) |
Process keypresses in a toolbar, passing details on to clients where necessary. More... | |
static bool | ro_toolbar_menu_prepare (wimp_w w, wimp_i i, wimp_menu *menu, wimp_pointer *pointer) |
Prepare the toolbar menu for (re-)opening. More... | |
static void | ro_toolbar_menu_warning (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
Handle submenu warnings for the toolbar menu. More... | |
static bool | ro_toolbar_menu_select (wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action) |
Handle selections from the toolbar menu. More... | |
static const char * | ro_toolbar_get_help_suffix (wimp_w w, wimp_i i, os_coord *pos, wimp_mouse_state buttons) |
Translate the contents of a message_HELP_REQUEST into a suffix for a NetSurf message token. More... | |
static void | ro_toolbar_update_buttons (struct toolbar *toolbar) |
Update the state of a toolbar's buttons. More... | |
void | ro_toolbar_init (void) |
Initialise the RISC OS toolbar widget. More... | |
struct toolbar * | ro_toolbar_create (struct theme_descriptor *descriptor, wimp_w parent, theme_style style, toolbar_flags bar_flags, const struct toolbar_callbacks *callbacks, void *client_data, const char *help) |
Create a new toolbar, ready to have widgets added and to be attached to a window. More... | |
bool | ro_toolbar_add_buttons (struct toolbar *toolbar, const struct button_bar_buttons buttons[], char *button_order) |
Add a button bar to a toolbar, and configure the buttons. More... | |
bool | ro_toolbar_add_throbber (struct toolbar *toolbar) |
Add a throbber to a toolbar. More... | |
bool | ro_toolbar_add_url (struct toolbar *toolbar) |
Add a URL bar to a toolbar. More... | |
bool | ro_toolbar_rebuild (struct toolbar *toolbar) |
(Re-)build a toolbar to use the specified (or current) theme. More... | |
bool | ro_toolbar_attach (struct toolbar *toolbar, wimp_w parent) |
Attach or re-attach a toolbar to its parent window. More... | |
bool | ro_toolbar_process (struct toolbar *toolbar, int width, bool reformat) |
Process a toolbar, updating its contents for a size or content change. More... | |
void | ro_toolbar_destroy (struct toolbar *toolbar) |
Destroy a toolbar after use. More... | |
void | ro_toolbar_update_client_data (struct toolbar *toolbar, void *client_data) |
Change the client data associated with a toolbar's callbacks. More... | |
void | ro_toolbar_update_all_buttons (void) |
Force the update of all toolbars buttons to reflect the current state. More... | |
void | ro_toolbar_refresh (struct toolbar *toolbar) |
Refresh a toolbar after it has been updated. More... | |
void | ro_toolbar_theme_update (void) |
Force the update of all toolbars to reflect the application of a new theme. More... | |
struct toolbar * | ro_toolbar_parent_window_lookup (wimp_w w) |
Find the toolbar associated with a given RO window handle. More... | |
struct toolbar * | ro_toolbar_window_lookup (wimp_w w) |
Find the toolbar using a given RO window handle for its pane. More... | |
wimp_w | ro_toolbar_get_parent_window (struct toolbar *toolbar) |
Return the RO window handle of the parent window for a toolbar. More... | |
wimp_w | ro_toolbar_get_window (struct toolbar *toolbar) |
Return the RO window handle of a toolbar. More... | |
int | ro_toolbar_height (struct toolbar *toolbar) |
Return the current height of a toolbar, allowing for available window space. More... | |
int | ro_toolbar_full_height (struct toolbar *toolbar) |
Return the full height that a toolbar could grow to, if space is available. More... | |
void | ro_toolbar_start_throbbing (struct toolbar *toolbar) |
Starts a toolbar throbber, if there is one active. More... | |
void | ro_toolbar_stop_throbbing (struct toolbar *toolbar) |
Stops a toolbar throbber, if there is one active. More... | |
void | ro_toolbar_page_info_change (struct toolbar *toolbar) |
Update the page information indicator. More... | |
void | ro_toolbar_throb (struct toolbar *toolbar) |
Animate a toolbar throbber, if there is one active. More... | |
bool | ro_toolbar_set_button_order (struct toolbar *toolbar, char order[]) |
Change the arrangement of buttons and spacers on a button bar within a toolbar. More... | |
void | ro_toolbar_set_button_shaded_state (struct toolbar *toolbar, button_bar_action action, bool shaded) |
Set the shaded state of a toolbar button. More... | |
bool | ro_toolbar_take_caret (struct toolbar *toolbar) |
Give a toolbar input focus, placing the caret into the URL bar if one is present. More... | |
void | ro_toolbar_set_url (struct toolbar *toolbar, const char *url, bool is_utf8, bool set_caret) |
Set the content of a toolbar's URL field. More... | |
const char * | ro_toolbar_get_url (struct toolbar *toolbar) |
Return a pointer to the URL contained in a browser toolbar. More... | |
void | ro_toolbar_update_all_hotlists (void) |
Update the state of the URL Bar hotlist icons in all open toolbars. More... | |
void | ro_toolbar_update_hotlist (struct toolbar *toolbar) |
Update the state of a toolbar's URL Bar hotlist icon to reflect any changes to the URL or the hotlist contents. More... | |
bool | ro_toolbar_get_url_field_extent (struct toolbar *toolbar, os_box *extent) |
Return the current work area coordinates of the URL and favicon field's bounding box. More... | |
void | ro_toolbar_set_site_favicon (struct toolbar *toolbar, struct hlcache_handle *h) |
Update the favicon in a browser window toolbar to the supplied content, or revert to using filetype-based icons. More... | |
void | ro_toolbar_set_content_favicon (struct toolbar *toolbar, struct gui_window *g) |
Update the favicon in a browser window toolbar to reflect the RISC OS filetype of the content within the supplied window. More... | |
void | ro_toolbar_update_urlsuggest (struct toolbar *toolbar) |
Update the state of the URL suggestion pop-up menu icon on a toolbar. More... | |
void | ro_toolbar_set_display_buttons (struct toolbar *toolbar, bool display) |
Set the display button bar state for a toolbar. More... | |
void | ro_toolbar_set_display_url (struct toolbar *toolbar, bool display) |
Set the display URL bar state for a toolbar. More... | |
void | ro_toolbar_set_display_throbber (struct toolbar *toolbar, bool display) |
Set the display throbber state for a toolbar. More... | |
bool | ro_toolbar_get_display_buttons (struct toolbar *toolbar) |
Return true or false depending on whether the given toolbar is set to display the button bar. More... | |
bool | ro_toolbar_get_display_url (struct toolbar *toolbar) |
Return true or false depending on whether the given toolbar is set to display the URL bar. More... | |
bool | ro_toolbar_get_display_throbber (struct toolbar *toolbar) |
Return true or false depending on whether the given toolbar is set to display the throbber. More... | |
bool | ro_toolbar_get_editing (struct toolbar *toolbar) |
Return true or false depending on whether the given toolbar is currently being edited. More... | |
bool | ro_toolbar_toggle_edit (struct toolbar *toolbar) |
Toggle toolbar edit mode on the given toolbar. More... | |
Variables | |
static struct toolbar * | ro_toolbar_bars = NULL |
The list of defined toolbars. More... | |
wimp_menu * | toolbar_menu |
The Toolber Menu. More... | |
static wimp_window | ro_toolbar_window |
static char | ro_toolbar_null_string [] = "" |
static char | ro_toolbar_line_validation [] = "R2" |
Window toolbars (implementation).
Definition in file toolbar.c.
bool ro_toolbar_add_buttons | ( | struct toolbar * | toolbar, |
const struct button_bar_buttons | buttons[], | ||
char * | button_order | ||
) |
Add a button bar to a toolbar, and configure the buttons.
*toolbar | The toolbar to take the button bar. |
buttons[] | The button definitions. |
*button_order | The initial button order to use. |
Definition at line 273 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, toolbar::editing, toolbar::editor, ro_gui_button_bar_arrange_buttons(), ro_gui_button_bar_create(), ro_gui_button_bar_hide(), ro_gui_button_bar_link_editor(), ro_toolbar_update_current_widgets(), and toolbar::theme.
Referenced by gui_window_create(), ro_corewindow_init(), and ro_gui_options_theme_load().
bool ro_toolbar_add_throbber | ( | struct toolbar * | toolbar | ) |
Add a throbber to a toolbar.
*toolbar | The toolbar to take the throbber. |
Definition at line 308 of file toolbar.c.
References ro_gui_throbber_create(), toolbar::theme, toolbar::throbber, and toolbar::throbber_display.
Referenced by gui_window_create(), and ro_gui_options_theme_load().
bool ro_toolbar_add_url | ( | struct toolbar * | toolbar | ) |
Add a URL bar to a toolbar.
*toolbar | The toolbar to take the URL bar. |
Definition at line 327 of file toolbar.c.
References ro_gui_url_bar_create(), toolbar::theme, toolbar::url, and toolbar::url_display.
Referenced by gui_window_create(), and ro_gui_options_theme_load().
bool ro_toolbar_attach | ( | struct toolbar * | toolbar, |
wimp_w | parent | ||
) |
Attach or re-attach a toolbar to its parent window.
*toolbar | The toolbar to attach. |
parent | The window to attach the toolbar to. |
Definition at line 524 of file toolbar.c.
References toolbar::current_height, NSLOG, parent, toolbar::parent_handle, PTR_WIMP_OPEN, ro_warn_user(), and toolbar::toolbar_handle.
Referenced by ro_toolbar_process(), and ro_toolbar_rebuild().
|
static |
Process clicks on a toolbar, passing details on to clients where necessary.
*pointer | The wimp mouse click event. |
Definition at line 1049 of file toolbar.c.
References toolbar_action::button, toolbar::buttons, toolbar::buttons_display, toolbar::callbacks, toolbar::client_data, toolbar::editing, toolbar::editor, NSLOG, ro_gui_button_bar_click(), ro_gui_url_bar_click(), ro_gui_url_bar_test_for_text_field_click(), ro_gui_url_complete_close(), ro_gui_url_complete_start(), ro_gui_wimp_event_get_user_data(), ro_warn_user(), TOOLBAR_ACTION_BUTTON, TOOLBAR_ACTION_URL, TOOLBAR_BUTTON_NONE, toolbar::toolbar_handle, TOOLBAR_URL_NONE, toolbar::url, toolbar_action::url, toolbar::url_display, and toolbar_callbacks::user_action.
Referenced by ro_toolbar_rebuild().
struct toolbar * ro_toolbar_create | ( | struct theme_descriptor * | descriptor, |
wimp_w | parent, | ||
theme_style | style, | ||
toolbar_flags | bar_flags, | ||
const struct toolbar_callbacks * | callbacks, | ||
void * | client_data, | ||
const char * | help | ||
) |
Create a new toolbar, ready to have widgets added and to be attached to a window.
If a parent window is supplied, then the toolbar module will handle the window attachments; if NULL, it is up to the client to sort this out for itself.
*descriptor | The theme to apply, or NULL for the default. |
parent | The window to attach the toolbar to, or NULL. |
style | The theme style to apply. |
bar_flags | Toolbar flags for the new bar. |
*callbacks | A client callback block, or NULL for none. |
*client_data | A data pointer to pass to callbacks, or NULL. |
*help | The Help token prefix for interactive help. |
Definition at line 219 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, callbacks, toolbar::callbacks, toolbar::client_data, toolbar::editing, toolbar::editor, toolbar::editor_div1, toolbar::flags, toolbar::help_prefix, toolbar::next, NSLOG, parent, toolbar::parent_handle, ro_toolbar_bars, ro_warn_user(), toolbar::style, toolbar::theme, toolbar::throbber, toolbar::throbber_display, toolbar::url, and toolbar::url_display.
Referenced by gui_window_create(), ro_corewindow_init(), and ro_gui_options_theme_load().
void ro_toolbar_destroy | ( | struct toolbar * | toolbar | ) |
Destroy a toolbar after use.
*toolbar | The toolbar to destroy. |
Definition at line 947 of file toolbar.c.
References toolbar::buttons, toolbar::editor, toolbar::next, NSLOG, ro_gui_button_bar_destroy(), ro_gui_throbber_destroy(), ro_gui_url_bar_destroy(), ro_gui_wimp_event_finalise(), ro_toolbar_bars, toolbar::throbber, toolbar::toolbar_handle, and toolbar::url.
Referenced by gui_window_destroy(), ro_gui_options_theme_free(), ro_toolbar_theme_update(), and ro_toolbar_toggle_edit().
int ro_toolbar_full_height | ( | struct toolbar * | toolbar | ) |
Return the full height that a toolbar could grow to, if space is available.
*toolbar | The toolbar of interest. |
Definition at line 1527 of file toolbar.c.
References toolbar::full_height.
Referenced by gui_window_get_scroll(), gui_window_scroll_start(), gui_window_set_extent(), gui_window_set_scroll(), ro_cw_get_window_dimensions(), ro_gui_window_open(), and ro_gui_window_scroll_action().
bool ro_toolbar_get_display_buttons | ( | struct toolbar * | toolbar | ) |
Return true or false depending on whether the given toolbar is set to display the button bar.
*toolbar | the toolbar of interest. |
Definition at line 1745 of file toolbar.c.
References toolbar::buttons, and toolbar::buttons_display.
Referenced by cookie_menu_select(), global_history_menu_select(), hotlist_menu_select(), ro_gui_window_clone_options(), ro_gui_window_default_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
bool ro_toolbar_get_display_throbber | ( | struct toolbar * | toolbar | ) |
Return true or false depending on whether the given toolbar is set to display the throbber.
*toolbar | the toolbar of interest. |
Definition at line 1763 of file toolbar.c.
References toolbar::throbber, and toolbar::throbber_display.
Referenced by ro_gui_window_clone_options(), ro_gui_window_default_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
bool ro_toolbar_get_display_url | ( | struct toolbar * | toolbar | ) |
Return true or false depending on whether the given toolbar is set to display the URL bar.
*toolbar | the toolbar of interest. |
Definition at line 1754 of file toolbar.c.
References toolbar::url, and toolbar::url_display.
Referenced by ro_gui_url_complete_keypress(), ro_gui_url_complete_resize(), ro_gui_url_complete_start(), ro_gui_window_clone_options(), ro_gui_window_default_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
bool ro_toolbar_get_editing | ( | struct toolbar * | toolbar | ) |
Return true or false depending on whether the given toolbar is currently being edited.
*toolbar | the toolbar of interest. |
Definition at line 1772 of file toolbar.c.
References toolbar::editing.
Referenced by ro_gui_dialog_open_top().
|
static |
Translate the contents of a message_HELP_REQUEST into a suffix for a NetSurf message token.
The help system will then add this to whatever prefix the current toolbar has registered with WimpEvent.
w | The window handle under the mouse. |
i | The icon handle under the mouse. |
*pos | The mouse position. |
buttons | The mouse button state. |
Definition at line 1333 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, NSLOG, ro_gui_button_bar_help_suffix(), ro_gui_throbber_help_suffix(), ro_gui_url_bar_help_suffix(), ro_gui_wimp_event_get_user_data(), ro_warn_user(), toolbar::throbber, toolbar::throbber_display, toolbar::toolbar_handle, toolbar::url, and toolbar::url_display.
Referenced by ro_toolbar_rebuild().
wimp_w ro_toolbar_get_parent_window | ( | struct toolbar * | toolbar | ) |
Return the RO window handle of the parent window for a toolbar.
*toolbar | the toolbar to look up. |
Definition at line 1503 of file toolbar.c.
References toolbar::parent_handle.
Referenced by ro_gui_toolbar_lookup(), ro_gui_url_complete_keypress(), and ro_gui_url_complete_start().
const char * ro_toolbar_get_url | ( | struct toolbar * | toolbar | ) |
Return a pointer to the URL contained in a browser toolbar.
If the toolbar doesn't have a URL field, then NULL is returned instead.
*toolbar | The toolbar to look up the URL from. |
Definition at line 1619 of file toolbar.c.
References ro_gui_url_bar_get_url(), and toolbar::url.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_keypress(), ro_gui_url_complete_start(), and ro_gui_window_handle_local_keypress().
bool ro_toolbar_get_url_field_extent | ( | struct toolbar * | toolbar, |
os_box * | extent | ||
) |
Return the current work area coordinates of the URL and favicon field's bounding box.
*toolbar | The toolbar to look up. |
*extent | Return the coordinates. |
Definition at line 1656 of file toolbar.c.
References ro_gui_url_bar_get_url_extent(), and toolbar::url.
Referenced by ro_gui_url_complete_resize().
wimp_w ro_toolbar_get_window | ( | struct toolbar * | toolbar | ) |
Return the RO window handle of a toolbar.
*toolbar | the toolbar to look up. |
Definition at line 1511 of file toolbar.c.
References toolbar::toolbar_handle.
Referenced by ro_gui_options_theme_load(), and ro_gui_url_complete_resize().
int ro_toolbar_height | ( | struct toolbar * | toolbar | ) |
Return the current height of a toolbar, allowing for available window space.
*toolbar | The toolbar of interest. |
Definition at line 1519 of file toolbar.c.
References toolbar::current_height.
Referenced by cw_tb_size(), gui_window_update_extent(), ro_corewindow_init(), ro_cw_drag_start(), ro_gui_dialog_open_top(), and ro_gui_options_theme_load().
void ro_toolbar_init | ( | void | ) |
Initialise the RISC OS toolbar widget.
Definition at line 199 of file toolbar.c.
References NO_ACTION, ro_gui_menu_define_menu(), TOOLBAR_ADDRESS_BAR, TOOLBAR_BUTTONS, TOOLBAR_EDIT, toolbar_menu, and TOOLBAR_THROBBER.
Referenced by gui_init().
|
static |
Process keypresses in a toolbar, passing details on to clients where necessary.
*key | The wimp key press event. |
Definition at line 1146 of file toolbar.c.
References toolbar::callbacks, toolbar::client_data, toolbar_callbacks::key_press, ro_gui_url_bar_test_for_text_field_keypress(), ro_gui_url_complete_keypress(), ro_gui_wimp_event_get_user_data(), toolbar::url, and toolbar::url_display.
Referenced by ro_toolbar_rebuild().
|
static |
Prepare the toolbar menu for (re-)opening.
w | The window owning the menu. |
i | The icon owning the menu. |
*menu | The menu about to be opened. |
*pointer | Pointer to the relevant wimp event block, or NULL for an Adjust click. |
Definition at line 1189 of file toolbar.c.
References toolbar::buttons, ro_gui_menu_set_entry_shaded(), ro_gui_menu_set_entry_ticked(), ro_gui_url_bar_menu_prepare(), ro_gui_wimp_event_get_user_data(), ro_toolbar_menu_buttons_tick, ro_toolbar_menu_edit_shade, ro_toolbar_menu_edit_tick, ro_toolbar_menu_option_shade, ro_toolbar_menu_throbber_tick, ro_toolbar_menu_url_tick, toolbar::throbber, TOOLBAR_ADDRESS_BAR, TOOLBAR_BUTTONS, TOOLBAR_EDIT, toolbar_menu, TOOLBAR_THROBBER, and toolbar::url.
Referenced by ro_toolbar_rebuild().
|
static |
Handle selections from the toolbar menu.
w | The window owning the menu. |
i | The icon owning the menu. |
*menu | The menu from which the selection was made. |
*selection | The wimp menu selection data. |
action | The selected menu action. |
Definition at line 1274 of file toolbar.c.
References ro_gui_url_bar_menu_select(), ro_gui_wimp_event_get_user_data(), ro_toolbar_get_display_buttons(), ro_toolbar_get_display_throbber(), ro_toolbar_get_display_url(), ro_toolbar_set_display_buttons(), ro_toolbar_set_display_throbber(), ro_toolbar_set_display_url(), ro_toolbar_take_caret(), ro_toolbar_toggle_edit(), TOOLBAR_ADDRESS_BAR, TOOLBAR_BUTTONS, TOOLBAR_EDIT, toolbar_menu, TOOLBAR_THROBBER, and toolbar::url.
Referenced by ro_toolbar_rebuild().
|
static |
Handle submenu warnings for the toolbar menu.
w | The window owning the menu. |
i | The icon owning the menu. |
*menu | The menu to which the warning applies. |
*selection | The wimp menu selection data. |
action | The selected menu action. |
Definition at line 1256 of file toolbar.c.
Referenced by ro_toolbar_rebuild().
void ro_toolbar_page_info_change | ( | struct toolbar * | toolbar | ) |
Update the page information indicator.
toolbar | the toolbar to update the page info in. |
Definition at line 1551 of file toolbar.c.
References ro_gui_url_bar_page_info_change(), and toolbar::url.
Referenced by gui_window_page_info_change().
struct toolbar * ro_toolbar_parent_window_lookup | ( | wimp_w | w | ) |
Find the toolbar associated with a given RO window handle.
w | the window handle to look up. |
Definition at line 1475 of file toolbar.c.
References toolbar::next, toolbar::parent_handle, and ro_toolbar_bars.
Referenced by ro_gui_window_scroll_action().
bool ro_toolbar_process | ( | struct toolbar * | toolbar, |
int | width, | ||
bool | reformat | ||
) |
Process a toolbar, updating its contents for a size or content change.
*toolbar | The toolbar to update. |
width | The width to reformat to, or -1 to use parent. |
reformat | true to force a widget reflow; else false. |
Definition at line 588 of file toolbar.c.
References toolbar::clip_height, toolbar::clip_width, toolbar::current_height, toolbar::current_width, toolbar::full_height, NSLOG, toolbar::parent_handle, ro_toolbar_attach(), ro_toolbar_reformat_widgets(), ro_warn_user(), TOOLBAR_DEFAULT_WIDTH, toolbar::toolbar_handle, and width.
Referenced by ro_gui_options_theme_load(), ro_gui_window_clone_options(), ro_gui_window_open(), ro_toolbar_rebuild(), ro_toolbar_refresh(), and ro_toolbar_set_button_order().
bool ro_toolbar_rebuild | ( | struct toolbar * | toolbar | ) |
(Re-)build a toolbar to use the specified (or current) theme.
If false is returned, the toolbar may not be complete and should be deleted.
*toolbar | The toolbar to rebuild. |
Definition at line 346 of file toolbar.c.
References toolbar::buttons, toolbar::editing, toolbar::editor, toolbar::editor_div1, toolbar::flags, toolbar::help_prefix, NSLOG, toolbar::parent_handle, ro_gui_button_bar_destroy(), ro_gui_button_bar_rebuild(), ro_gui_theme_get_sprites(), ro_gui_theme_get_style_element(), ro_gui_theme_get_throbber_data(), ro_gui_throbber_destroy(), ro_gui_throbber_rebuild(), ro_gui_url_bar_destroy(), ro_gui_url_bar_rebuild(), ro_gui_wimp_event_register_help_suffix(), ro_gui_wimp_event_register_keypress(), ro_gui_wimp_event_register_menu(), ro_gui_wimp_event_register_menu_prepare(), ro_gui_wimp_event_register_menu_selection(), ro_gui_wimp_event_register_menu_warning(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_redraw_window(), ro_gui_wimp_event_set_help_prefix(), ro_gui_wimp_event_set_user_data(), ro_gui_wimp_event_transfer(), ro_toolbar_attach(), ro_toolbar_click(), ro_toolbar_get_help_suffix(), ro_toolbar_keypress(), ro_toolbar_line_validation, ro_toolbar_menu_prepare(), ro_toolbar_menu_select(), ro_toolbar_menu_warning(), ro_toolbar_null_string, ro_toolbar_process(), ro_toolbar_redraw(), ro_toolbar_refresh_widget_dimensions(), ro_toolbar_update_buttons(), ro_toolbar_window, ro_warn_user(), toolbar::style, toolbar::theme, THEME_ELEMENT_BACKGROUND, toolbar::throbber, toolbar::throbber_right, TOOLBAR_FLAGS_DISPLAY, toolbar::toolbar_handle, toolbar_menu, and toolbar::url.
Referenced by gui_window_create(), ro_corewindow_init(), ro_gui_options_theme_load(), ro_toolbar_theme_update(), and ro_toolbar_toggle_edit().
|
static |
Handle redraw request events for a toolbar workarea.
*redraw | The redraw block for the event. |
Definition at line 1001 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, toolbar::editing, toolbar::editor, NSLOG, ro_gui_button_bar_redraw(), ro_gui_url_bar_redraw(), ro_gui_wimp_event_get_user_data(), ro_plot_origin_x, ro_plot_origin_y, ro_warn_user(), toolbar::url, and toolbar::url_display.
Referenced by ro_toolbar_rebuild().
|
static |
Reformat (reflow) the widgets into the toolbar, based on the toolbar size and the previously calculated widget dimensions.
*toolbar | The toolbar to reformat. |
Definition at line 859 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, toolbar::buttons_size, toolbar::clip_width, toolbar::editing, toolbar::editor, toolbar::editor_div1, toolbar::editor_size, ro_gui_button_bar_set_extent(), ro_gui_throbber_set_extent(), ro_gui_url_bar_set_extent(), toolbar::row_y0, toolbar::row_y1, toolbar::throbber, toolbar::throbber_display, toolbar::throbber_right, toolbar::throbber_size, toolbar::toolbar_handle, TOOLBAR_ROW_DIV1, TOOLBAR_ROW_EDIT, TOOLBAR_ROW_TOP, TOOLBAR_WIDGET_GUTTER, toolbar::url, toolbar::url_display, and toolbar::url_size.
Referenced by ro_toolbar_process(), and ro_toolbar_update_current_widgets().
void ro_toolbar_refresh | ( | struct toolbar * | toolbar | ) |
Refresh a toolbar after it has been updated.
toolbar | the toolbar to update |
Definition at line 1417 of file toolbar.c.
References toolbar::callbacks, toolbar_callbacks::change_size, toolbar::client_data, toolbar::current_height, toolbar::current_width, ro_toolbar_process(), and toolbar::toolbar_handle.
Referenced by ro_toolbar_set_display_buttons(), ro_toolbar_set_display_throbber(), ro_toolbar_set_display_url(), ro_toolbar_toggle_edit(), and ro_toolbar_update_current_widgets().
|
static |
Get the minimum dimenstions required by the toolbar widgets after these have changed.
The minimum dimensions are assumed not to change unless we change theme (ie. we rebuild the bar) or we knowingly alter a widget (eg. we add or remove button-bar buttons).
*toolbar | The toolbar to refresh. |
Definition at line 724 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, toolbar::buttons_size, toolbar::editing, toolbar::editor, toolbar::editor_size, toolbar::full_height, toolbar::full_width, height, ro_gui_button_bar_get_dims(), ro_gui_throbber_get_dims(), ro_gui_url_bar_get_dims(), toolbar::row_y0, toolbar::row_y1, toolbar::throbber, toolbar::throbber_display, toolbar::throbber_size, TOOLBAR_ROW_DIV1, TOOLBAR_ROW_EDIT, TOOLBAR_ROW_TOP, TOOLBAR_WIDGET_GUTTER, toolbar::url, toolbar::url_display, toolbar::url_size, and width.
Referenced by ro_toolbar_rebuild(), ro_toolbar_set_button_order(), ro_toolbar_set_display_buttons(), ro_toolbar_set_display_throbber(), ro_toolbar_set_display_url(), and ro_toolbar_update_current_widgets().
bool ro_toolbar_set_button_order | ( | struct toolbar * | toolbar, |
char | order[] | ||
) |
Change the arrangement of buttons and spacers on a button bar within a toolbar.
*toolbar | The toolbar to change. |
order[] | The new button configuration. |
Definition at line 1570 of file toolbar.c.
References toolbar::buttons, ro_gui_button_bar_arrange_buttons(), ro_toolbar_process(), and ro_toolbar_refresh_widget_dimensions().
void ro_toolbar_set_button_shaded_state | ( | struct toolbar * | toolbar, |
button_bar_action | action, | ||
bool | shaded | ||
) |
Set the shaded state of a toolbar button.
*toolbar | the toolbar to update. |
action | the button action to update. |
shaded | true if the button should be shaded; else false. |
Definition at line 1586 of file toolbar.c.
References toolbar::buttons, and ro_gui_button_bar_shade_button().
Referenced by cookie_toolbar_update(), global_history_toolbar_update(), hotlist_toolbar_update(), and ro_gui_window_update_toolbar_buttons().
void ro_toolbar_set_content_favicon | ( | struct toolbar * | toolbar, |
struct gui_window * | g | ||
) |
Update the favicon in a browser window toolbar to reflect the RISC OS filetype of the content within the supplied window.
If the toolbar currently has a site favicon set, then this call will be ignored.
*toolbar | The toolbar to refresh. |
*g | The gui window to set content favicon for. |
Definition at line 1680 of file toolbar.c.
References ro_gui_url_bar_set_content_favicon(), and toolbar::url.
Referenced by gui_window_new_content().
void ro_toolbar_set_display_buttons | ( | struct toolbar * | toolbar, |
bool | display | ||
) |
Set the display button bar state for a toolbar.
*toolbar | the toolbar to update. |
display | true to display the button bar; else false. |
Definition at line 1703 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, ro_gui_button_bar_hide(), ro_toolbar_refresh(), and ro_toolbar_refresh_widget_dimensions().
Referenced by cookie_menu_select(), global_history_menu_select(), hotlist_menu_select(), ro_gui_window_clone_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
void ro_toolbar_set_display_throbber | ( | struct toolbar * | toolbar, |
bool | display | ||
) |
Set the display throbber state for a toolbar.
*toolbar | the toolbar to update. |
display | true to display the throbber; else false. |
Definition at line 1731 of file toolbar.c.
References ro_gui_throbber_hide(), ro_toolbar_refresh(), ro_toolbar_refresh_widget_dimensions(), toolbar::throbber, and toolbar::throbber_display.
Referenced by ro_gui_window_clone_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
void ro_toolbar_set_display_url | ( | struct toolbar * | toolbar, |
bool | display | ||
) |
Set the display URL bar state for a toolbar.
*toolbar | the toolbar to update. |
display | true to display the URL bar; else false. |
Definition at line 1717 of file toolbar.c.
References ro_gui_url_bar_hide(), ro_toolbar_refresh(), ro_toolbar_refresh_widget_dimensions(), toolbar::url, and toolbar::url_display.
Referenced by ro_gui_window_clone_options(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
void ro_toolbar_set_site_favicon | ( | struct toolbar * | toolbar, |
struct hlcache_handle * | h | ||
) |
Update the favicon in a browser window toolbar to the supplied content, or revert to using filetype-based icons.
*toolbar | The toolbar to refresh. |
*h | The new favicon to use, or NULL for none. |
Definition at line 1669 of file toolbar.c.
References ro_gui_url_bar_set_site_favicon(), and toolbar::url.
Referenced by gui_window_set_icon().
void ro_toolbar_set_url | ( | struct toolbar * | toolbar, |
const char * | url, | ||
bool | is_utf8, | ||
bool | set_caret | ||
) |
Set the content of a toolbar's URL field.
*toolbar | the toolbar 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 1609 of file toolbar.c.
References ro_gui_url_bar_set_url(), and toolbar::url.
Referenced by ro_gui_url_complete_click(), ro_gui_url_complete_keypress(), ro_gui_window_handle_local_keypress(), and ro_gui_window_set_url().
void ro_toolbar_start_throbbing | ( | struct toolbar * | toolbar | ) |
Starts a toolbar throbber, if there is one active.
*toolbar | the toolbar to start throbbing. |
Definition at line 1535 of file toolbar.c.
References ro_gui_throbber_animate(), and toolbar::throbber.
Referenced by gui_window_start_throbber().
void ro_toolbar_stop_throbbing | ( | struct toolbar * | toolbar | ) |
Stops a toolbar throbber, if there is one active.
*toolbar | the toolbar to stop throbbing. |
Definition at line 1543 of file toolbar.c.
References ro_gui_throbber_stop(), and toolbar::throbber.
Referenced by gui_window_stop_throbber().
bool ro_toolbar_take_caret | ( | struct toolbar * | toolbar | ) |
Give a toolbar input focus, placing the caret into the URL bar if one is present.
Currently a toolbar can only accept focus if it has a URL bar.
*toolbar | The toolbar to take the caret. |
Definition at line 1598 of file toolbar.c.
References ro_gui_url_bar_take_caret(), toolbar::url, and toolbar::url_display.
Referenced by gui_window_create(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
void ro_toolbar_theme_update | ( | void | ) |
Force the update of all toolbars to reflect the application of a new theme.
Definition at line 1435 of file toolbar.c.
References toolbar::callbacks, toolbar::client_data, toolbar::next, ro_toolbar_bars, ro_toolbar_destroy(), ro_toolbar_rebuild(), toolbar::theme, and toolbar_callbacks::theme_update.
Referenced by ro_gui_theme_apply().
void ro_toolbar_throb | ( | struct toolbar * | toolbar | ) |
Animate a toolbar throbber, if there is one active.
*toolbar | the toolbar to throb. |
Definition at line 1561 of file toolbar.c.
References ro_gui_throbber_animate(), and toolbar::throbber.
Referenced by ro_gui_throb().
bool ro_toolbar_toggle_edit | ( | struct toolbar * | toolbar | ) |
Toggle toolbar edit mode on the given toolbar.
Only a button bar can be edited, so edit mode can only be toggled if there's an editor button bar defined.
*toolbar | The toolbar to be toggled. |
Definition at line 1780 of file toolbar.c.
References toolbar::buttons, toolbar::buttons_display, toolbar::callbacks, toolbar::client_data, toolbar::editing, toolbar::editor, ro_gui_button_bar_get_config(), ro_gui_button_bar_hide(), ro_toolbar_destroy(), ro_toolbar_rebuild(), ro_toolbar_refresh(), and toolbar_callbacks::save_buttons.
Referenced by cookie_menu_select(), global_history_menu_select(), hotlist_menu_select(), ro_gui_dialog_open_top(), ro_gui_window_menu_select(), and ro_toolbar_menu_select().
void ro_toolbar_update_all_buttons | ( | void | ) |
Force the update of all toolbars buttons to reflect the current state.
Definition at line 1387 of file toolbar.c.
References toolbar::next, ro_toolbar_bars, and ro_toolbar_update_buttons().
void ro_toolbar_update_all_hotlists | ( | void | ) |
Update the state of the URL Bar hotlist icons in all open toolbars.
Definition at line 1630 of file toolbar.c.
References toolbar::next, ro_toolbar_bars, and ro_toolbar_update_hotlist().
Referenced by hotlist_menu_select(), hotlist_toolbar_click(), ro_gui_hotlist_remove_confirmed(), and ro_gui_hotlist_remove_page().
|
static |
Update the state of a toolbar's buttons.
toolbar | the toolbar to update |
Definition at line 1406 of file toolbar.c.
References toolbar::callbacks, toolbar::client_data, and toolbar_callbacks::update_buttons.
Referenced by ro_toolbar_rebuild(), and ro_toolbar_update_all_buttons().
void ro_toolbar_update_client_data | ( | struct toolbar * | toolbar, |
void * | client_data | ||
) |
Change the client data associated with a toolbar's callbacks.
*toolbar | the toolbar whose data is to be updated. |
*client_data | the new client data, or NULL for none. |
Definition at line 1378 of file toolbar.c.
References toolbar::client_data.
|
static |
Update the widgets currently on view in a toolbar.
This can be used generally, but is primarily offered to widgets as a way for them to force an update.
*toolbar | The toolbar to update. |
Definition at line 695 of file toolbar.c.
References toolbar::full_height, ro_toolbar_reformat_widgets(), ro_toolbar_refresh(), and ro_toolbar_refresh_widget_dimensions().
Referenced by ro_toolbar_add_buttons().
void ro_toolbar_update_hotlist | ( | struct toolbar * | toolbar | ) |
Update the state of a toolbar's URL Bar hotlist icon to reflect any changes to the URL or the hotlist contents.
*toolbar | The toolbar to update. |
Definition at line 1645 of file toolbar.c.
References ro_gui_url_bar_update_hotlist(), and toolbar::url.
Referenced by ro_gui_window_action_add_bookmark(), and ro_toolbar_update_all_hotlists().
void ro_toolbar_update_urlsuggest | ( | struct toolbar * | toolbar | ) |
Update the state of the URL suggestion pop-up menu icon on a toolbar.
*toolbar | The toolbar to update. |
Definition at line 1692 of file toolbar.c.
References ro_gui_url_bar_update_urlsuggest(), and toolbar::url.
Referenced by ro_gui_window_update_toolbar_buttons().
struct toolbar * ro_toolbar_window_lookup | ( | wimp_w | w | ) |
Find the toolbar using a given RO window handle for its pane.
w | the window (pane) handle to look up. |
Definition at line 1489 of file toolbar.c.
References toolbar::next, ro_toolbar_bars, and toolbar::toolbar_handle.
Referenced by ro_gui_toolbar_lookup().
|
static |
The list of defined toolbars.
Definition at line 135 of file toolbar.c.
Referenced by ro_toolbar_create(), ro_toolbar_destroy(), ro_toolbar_parent_window_lookup(), ro_toolbar_theme_update(), ro_toolbar_update_all_buttons(), ro_toolbar_update_all_hotlists(), and ro_toolbar_window_lookup().
|
static |
Definition at line 172 of file toolbar.c.
Referenced by ro_toolbar_rebuild().
|
static |
Definition at line 171 of file toolbar.c.
Referenced by ro_toolbar_rebuild().
|
static |
Definition at line 144 of file toolbar.c.
Referenced by ro_toolbar_rebuild().
wimp_menu* toolbar_menu |
The Toolber Menu.
Definition at line 138 of file toolbar.c.
Referenced by ro_toolbar_init(), ro_toolbar_menu_prepare(), ro_toolbar_menu_select(), and ro_toolbar_rebuild().