|
NetSurf
|
Window themes(interface). More...
#include <stdbool.h>#include "oslib/osspriteop.h"Go to the source code of this file.
Data Structures | |
| struct | theme_file_header |
| struct | theme |
| struct | theme_descriptor |
Enumerations | |
| enum | theme_style { THEME_STYLE_NONE = 0 , THEME_STYLE_BROWSER_TOOLBAR , THEME_STYLE_HOTLIST_TOOLBAR , THEME_STYLE_COOKIES_TOOLBAR , THEME_STYLE_GLOBAL_HISTORY_TOOLBAR , THEME_STYLE_STATUS_BAR } |
| Theme styles, collecting groups of attributes for different locations. More... | |
| enum | theme_element { THEME_ELEMENT_FOREGROUND , THEME_ELEMENT_BACKGROUND } |
| Theme elements, which belong to styles. More... | |
Functions | |
| void | ro_gui_theme_initialise (void) |
| Initialise the theme handler. More... | |
| void | ro_gui_theme_finalise (void) |
| Finalise the theme handler. More... | |
| struct theme_descriptor * | ro_gui_theme_find (const char *leafname) |
| Finds a theme from the cached values. More... | |
| struct theme_descriptor * | ro_gui_theme_get_available (void) |
| Reads and caches the currently available themes. More... | |
| struct theme_descriptor * | ro_gui_theme_get_current (void) |
| Returns the current theme handle, or NULL if none is set. More... | |
| osspriteop_area * | ro_gui_theme_get_sprites (struct theme_descriptor *descriptor) |
| Returns a sprite area for use with the given theme. More... | |
| int | ro_gui_theme_get_style_element (struct theme_descriptor *descriptor, theme_style style, theme_element element) |
| Returns an interger element from the specified theme, or the current theme if the descriptor is NULL. More... | |
| bool | ro_gui_theme_get_throbber_data (struct theme_descriptor *descriptor, int *frames, int *width, int *height, bool *right, bool *redraw) |
| Returns details of the throbber as defined in a theme. More... | |
| bool | ro_gui_theme_read_file_header (struct theme_descriptor *descriptor, struct theme_file_header *file_header) |
| Fills in the basic details for a descriptor from a file header. More... | |
| bool | ro_gui_theme_open (struct theme_descriptor *descriptor, bool list) |
| Opens a theme ready for use. More... | |
| bool | ro_gui_theme_apply (struct theme_descriptor *descriptor) |
| Applies the theme to all current windows and subsequent ones. More... | |
| void | ro_gui_theme_close (struct theme_descriptor *descriptor, bool list) |
| Closes a theme after use. More... | |
Window themes(interface).
Definition in file theme.h.
| enum theme_element |
| enum theme_style |
| bool ro_gui_theme_apply | ( | struct theme_descriptor * | descriptor | ) |
Applies the theme to all current windows and subsequent ones.
| descriptor | the theme_descriptor to open |
Definition at line 666 of file theme.c.
References ro_gui_theme_close(), ro_gui_theme_open(), ro_toolbar_theme_update(), and theme_current.
Referenced by ro_gui_options_theme_ok(), ro_gui_theme_initialise(), and ro_gui_theme_install_apply().
| void ro_gui_theme_close | ( | struct theme_descriptor * | descriptor, |
| bool | list | ||
| ) |
Closes a theme after use.
| descriptor | the theme_descriptor to close |
| list | whether to open all themes in the list |
Definition at line 695 of file theme.c.
References theme_descriptor::next, theme_descriptor::previous, theme::sprite_area, theme_descriptor::theme, and theme::users.
Referenced by ro_gui_options_theme_free(), ro_gui_theme_apply(), and ro_gui_theme_finalise().
| void ro_gui_theme_finalise | ( | void | ) |
Finalise the theme handler.
Definition at line 83 of file theme.c.
References ro_gui_theme_close(), ro_gui_theme_free(), theme_current, and theme_descriptors.
| struct theme_descriptor * ro_gui_theme_find | ( | const char * | leafname | ) |
Finds a theme from the cached values.
The returned theme is only guaranteed to be valid until the next call to ro_gui_theme_get_available() unless it has been opened using ro_gui_theme_open().
| leafname | the filename of the theme_descriptor to return |
Definition at line 100 of file theme.c.
References theme_descriptor::leafname, theme_descriptor::next, and theme_descriptors.
Referenced by ro_gui_options_theme_click(), ro_gui_options_theme_initialise(), ro_gui_theme_initialise(), and ro_gui_theme_install_apply().
| struct theme_descriptor * ro_gui_theme_get_available | ( | void | ) |
Reads and caches the currently available themes.
Definition at line 125 of file theme.c.
References theme_descriptor::name, theme_descriptor::next, nsoption_charp, theme_descriptor::previous, ro_gui_theme_add_descriptor(), ro_gui_theme_free(), ro_gui_theme_get_available_in_dir(), and theme_descriptors.
Referenced by ro_gui_options_theme_load(), ro_gui_theme_initialise(), and ro_gui_theme_install_apply().
| struct theme_descriptor * ro_gui_theme_get_current | ( | void | ) |
Returns the current theme handle, or NULL if none is set.
Definition at line 207 of file theme.c.
References theme_current.
| osspriteop_area * ro_gui_theme_get_sprites | ( | struct theme_descriptor * | descriptor | ) |
Returns a sprite area for use with the given theme.
This may return a pointer to the wimp sprite pool if a theme area isn't available.
| *descriptor | The theme to use, or NULL for the current. |
Definition at line 221 of file theme.c.
References theme::sprite_area, theme_descriptor::theme, and theme_current.
Referenced by ro_gui_button_bar_create(), ro_gui_button_bar_rebuild(), ro_gui_throbber_create(), ro_gui_throbber_rebuild(), ro_gui_url_bar_create(), and ro_toolbar_rebuild().
| int ro_gui_theme_get_style_element | ( | struct theme_descriptor * | descriptor, |
| theme_style | style, | ||
| theme_element | element | ||
| ) |
Returns an interger element from the specified theme, or the current theme if the descriptor is NULL.
This is an attempt to abstract the theme data from its clients: it should simplify the task of expanding the theme system in the future should this be necessary to include other parts of the RISC OS GUI in the theme system.
| *descriptor | The theme to use, or NULL for the current. |
| style | The style to use. |
| element | The style element to return. |
Definition at line 251 of file theme.c.
References theme_descriptor::browser_background, theme_descriptor::hotlist_background, theme_descriptor::status_background, theme_descriptor::status_foreground, theme_current, THEME_ELEMENT_BACKGROUND, THEME_ELEMENT_FOREGROUND, THEME_STYLE_BROWSER_TOOLBAR, THEME_STYLE_COOKIES_TOOLBAR, THEME_STYLE_GLOBAL_HISTORY_TOOLBAR, THEME_STYLE_HOTLIST_TOOLBAR, THEME_STYLE_NONE, and THEME_STYLE_STATUS_BAR.
Referenced by ro_gui_button_bar_rebuild(), and ro_toolbar_rebuild().
| bool ro_gui_theme_get_throbber_data | ( | struct theme_descriptor * | descriptor, |
| int * | frames, | ||
| int * | width, | ||
| int * | height, | ||
| bool * | right, | ||
| bool * | redraw | ||
| ) |
Returns details of the throbber as defined in a theme.
| *descriptor | The theme of interest (NULL for current). |
| *frames | Return the number of animation frames. |
| *width | Return the throbber width. |
| *height | Return the throbber height. |
| *right | Return the 'locate on right' flag. |
| *redraw | Return the 'forcible redraw' flag. |
Definition at line 325 of file theme.c.
References height, theme_descriptor::theme, theme_current, theme::throbber_frames, theme::throbber_height, theme_descriptor::throbber_redraw, theme_descriptor::throbber_right, theme::throbber_width, and width.
Referenced by ro_gui_throbber_create(), ro_gui_throbber_rebuild(), and ro_toolbar_rebuild().
| void ro_gui_theme_initialise | ( | void | ) |
Initialise the theme handler.
Definition at line 68 of file theme.c.
References nsoption_charp, ro_gui_theme_apply(), ro_gui_theme_find(), ro_gui_theme_get_available(), and theme_descriptors.
Referenced by gui_init().
| bool ro_gui_theme_open | ( | struct theme_descriptor * | descriptor, |
| bool | list | ||
| ) |
Opens a theme ready for use.
| descriptor | the theme_descriptor to open |
| list | whether to open all themes in the list |
Definition at line 488 of file theme.c.
References theme_descriptor::compressed_size, theme_descriptor::decompressed_size, theme_descriptor::filename, mode, theme_descriptor::name, theme_descriptor::next, NSLOG, theme_descriptor::previous, result, ro_convert_pixels_to_os_units(), ro_warn_user(), theme::sprite_area, theme_descriptor::theme, theme::throbber_frames, theme::throbber_height, theme::throbber_width, and theme::users.
Referenced by ro_gui_options_theme_load(), and ro_gui_theme_apply().
| bool ro_gui_theme_read_file_header | ( | struct theme_descriptor * | descriptor, |
| struct theme_file_header * | file_header | ||
| ) |
Fills in the basic details for a descriptor from a file header.
The filename string is not set.
| descriptor | the descriptor to set up |
| file_header | the header to read from |
Definition at line 452 of file theme.c.
References theme_file_header::author, theme_descriptor::author, theme_descriptor::browser_background, theme_file_header::browser_bg, theme_descriptor::compressed_size, theme_file_header::compressed_sprite_size, theme_descriptor::decompressed_size, theme_file_header::decompressed_sprite_size, theme_descriptor::hotlist_background, theme_file_header::hotlist_bg, theme_file_header::magic_value, theme_file_header::name, theme_descriptor::name, theme_file_header::parser_version, theme_descriptor::status_background, theme_file_header::status_bg, theme_file_header::status_fg, theme_descriptor::status_foreground, theme_file_header::theme_flags, theme_descriptor::throbber_redraw, and theme_descriptor::throbber_right.
Referenced by ro_gui_theme_add_descriptor(), and theme_install_read().