NetSurf
|
Progress bar (implementation). More...
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include "swis.h"
#include "oslib/colourtrans.h"
#include "oslib/os.h"
#include "oslib/osspriteop.h"
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "netsurf/plotters.h"
#include "riscos/gui.h"
#include "riscos/tinct.h"
#include "riscos/wimp_event.h"
#include "riscos/gui/progress_bar.h"
Go to the source code of this file.
Data Structures | |
struct | progress_bar |
Macros | |
#define | MARGIN 6 |
Functions | |
static void | ro_gui_progress_bar_calculate (struct progress_bar *pb, int width, int height) |
Calculate the position of the progress bar. More... | |
static void | ro_gui_progress_bar_redraw (wimp_draw *redraw) |
Process a WIMP redraw request. More... | |
static void | ro_gui_progress_bar_redraw_window (wimp_draw *redraw, struct progress_bar *pb) |
Redraw a section of a progress bar window. More... | |
static void | ro_gui_progress_bar_animate (void *p) |
Animate the progress bar. More... | |
void | ro_gui_progress_bar_init (osspriteop_area *icons) |
Initialise the progress bar. More... | |
struct progress_bar * | ro_gui_progress_bar_create (void) |
Create a new progress bar. More... | |
void | ro_gui_progress_bar_destroy (struct progress_bar *pb) |
Destroy a progress bar and free all associated resources. More... | |
wimp_w | ro_gui_progress_bar_get_window (struct progress_bar *pb) |
Get the handle of the window that represents a progress bar. More... | |
void | ro_gui_progress_bar_set_icon (struct progress_bar *pb, const char *icon) |
Set the icon for a progress bar. More... | |
void | ro_gui_progress_bar_set_value (struct progress_bar *pb, unsigned int value) |
Set the value of a progress bar. More... | |
unsigned int | ro_gui_progress_bar_get_value (struct progress_bar *pb) |
Get the value of a progress bar. More... | |
void | ro_gui_progress_bar_set_range (struct progress_bar *pb, unsigned int range) |
Set the range of a progress bar. More... | |
unsigned int | ro_gui_progress_bar_get_range (struct progress_bar *pb) |
Get the range of a progress bar. More... | |
void | ro_gui_progress_bar_update (struct progress_bar *pb, int width, int height) |
Update the progress bar to a new dimension. More... | |
Variables | |
static char | progress_animation_sprite [] = "progress" |
static osspriteop_header * | progress_icon |
static unsigned int | progress_width |
static unsigned int | progress_height |
struct wimp_window_base | progress_bar_definition |
Progress bar (implementation).
Definition in file progress_bar.c.
#define MARGIN 6 |
Definition at line 42 of file progress_bar.c.
|
static |
Animate the progress bar.
p | the progress bar to animate |
Definition at line 371 of file progress_bar.c.
References progress_bar::animating, NSLOG, progress_bar::offset, progress_icon, progress_width, riscos_schedule(), ro_gui_progress_bar_animate(), ro_gui_progress_bar_redraw_window(), progress_bar::visible, and progress_bar::w.
Referenced by ro_gui_progress_bar_animate(), ro_gui_progress_bar_destroy(), and ro_gui_progress_bar_update().
|
static |
Calculate the position of the progress bar.
pb | the progress bar to recalculate |
width | the width of the progress bar |
height | the height of the progress bar |
Definition at line 409 of file progress_bar.c.
References progress_bar::cur_height, progress_bar::cur_width, height, progress_bar::icon, progress_bar::icon_img, progress_bar::icon_obscured, progress_bar::icon_x0, progress_bar::icon_y0, MARGIN, progress_bar_definition, progress_bar::range, progress_bar::recalculate, progress_bar::value, progress_bar::visible, progress_bar::w, and width.
Referenced by ro_gui_progress_bar_redraw_window(), and ro_gui_progress_bar_update().
struct progress_bar * ro_gui_progress_bar_create | ( | void | ) |
Create a new progress bar.
Definition at line 128 of file progress_bar.c.
References NSLOG, progress_bar_definition, ro_gui_progress_bar_redraw(), ro_gui_wimp_event_register_redraw_window(), ro_gui_wimp_event_set_user_data(), and progress_bar::w.
Referenced by ro_gui_status_bar_create().
void ro_gui_progress_bar_destroy | ( | struct progress_bar * | pb | ) |
Destroy a progress bar and free all associated resources.
pb | the progress bar to destroy |
Definition at line 158 of file progress_bar.c.
References progress_bar::animating, NSLOG, riscos_schedule(), ro_gui_progress_bar_animate(), ro_gui_wimp_event_finalise(), and progress_bar::w.
Referenced by ro_gui_status_bar_destroy().
unsigned int ro_gui_progress_bar_get_range | ( | struct progress_bar * | pb | ) |
Get the range of a progress bar.
pb | the progress bar to get the range of |
Definition at line 269 of file progress_bar.c.
References progress_bar::range.
Referenced by ro_gui_status_bar_set_progress_range(), ro_gui_status_bar_set_progress_value(), and ro_gui_status_position_progress_bar().
unsigned int ro_gui_progress_bar_get_value | ( | struct progress_bar * | pb | ) |
Get the value of a progress bar.
pb | the progress bar to get the value of |
Definition at line 238 of file progress_bar.c.
References progress_bar::value.
wimp_w ro_gui_progress_bar_get_window | ( | struct progress_bar * | pb | ) |
Get the handle of the window that represents a progress bar.
pb | the progress bar to get the window handle of |
Definition at line 183 of file progress_bar.c.
References progress_bar::w.
Referenced by ro_gui_status_bar_set_progress_range(), and ro_gui_status_position_progress_bar().
void ro_gui_progress_bar_init | ( | osspriteop_area * | icons | ) |
Initialise the progress bar.
icons | the sprite area to use for icons |
Definition at line 104 of file progress_bar.c.
References progress_animation_sprite, progress_bar_definition, progress_height, progress_icon, and progress_width.
|
static |
Process a WIMP redraw request.
redraw | the redraw request to process |
Definition at line 346 of file progress_bar.c.
References NSLOG, ro_gui_progress_bar_redraw_window(), and ro_gui_wimp_event_get_user_data().
Referenced by ro_gui_progress_bar_create().
|
static |
Redraw a section of a progress bar window.
redraw | the section of the window to redraw |
pb | the progress bar to redraw |
Definition at line 484 of file progress_bar.c.
References clip(), plotter_table::clip, progress_bar::icon, progress_bar::icon_img, progress_bar::icon_obscured, progress_bar::icon_x0, progress_bar::icon_y0, redraw_context::interactive, max, min, NSLOG, progress_bar::offset, redraw_context::plot, plot_style_fill_red, progress_height, progress_icon, plotter_table::rectangle, ro_gui_progress_bar_calculate(), ro_plot_origin_x, ro_plot_origin_y, ro_plotters, tinct_ERROR_DIFFUSE, tinct_FILL_HORIZONTALLY, Tinct_Plot, Tinct_PlotAlpha, and progress_bar::visible.
Referenced by ro_gui_progress_bar_animate(), ro_gui_progress_bar_redraw(), and ro_gui_progress_bar_update().
void ro_gui_progress_bar_set_icon | ( | struct progress_bar * | pb, |
const char * | icon | ||
) |
Set the icon for a progress bar.
pb | the progress bar to set the icon for |
icon | the icon to use, or NULL for no icon |
Definition at line 197 of file progress_bar.c.
References progress_bar::cur_height, progress_bar::cur_width, progress_bar::icon, progress_bar::recalculate, ro_gui_progress_bar_update(), and progress_bar::w.
Referenced by ro_gui_status_bar_set_progress_icon().
void ro_gui_progress_bar_set_range | ( | struct progress_bar * | pb, |
unsigned int | range | ||
) |
Set the range of a progress bar.
pb | the progress bar to set the range for |
range | the range to use |
Definition at line 252 of file progress_bar.c.
References progress_bar::cur_height, progress_bar::cur_width, progress_bar::range, ro_gui_progress_bar_update(), and progress_bar::value.
Referenced by ro_gui_status_bar_set_progress_range().
void ro_gui_progress_bar_set_value | ( | struct progress_bar * | pb, |
unsigned int | value | ||
) |
Set the value of a progress bar.
pb | the progress bar to set the value for |
value | the value to use |
Definition at line 221 of file progress_bar.c.
References progress_bar::cur_height, progress_bar::cur_width, progress_bar::range, ro_gui_progress_bar_update(), and progress_bar::value.
Referenced by ro_gui_status_bar_set_progress_value().
void ro_gui_progress_bar_update | ( | struct progress_bar * | pb, |
int | width, | ||
int | height | ||
) |
Update the progress bar to a new dimension.
pb | the progress bar to update |
width | the new progress bar width |
height | the new progress bar height |
Definition at line 284 of file progress_bar.c.
References progress_bar::animating, height, max, NSLOG, progress_bar::range, progress_bar::recalculate, riscos_schedule(), ro_gui_progress_bar_animate(), ro_gui_progress_bar_calculate(), ro_gui_progress_bar_redraw_window(), progress_bar::value, progress_bar::visible, progress_bar::w, and width.
Referenced by ro_gui_progress_bar_set_icon(), ro_gui_progress_bar_set_range(), ro_gui_progress_bar_set_value(), and ro_gui_status_position_progress_bar().
|
static |
Definition at line 61 of file progress_bar.c.
Referenced by ro_gui_progress_bar_init().
struct wimp_window_base progress_bar_definition |
Definition at line 66 of file progress_bar.c.
Referenced by ro_gui_progress_bar_calculate(), ro_gui_progress_bar_create(), and ro_gui_progress_bar_init().
|
static |
Definition at line 64 of file progress_bar.c.
Referenced by ro_gui_progress_bar_init(), and ro_gui_progress_bar_redraw_window().
|
static |
Definition at line 62 of file progress_bar.c.
Referenced by ro_gui_progress_bar_animate(), ro_gui_progress_bar_init(), and ro_gui_progress_bar_redraw_window().
|
static |
Definition at line 63 of file progress_bar.c.
Referenced by ro_gui_progress_bar_animate(), and ro_gui_progress_bar_init().