1 /*
2  * Copyright 2005 Richard Wilson <info@tinct.net>
3  *
4  * This file is part of NetSurf, http://www.netsurf-browser.org/
5  *
6  * NetSurf is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * NetSurf is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 /** \file
20  * Window themes(interface).
21  */
22 
23 #include <stdbool.h>
24 #include "oslib/osspriteop.h"
25 
26 #ifndef _NETSURF_RISCOS_THEME_H_
27 #define _NETSURF_RISCOS_THEME_H_
28 
29 /** Theme styles, collecting groups of attributes for different locations. */
30 
31 typedef enum {
32 	THEME_STYLE_NONE = 0,
33 	THEME_STYLE_BROWSER_TOOLBAR,
34 	THEME_STYLE_HOTLIST_TOOLBAR,
35 	THEME_STYLE_COOKIES_TOOLBAR,
36 	THEME_STYLE_GLOBAL_HISTORY_TOOLBAR,
37 	THEME_STYLE_STATUS_BAR
38 } theme_style;
39 
40 /** Theme elements, which belong to styles. */
41 
42 typedef enum {
43 	THEME_ELEMENT_FOREGROUND,
44 	THEME_ELEMENT_BACKGROUND
45 } theme_element;
46 
47 struct theme_file_header {
48 	unsigned int magic_value;
49 	unsigned int parser_version;
50 	char name[32];
51 	char author[64];
52 	char browser_bg;
53 	char hotlist_bg;
54 	char status_bg;
55 	char status_fg;
56 	char theme_flags;
57 	char future_expansion_1;
58 	char future_expansion_2;
59 	char future_expansion_3;
60 	unsigned int compressed_sprite_size;
61 	unsigned int decompressed_sprite_size;
62 };
63 
64 struct theme {
65 	osspriteop_area *sprite_area;		/**< sprite area for theme */
66 	int throbber_width;			/**< width of the throbber */
67 	int throbber_height;			/**< height of the throbber */
68 	int throbber_frames;			/**< frames of animation for the throbber */
69 	int users;				/**< number of users for the theme */
70 };
71 
72 struct theme_descriptor {
73 	char *leafname;				/**< theme leafname */
74 	char *filename;				/**< theme filename */
75 	char name[32];				/**< theme name */
76 	char author[64];			/**< theme author */
77 	int browser_background;			/**< background colour of browser toolbar */
78 	int hotlist_background;			/**< background colour of hotlist toolbar */
79 	int status_background;			/**< background colour of status window */
80 	int status_foreground;			/**< colour of status window text */
81 	bool throbber_right;			/**< throbber is on the right (left otherwise) */
82 	bool throbber_redraw;			/**< throbber requires forcible updating */
83 	unsigned int decompressed_size;		/**< decompressed sprite size */
84 	unsigned int compressed_size;		/**< compressed sprite size */
85 	struct theme *theme;			/**< corresponding theme (must be opened) */
86 	struct theme_descriptor *previous;	/**< previous descriptor in the list */
87 	struct theme_descriptor *next;		/**< next descriptor in the list */
88 };
89 
90 void ro_gui_theme_initialise(void);
91 void ro_gui_theme_finalise(void);
92 struct theme_descriptor *ro_gui_theme_find(const char *leafname);
93 struct theme_descriptor *ro_gui_theme_get_available(void);
94 struct theme_descriptor *ro_gui_theme_get_current(void);
95 osspriteop_area *ro_gui_theme_get_sprites(struct theme_descriptor *descriptor);
96 int ro_gui_theme_get_style_element(struct theme_descriptor *descriptor,
97 		theme_style style, theme_element element);
98 bool ro_gui_theme_get_throbber_data(struct theme_descriptor *descriptor,
99 		int *frames, int *width, int *height,
100 		bool *right, bool *redraw);
101 
102 bool ro_gui_theme_read_file_header(struct theme_descriptor *descriptor,
103 		struct theme_file_header *file_header);
104 
105 bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list);
106 bool ro_gui_theme_apply(struct theme_descriptor *descriptor);
107 void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list);
108 #endif
109 
110