summaryrefslogtreecommitdiff
path: root/riscos/gui/throbber.h
blob: 10d39ebfda0f3ee0db3182d01008ea9988986b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * Copyright 2005 Richard Wilson <info@tinct.net>
 * Copyright 2011 Stephen Fryatt <stevef@netsurf-browser.org>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * NetSurf is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * NetSurf is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/** \file
 * Throbber (interface).
 */

#ifndef _NETSURF_RISCOS_THROBBER_H_
#define _NETSURF_RISCOS_THROBBER_H_

#include <stdbool.h>
#include "riscos/theme.h"

struct throbber;


/**
 * Create a new throbber widget.
 *
 * \param *theme		The theme to apply (or NULL for the default).
 * \return			A throbber handle, or NULL on failure.
 */

struct throbber *ro_gui_throbber_create(struct theme_descriptor *theme);

/**
 * Place a throbber into a toolbar window and initialise any theme-specific
 * settings.  Any previous incarnation of the throbber 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.
 *
 * \param *throbber		The throbber to rebuild.
 * \param *theme		The theme to apply (or NULL for current).
 * \param style			The theme style to apply.
 * \param window		The window that the throbber is in.
 * \param shaded		true if the bar should be throbber; else false.
 * \return			true on success; else false.
 */

bool ro_gui_throbber_rebuild(struct throbber *throbber,
		struct theme_descriptor *theme, theme_style style,
		wimp_w window, bool shaded);


/**
 * Destroy a throbber widget.
 *
 * \param *throbber		The throbber to destroy.
 */

void ro_gui_throbber_destroy(struct throbber *throbber);


/**
 * Return the MINIMUM dimensions required by the throbber, in RO units,
 * allowing for the current theme.
 *
 * \param *throbber		The throbber of interest.
 * \param *width		Return the required width.
 * \param *height		Return the required height.
 * \return			true if values are returned; else false.
 */

bool ro_gui_throbber_get_dims(struct throbber *throbber,
		int *width, int *height);


/**
 * Set or update the dimensions to be used by the throbber, in RO units.
 * If these are greater than the minimum required, the throbber will fill
 * the extended space; if less, the call will fail.
 *
 * \param *throbber		The throbber to update.
 * \param width			The desired width.
 * \param height		The desired height.
 * \return			true if size updated; else false.
 */

bool ro_gui_throbber_set_extent(struct throbber *throbber,
		int x0, int y0, int x1, int y1);


/**
 * Show or hide a throbber.
 *
 * \param *throbber		The throbber to hide.
 * \param hide			true to hide the throbber; false to show it.
 * \return			true if successful; else false.
 */

bool ro_gui_throbber_hide(struct throbber *throbber, bool hide);


/**
 * Translate mouse data into an interactive help message for the throbber.
 *
 * \param *throbber		The throbber to process.
 * \param i			The wimp icon under the pointer.
 * \param *mouse		The mouse position.
 * \param *state		The toolbar window state.
 * \param buttons		The mouse button state.
 * \param **suffix		Return a help token suffix, or "" for none.
 * \return			true if handled exclusively; else false.
 */

bool ro_gui_throbber_help_suffix(struct throbber *throbber, wimp_i i,
		os_coord *screenpos, wimp_window_state *state,
		wimp_mouse_state buttons, const char **suffix);

/**
 * Start or update the amimation of a throbber.
 *
 * \param *throbber		The throbber to amimate.
 */

bool ro_gui_throbber_animate(struct throbber *throbber);


/**
 * Stop the amimation of a throbber.
 *
 * \param *throbber		The throbber to amimate.
 */

bool ro_gui_throbber_stop(struct throbber *throbber);

#endif