NetSurf
|
Button bars (interface). More...
Go to the source code of this file.
Data Structures | |
struct | button_bar_buttons |
Functions | |
struct button_bar * | ro_gui_button_bar_create (struct theme_descriptor *theme, const struct button_bar_buttons buttons[]) |
Create a new button bar widget. More... | |
bool | ro_gui_button_bar_link_editor (struct button_bar *target, struct button_bar *source, void(*refresh)(void *), void *client_data) |
Link two button bars together. More... | |
bool | ro_gui_button_bar_rebuild (struct button_bar *button_bar, struct theme_descriptor *theme, theme_style style, wimp_w window, bool edit) |
Place a button bar into a toolbar window and initialise any theme-specific settings. More... | |
bool | ro_gui_button_bar_arrange_buttons (struct button_bar *button_bar, char order[]) |
Arrange buttons on a button bar, using an order string to specify the required button and separator layout. More... | |
void | ro_gui_button_bar_destroy (struct button_bar *button_bar) |
Destroy a button bar widget. More... | |
bool | ro_gui_button_bar_get_dims (struct button_bar *button_bar, int *width, int *height) |
Return the MINIMUM dimensions required by the button bar, in RO units, allowing for the current theme. More... | |
bool | ro_gui_button_bar_set_extent (struct button_bar *button_bar, int x0, int y0, int x1, int y1) |
Set or update the dimensions to be used by the button bar, in RO units. More... | |
bool | ro_gui_button_bar_hide (struct button_bar *button_bar, bool hide) |
Show or hide a button bar. More... | |
bool | ro_gui_button_bar_shade_button (struct button_bar *button_bar, button_bar_action action, bool shaded) |
Shade or unshade a button in a bar corresponding to the given action. More... | |
void | ro_gui_button_bar_redraw (struct button_bar *button_bar, wimp_draw *redraw) |
Handle redraw event rectangles in a button bar. More... | |
bool | ro_gui_button_bar_click (struct button_bar *button_bar, wimp_pointer *pointer, wimp_window_state *state, button_bar_action *action) |
Handle mouse clicks in a button bar. More... | |
bool | ro_gui_button_bar_help_suffix (struct button_bar *button_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 a button bar. More... | |
char * | ro_gui_button_bar_get_config (struct button_bar *button_bar) |
Return a config string reflecting the configured order of buttons and spacers. More... | |
Variables | |
static const struct button_bar_buttons | brower_toolbar_buttons [] |
Button bars (interface).
Definition in file button_bar.h.
enum button_bar_action |
Definition at line 32 of file button_bar.h.
bool ro_gui_button_bar_arrange_buttons | ( | struct button_bar * | button_bar, |
char | order[] | ||
) |
Arrange buttons on a button bar, using an order string to specify the required button and separator layout.
*button_bar | The button bar to update. |
order[] | The button order configuration string. |
Definition at line 303 of file button_bar.c.
References button_bar::bar, button_bar_button::bar_next, button_bar::buttons, button_bar_button::next, ro_gui_button_bar_find_opt_key(), ro_gui_button_bar_place_buttons(), and button_bar_button::separator.
Referenced by ro_toolbar_add_buttons(), and ro_toolbar_set_button_order().
bool ro_gui_button_bar_click | ( | struct button_bar * | button_bar, |
wimp_pointer * | pointer, | ||
wimp_window_state * | state, | ||
button_bar_action * | action | ||
) |
Handle mouse clicks in a button bar.
*button_bar | The button bar to use. |
*pointer | The Wimp mouse click event data. |
*state | The toolbar window state. |
*action | Returns the selected action, or TOOLBAR_BUTTON_NONE. |
Definition at line 723 of file button_bar.c.
References button_bar_button::adjust_action, drag_opt, drag_separator, drag_start, button_bar::edit, button_bar::edit_source, button_bar::extent, button_bar::hidden, NSLOG, button_bar_button::opt_key, ro_gui_button_bar_drag_end(), ro_gui_button_bar_find_coords(), ro_gui_button_bar_find_icon(), ro_mouse_drag_start(), button_bar_button::select_action, separator_name, button_bar::separator_width, button_bar_button::shaded, button_bar_button::sprite, button_bar::sprites, box::x, button_bar_button::x_size, box::y, and button_bar_button::y_size.
Referenced by ro_toolbar_click().
struct button_bar * ro_gui_button_bar_create | ( | struct theme_descriptor * | theme, |
const struct button_bar_buttons | buttons[] | ||
) |
Create a new button bar widget.
*theme | The theme to apply (or NULL for the default). |
buttons[] | An array of button definitions for the bar. |
Definition at line 130 of file button_bar.c.
References button_bar_buttons::adjust, button_bar::background, button_bar::bar, BUTTONBAR_SPRITE_NAME_LENGTH, BUTTONBAR_VALIDATION_LENGTH, button_bar::buttons, button_bar::edit, button_bar::edit_client_data, button_bar::edit_refresh, button_bar::edit_source, button_bar::edit_target, button_bar_buttons::help, button_bar::hidden, button_bar_button::icon, button_bar_buttons::icon, NSLOG, button_bar_buttons::opt_key, ro_gui_theme_get_sprites(), button_bar_buttons::select, button_bar::separator_width, button_bar::separators, button_bar::sprites, button_bar::theme, button_bar::vertical_offset, button_bar::window, button_bar::x_min, and button_bar::y_min.
Referenced by ro_toolbar_add_buttons().
void ro_gui_button_bar_destroy | ( | struct button_bar * | button_bar | ) |
Destroy a button bar widget.
*button_bar | The button bar to destroy. |
Definition at line 395 of file button_bar.c.
References button_bar::buttons, and button_bar_button::next.
Referenced by ro_toolbar_destroy(), and ro_toolbar_rebuild().
char * ro_gui_button_bar_get_config | ( | struct button_bar * | button_bar | ) |
Return a config string reflecting the configured order of buttons and spacers.
The string is allocated with malloc(), and should be free()d after use.
*button_bar | The button bar of interest. |
Definition at line 1067 of file button_bar.c.
References button_bar::bar, button_bar_button::bar_next, NSLOG, button_bar_button::opt_key, ro_warn_user(), and button_bar_button::separator.
Referenced by ro_toolbar_toggle_edit().
bool ro_gui_button_bar_get_dims | ( | struct button_bar * | button_bar, |
int * | width, | ||
int * | height | ||
) |
Return the MINIMUM dimensions required by the button bar, in RO units, allowing for the current theme.
*button_bar | The button bar of interest. |
*width | Return the required width. |
*height | Return the required height. |
Definition at line 416 of file button_bar.c.
References height, width, button_bar::x_min, and button_bar::y_min.
Referenced by ro_toolbar_refresh_widget_dimensions().
bool ro_gui_button_bar_help_suffix | ( | struct button_bar * | button_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 a button bar.
*button_bar | The button 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 826 of file button_bar.c.
References button_bar::extent, button_bar_button::help_suffix, button_bar::hidden, and ro_gui_button_bar_find_icon().
Referenced by ro_toolbar_get_help_suffix().
bool ro_gui_button_bar_hide | ( | struct button_bar * | button_bar, |
bool | hide | ||
) |
Show or hide a button bar.
*button_bar | The button bar to hide. |
hide | true to hide the bar; false to show it. |
Definition at line 627 of file button_bar.c.
References button_bar::hidden, and ro_gui_button_bar_icon_update().
Referenced by ro_toolbar_add_buttons(), ro_toolbar_set_display_buttons(), and ro_toolbar_toggle_edit().
bool ro_gui_button_bar_link_editor | ( | struct button_bar * | target, |
struct button_bar * | source, | ||
void(*)(void *) | refresh, | ||
void * | client_data | ||
) |
Link two button bars together.
Join two button bars the target being the active bar, and the source being the editing bar used to supply valid buttons. The bars are checked to ensure that they are not already part of an edit pair, but are not checked for button-compatibility.
target | The target button bar. |
source | The source button bar. |
refresh | The refresh callback. |
client_data | context passed to the refresh callback |
Definition at line 220 of file button_bar.c.
References button_bar::edit_client_data, button_bar::edit_refresh, button_bar::edit_source, and button_bar::edit_target.
Referenced by ro_toolbar_add_buttons().
bool ro_gui_button_bar_rebuild | ( | struct button_bar * | button_bar, |
struct theme_descriptor * | theme, | ||
theme_style | style, | ||
wimp_w | window, | ||
bool | edit | ||
) |
Place a button 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.
*button_bar | The button 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. |
edit | The edit mode of the button bar. |
Definition at line 245 of file button_bar.c.
References button_bar::background, button_bar::buttons, button_bar::edit, button_bar::edit_target, height, button_bar_button::icon, button_bar_button::next, ro_gui_button_bar_icon_update(), ro_gui_button_bar_place_buttons(), ro_gui_button_bar_sync_editors(), ro_gui_theme_get_sprites(), ro_gui_theme_get_style_element(), ro_gui_wimp_get_sprite_dimensions(), separator_name, button_bar::separator_width, button_bar::separators, button_bar_button::sprite, button_bar::sprites, button_bar::theme, THEME_ELEMENT_BACKGROUND, button_bar::window, button_bar_button::x_size, and button_bar_button::y_size.
Referenced by ro_toolbar_rebuild().
void ro_gui_button_bar_redraw | ( | struct button_bar * | button_bar, |
wimp_draw * | redraw | ||
) |
Handle redraw event rectangles in a button bar.
*button_bar | The button bar to use. |
*redraw | The Wimp redraw rectangle to process. |
Definition at line 672 of file button_bar.c.
References button_bar::bar, button_bar_button::bar_next, button_bar::edit, button_bar::extent, button_bar::hidden, button_bar_button::icon, button_bar_button::separator, separator_name, button_bar::separator_width, button_bar::separators, button_bar::sprites, button_bar::vertical_offset, button_bar_button::x_pos, button_bar_button::x_size, and button_bar::y_min.
Referenced by ro_toolbar_redraw().
bool ro_gui_button_bar_set_extent | ( | struct button_bar * | button_bar, |
int | x0, | ||
int | y0, | ||
int | x1, | ||
int | y1 | ||
) |
Set or update the dimensions to be used by the button bar, in RO units.
If these are greater than the minimum required, the button bar will fill the extended space; if less, the call will fail.
*button_bar | The button 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 437 of file button_bar.c.
References button_bar::extent, ro_gui_button_bar_icon_resize(), button_bar::vertical_offset, button_bar::window, button_bar::x_min, and button_bar::y_min.
Referenced by ro_toolbar_reformat_widgets().
bool ro_gui_button_bar_shade_button | ( | struct button_bar * | button_bar, |
button_bar_action | action, | ||
bool | shaded | ||
) |
Shade or unshade a button in a bar corresponding to the given action.
*button_bar | The button bar to update. |
action | The action to update. |
shaded | true to shade the button; false to unshade. |
Definition at line 640 of file button_bar.c.
References button_bar::edit, button_bar::edit_target, button_bar_button::icon, ro_gui_button_bar_find_action(), ro_gui_set_icon_shaded_state(), button_bar_button::shaded, and button_bar::window.
Referenced by ro_toolbar_set_button_shaded_state().
|
static |
Definition at line 82 of file button_bar.h.
Referenced by gui_window_create(), and ro_gui_options_theme_load().