2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
2005-02-08 02:00:09 +03:00
|
|
|
* Copyright 2005 Richard Wilson <info@tinct.net>
|
2003-06-06 06:14:28 +04:00
|
|
|
*/
|
|
|
|
|
2003-11-20 03:16:31 +03:00
|
|
|
/** \file
|
2004-08-31 01:03:48 +04:00
|
|
|
* Window themes and toolbars (interface).
|
2003-11-20 03:16:31 +03:00
|
|
|
*/
|
2002-10-15 14:47:44 +04:00
|
|
|
|
2004-08-31 01:03:48 +04:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2003-11-20 03:16:31 +03:00
|
|
|
#ifndef _NETSURF_RISCOS_THEME_H_
|
|
|
|
#define _NETSURF_RISCOS_THEME_H_
|
2002-10-15 14:47:44 +04:00
|
|
|
|
2004-08-31 01:03:48 +04:00
|
|
|
typedef enum {
|
|
|
|
THEME_BROWSER_TOOLBAR,
|
2005-02-07 17:28:43 +03:00
|
|
|
THEME_HOTLIST_TOOLBAR,
|
2005-03-20 17:57:19 +03:00
|
|
|
THEME_HISTORY_TOOLBAR,
|
|
|
|
THEME_BROWSER_EDIT_TOOLBAR,
|
|
|
|
THEME_HOTLIST_EDIT_TOOLBAR,
|
|
|
|
THEME_HISTORY_EDIT_TOOLBAR
|
2004-08-31 01:03:48 +04:00
|
|
|
} toolbar_type;
|
|
|
|
|
2005-01-23 19:09:05 +03:00
|
|
|
struct theme_file_header {
|
|
|
|
unsigned int magic_value;
|
|
|
|
unsigned int parser_version;
|
|
|
|
char name[32];
|
|
|
|
char author[64];
|
|
|
|
char browser_bg;
|
|
|
|
char hotlist_bg;
|
|
|
|
char status_bg;
|
|
|
|
char status_fg;
|
|
|
|
char theme_flags;
|
|
|
|
char future_expansion_1;
|
|
|
|
char future_expansion_2;
|
|
|
|
char future_expansion_3;
|
|
|
|
unsigned int compressed_sprite_size;
|
|
|
|
unsigned int decompressed_sprite_size;
|
|
|
|
};
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
struct toolbar_icon {
|
|
|
|
int icon_number; /**< wimp icon number */
|
|
|
|
bool display; /**< whether to display the icon */
|
|
|
|
int x; /**< icon x position (valid only when displayed) */
|
|
|
|
int y; /**< icon y position (valid only when displayed) */
|
|
|
|
int width; /**< icon width */
|
|
|
|
int height; /**< icon height */
|
|
|
|
char name[12]; /**< icon name */
|
|
|
|
char validation[40]; /**< validation string */
|
|
|
|
struct toolbar_icon *next; /**< next toolbar icon, or NULL for no more */
|
|
|
|
};
|
2004-08-31 01:03:48 +04:00
|
|
|
|
2004-09-08 03:05:34 +04:00
|
|
|
struct theme {
|
|
|
|
osspriteop_area *sprite_area; /**< sprite area for theme */
|
|
|
|
int throbber_width; /**< width of the throbber */
|
|
|
|
int throbber_height; /**< height of the throbber */
|
|
|
|
int throbber_frames; /**< frames of animation for the throbber */
|
|
|
|
int users; /**< number of users for the theme */
|
2004-08-31 01:03:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct toolbar {
|
|
|
|
int status_width; /**< status width percentage * 100 */
|
|
|
|
bool display_buttons; /**< display standard buttons */
|
|
|
|
bool display_url; /**< display URL bar (if applicable) */
|
|
|
|
bool display_throbber; /**< display throbber (if applicable) */
|
|
|
|
bool display_status; /**< display status bar (if applicable) */
|
|
|
|
int status_current; /**< the size of the status window in OS units */
|
|
|
|
int toolbar_current; /**< the size of the toolbar window in OS units */
|
|
|
|
int height; /**< vertical extent of the toolbar (read only) */
|
2005-03-19 02:52:38 +03:00
|
|
|
int max_height; /**< allowed vertical extent (read only) */
|
2004-08-31 01:03:48 +04:00
|
|
|
wimp_w toolbar_handle; /**< toolbar window handle */
|
|
|
|
wimp_w status_handle; /**< status window handle (if applicable) */
|
|
|
|
wimp_w parent_handle; /**< parent window handle (read only) */
|
|
|
|
bool reformat_buttons; /**< buttons need reformatting */
|
|
|
|
char *url_buffer; /**< buffer for status text (read only) */
|
|
|
|
char *throbber_buffer; /**< buffer for status text (read only) */
|
|
|
|
char *status_buffer; /**< buffer for status text (read only) */
|
|
|
|
struct toolbar_icon *icon; /**< first toolbar icon (read only) */
|
2005-02-07 17:28:43 +03:00
|
|
|
struct toolbar_icon *suggest; /**< suggestion toolbar icon (read only) */
|
2004-09-08 03:05:34 +04:00
|
|
|
struct theme_descriptor *descriptor; /**< theme descriptor (read only) */
|
2004-08-31 01:03:48 +04:00
|
|
|
toolbar_type type; /**< toolbar type (read only) */
|
2005-03-20 17:57:19 +03:00
|
|
|
struct toolbar *editor; /**< toolbar editor */
|
2004-08-31 01:03:48 +04:00
|
|
|
};
|
|
|
|
|
2004-09-08 03:05:34 +04:00
|
|
|
struct theme_descriptor {
|
2005-02-08 02:00:09 +03:00
|
|
|
char *leafname; /**< theme leafname */
|
|
|
|
char *filename; /**< theme filename */
|
2004-09-08 03:05:34 +04:00
|
|
|
char name[32]; /**< theme name */
|
|
|
|
char author[64]; /**< theme author */
|
2004-08-31 01:03:48 +04:00
|
|
|
int browser_background; /**< background colour of browser toolbar */
|
|
|
|
int hotlist_background; /**< background colour of hotlist toolbar */
|
|
|
|
int status_background; /**< background colour of status window */
|
|
|
|
int status_foreground; /**< colour of status window text */
|
2004-09-08 03:05:34 +04:00
|
|
|
bool throbber_right; /**< throbber is on the right (left otherwise) */
|
2005-01-23 19:09:05 +03:00
|
|
|
bool throbber_redraw; /**< throbber requires forcible updating */
|
2004-09-08 03:05:34 +04:00
|
|
|
unsigned int decompressed_size; /**< decompressed sprite size */
|
|
|
|
unsigned int compressed_size; /**< compressed sprite size */
|
2004-08-31 01:03:48 +04:00
|
|
|
struct theme *theme; /**< corresponding theme (must be opened) */
|
|
|
|
struct theme_descriptor *previous; /**< previous descriptor in the list */
|
|
|
|
struct theme_descriptor *next; /**< next descriptor in the list */
|
2004-08-09 00:16:17 +04:00
|
|
|
};
|
2002-10-15 14:47:44 +04:00
|
|
|
|
2004-08-31 01:03:48 +04:00
|
|
|
void ro_gui_theme_initialise(void);
|
|
|
|
void ro_gui_theme_finalise(void);
|
2005-02-08 02:00:09 +03:00
|
|
|
struct theme_descriptor *ro_gui_theme_find(const char *leafname);
|
2004-08-31 01:03:48 +04:00
|
|
|
struct theme_descriptor *ro_gui_theme_get_available(void);
|
2005-01-23 19:09:05 +03:00
|
|
|
bool ro_gui_theme_read_file_header(struct theme_descriptor *descriptor,
|
|
|
|
struct theme_file_header *file_header);
|
2004-08-31 01:03:48 +04:00
|
|
|
|
|
|
|
bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list);
|
|
|
|
bool ro_gui_theme_apply(struct theme_descriptor *descriptor);
|
|
|
|
void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list);
|
2004-11-04 04:19:46 +03:00
|
|
|
void ro_gui_theme_redraw(struct toolbar *toolbar, wimp_draw *redraw);
|
2004-08-31 01:03:48 +04:00
|
|
|
|
|
|
|
struct toolbar *ro_gui_theme_create_toolbar(struct theme_descriptor *descriptor, toolbar_type type);
|
|
|
|
bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor, struct toolbar *toolbar);
|
|
|
|
bool ro_gui_theme_attach_toolbar(struct toolbar *toolbar, wimp_w parent);
|
|
|
|
void ro_gui_theme_resize_toolbar_status(struct toolbar *toolbar);
|
|
|
|
bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width);
|
|
|
|
void ro_gui_theme_destroy_toolbar(struct toolbar *toolbar);
|
|
|
|
|
2005-03-20 17:57:19 +03:00
|
|
|
void ro_gui_theme_toggle_edit(struct toolbar *toolbar);
|
|
|
|
void ro_gui_theme_toolbar_editor_sync(struct toolbar *toolbar);
|
|
|
|
void ro_gui_theme_toolbar_editor_click(struct toolbar *toolbar, wimp_pointer *pointer);
|
|
|
|
void ro_gui_theme_toolbar_editor_drag_end(wimp_dragged *drag);
|
|
|
|
|
2004-10-05 03:54:42 +04:00
|
|
|
struct toolbar_icon *ro_gui_theme_toolbar_get_icon(struct toolbar *toolbar, int x, int y);
|
2003-03-04 14:59:36 +03:00
|
|
|
|
2005-03-20 17:57:19 +03:00
|
|
|
#define ro_gui_theme_toolbar_height(toolbar) toolbar->height + \
|
|
|
|
(toolbar->editor ? toolbar->editor->height : 0) > toolbar->max_height ? \
|
|
|
|
toolbar->max_height : toolbar->height + \
|
|
|
|
(toolbar->editor ? toolbar->editor->height : 0)
|
|
|
|
#define ro_gui_theme_toolbar_full_height(toolbar) toolbar->height + \
|
|
|
|
(toolbar->editor ? toolbar->editor->height : 0)
|
2002-10-15 14:47:44 +04:00
|
|
|
#endif
|