27#include "oslib/colourtrans.h"
29#include "oslib/wimp.h"
30#include "oslib/wimpspriteop.h"
45#define WIDGET_WIDTH 12
46#define PROGRESS_WIDTH 160
66 wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE |
67 wimp_WINDOW_FURNITURE_WINDOW |
68 wimp_WINDOW_IGNORE_XEXTENT,
70 wimp_COLOUR_LIGHT_GREY,
71 wimp_COLOUR_LIGHT_GREY,
72 wimp_COLOUR_VERY_LIGHT_GREY,
73 wimp_COLOUR_DARK_GREY,
74 wimp_COLOUR_MID_LIGHT_GREY,
76 wimp_WINDOW_NEVER3D | 0x16u ,
88 wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
89 wimp_ICON_BORDER | wimp_ICON_FILLED |
90 (wimp_COLOUR_LIGHT_GREY <<
91 wimp_ICON_BG_COLOUR_SHIFT) |
92 (wimp_BUTTON_CLICK_DRAG <<
93 wimp_ICON_BUTTON_TYPE_SHIFT),
123 sb = calloc(1,
sizeof(*sb));
131 error = xwimp_create_window((wimp_window *)&status_bar_definition,
134 NSLOG(netsurf, INFO,
"xwimp_create_window: 0x%x: %s",
135 error->errnum, error->errmess);
167 error = xwimp_delete_window(sb->
w);
169 NSLOG(netsurf, INFO,
"xwimp_delete_window: 0x%x:%s",
170 error->errnum, error->errmess);
225 os_error *error = xwimp_close_window(sb->
w);
227 NSLOG(netsurf, INFO,
"xwimp_close_window: 0x%x:%s",
228 error->errnum, error->errmess);
274 unsigned int old_range;
281 NSLOG(netsurf, INFO,
"Ranges are %i vs %i", old_range, range);
282 if ((old_range == 0) && (range != 0)) {
284 }
else if ((old_range != 0) && (range == 0)) {
285 os_error *error = xwimp_close_window(
288 NSLOG(netsurf, INFO,
"xwimp_close_window: 0x%x:%s",
289 error->errnum, error->errmess);
349 int status_width, status_height;
350 wimp_window_state state;
359 error = xwimp_get_window_state(&state);
361 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
362 error->errnum, error->errmess);
365 window_width = state.visible.x1 - state.visible.x0;
369 status_width = (window_width * sb->
scale) / 10000;
375 if (status_width != sb->
width) {
377 int redraw_left, redraw_right;
381 extent.x1 = status_width;
382 extent.y1 = status_height - 4;
383 error = xwimp_set_extent(sb->
w, &extent);
385 NSLOG(netsurf, INFO,
"xwimp_set_extent: 0x%x: %s",
386 error->errnum, error->errmess);
394 state.next = wimp_TOP;
395 state.visible.x0 = state.visible.x0;
396 state.visible.y1 = state.visible.y0 - 2;
397 state.visible.x1 = state.visible.x0 + status_width;
398 state.visible.y0 = state.visible.y1 - status_height + 4;
401 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
402 << wimp_CHILD_XORIGIN_SHIFT |
403 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
404 << wimp_CHILD_YORIGIN_SHIFT |
405 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
406 << wimp_CHILD_LS_EDGE_SHIFT |
407 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
408 << wimp_CHILD_BS_EDGE_SHIFT |
409 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
410 << wimp_CHILD_RS_EDGE_SHIFT |
411 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
412 << wimp_CHILD_TS_EDGE_SHIFT);
415 "xwimp_open_window_nested: 0x%x: %s",
423 status_width, status_height - 4);
425 NSLOG(netsurf, INFO,
"xwimp_resize_icon: 0x%x: %s",
426 error->errnum, error->errmess);
431 redraw_right =
max(status_width, sb->
width);
432 xwimp_force_redraw(sb->
w, redraw_left, 0,
433 redraw_right, status_height);
434 sb->
width = status_width;
452 .background_images =
true,
465 error = xwimp_redraw_window(redraw, &more);
467 NSLOG(netsurf, INFO,
"xwimp_redraw_window: 0x%x: %s",
468 error->errnum, error->errmess);
474 error = xcolourtrans_set_font_colours(font_CURRENT,
475 0xeeeeee00, 0x00000000, 14, 0, 0, 0);
478 "xcolourtrans_set_font_colours: 0x%x: %s",
487 redraw->box.x0 + 6, redraw->box.y0 + 8,
489 if (code != rufl_OK) {
490 if (code == rufl_FONT_MANAGER_ERROR)
492 "rufl_FONT_MANAGER_ERROR: 0x%x: %s",
493 rufl_fm_error->errnum,
494 rufl_fm_error->errmess);
497 "rufl_paint: 0x%x", code);
502 rect.
y0 = -redraw->box.y0 >> 1;
504 rect.
y1 = -redraw->box.y1 >> 1;
511 error = xwimp_get_rectangle(redraw, &more);
513 NSLOG(netsurf, INFO,
"xwimp_get_rectangle: 0x%x: %s",
514 error->errnum, error->errmess);
543 switch (pointer->i) {
546 drag.type = wimp_DRAG_SYSTEM_SIZE;
547 drag.initial.x0 = pointer->pos.x;
548 drag.initial.x1 = pointer->pos.x;
549 drag.initial.y0 = pointer->pos.y;
550 drag.initial.y1 = pointer->pos.y;
551 error = xwimp_drag_box(&drag);
554 "xwimp_drag_box: 0x%x: %s",
572 int window_width, status_width;
573 wimp_window_state state;
579 error = xwimp_get_window_state(&state);
581 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
582 error->errnum, error->errmess);
585 window_width = state.visible.x1 - state.visible.x0;
586 if (window_width == 0)
588 status_width = open->visible.x1 - open->visible.x0;
589 if (status_width <= 12)
593 sb->
scale = (10000 * status_width) / window_width;
594 if (sb->
scale > 10000)
608 wimp_window_state state;
619 error = xwimp_get_window_state(&state);
621 NSLOG(netsurf, INFO,
"xwimp_get_window_state: 0x%x: %s",
622 error->errnum, error->errmess);
634 state.next = wimp_TOP;
635 state.visible.x0 = left;
636 state.visible.x1 = right;
639 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
640 << wimp_CHILD_XORIGIN_SHIFT |
641 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
642 << wimp_CHILD_YORIGIN_SHIFT |
643 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
644 << wimp_CHILD_LS_EDGE_SHIFT |
645 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
646 << wimp_CHILD_BS_EDGE_SHIFT |
647 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
648 << wimp_CHILD_RS_EDGE_SHIFT |
649 wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
650 << wimp_CHILD_TS_EDGE_SHIFT);
652 NSLOG(netsurf, INFO,
"xwimp_open_window: 0x%x: %s",
653 error->errnum, error->errmess);
659 state.
visible.y1 - state.visible.y0);
rufl_style ro_gui_desktop_font_style
int ro_gui_desktop_font_size
char ro_gui_desktop_font_family[80]
desktop font, size and style being used
Target independent plotting interface.
#define NSLOG(catname, level, logmsg, args...)
plot_style_t * plot_style_fill_black
void ro_gui_progress_bar_set_icon(struct progress_bar *pb, const char *icon)
Set the icon for a progress bar.
unsigned int ro_gui_progress_bar_get_range(struct progress_bar *pb)
Get the range of a progress bar.
void ro_gui_progress_bar_update(struct progress_bar *pb, int width, int height)
Update the progress bar to a new dimension.
void ro_gui_progress_bar_set_value(struct progress_bar *pb, unsigned int value)
Set the value of a progress bar.
void ro_gui_progress_bar_destroy(struct progress_bar *pb)
Destroy a progress bar and free all associated resources.
wimp_w ro_gui_progress_bar_get_window(struct progress_bar *pb)
Get the handle of the window that represents a progress bar.
struct progress_bar * ro_gui_progress_bar_create(void)
Create a new progress bar.
void ro_gui_progress_bar_set_range(struct progress_bar *pb, unsigned int range)
Set the range of a progress bar.
Progress bar (interface).
nserror riscos_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
const struct plotter_table ro_plotters
RISC OS plotter operation table.
unsigned int ro_gui_status_bar_get_width(struct status_bar *sb)
Get the proportional width the status bar is currently using.
void ro_gui_status_bar_resize(struct status_bar *sb)
Resize a status bar following a change in the dimensions of the parent window.
void ro_gui_status_bar_set_progress_range(struct status_bar *sb, unsigned int range)
Set the range of the progress bar.
wimp_w ro_gui_status_bar_get_window(struct status_bar *sb)
Get the handle of the window that represents a status bar.
void ro_gui_status_bar_set_text(struct status_bar *sb, const char *text)
Set the text to display in the status bar.
static void ro_gui_status_bar_redraw(wimp_draw *redraw)
Process a WIMP redraw request.
void ro_gui_status_bar_set_progress_icon(struct status_bar *sb, const char *icon)
Set the icon for the progress bar.
static char status_widget_validation[]
static char status_widget_text[]
static void ro_gui_status_bar_redraw_callback(void *handle)
Callback for scheduled redraw.
void ro_gui_status_bar_set_visible(struct status_bar *sb, bool visible)
Set the visibility status of the status bar.
bool ro_gui_status_bar_get_visible(struct status_bar *sb)
Get the visibility status of the status bar.
static bool ro_gui_status_bar_click(wimp_pointer *pointer)
Process an mouse_click event for a status window.
struct status_bar * ro_gui_status_bar_create(wimp_w parent, unsigned int width)
Create a new status bar.
void ro_gui_status_bar_set_progress_value(struct status_bar *sb, unsigned int value)
Set the value of the progress bar.
static void ro_gui_status_bar_open(wimp_open *open)
Process an open_window request for a status window.
void ro_gui_status_bar_destroy(struct status_bar *sb)
Destroy a status bar and free all associated resources.
static void ro_gui_status_position_progress_bar(struct status_bar *sb)
Reposition the progress component following a change in the dimension of the status window.
UTF8 status bar (interface).
Interface to utility string handling.
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
os_box visible
progress bar position
const struct plotter_table * plot
Current plot operation table.
bool interactive
Redraw to show interactive features.
bool visible
status bar is visible?
wimp_w w
status bar window handle
const char * text
status bar text
unsigned int scale
current status bar scale
wimp_w parent
parent window handle
int width
current status bar width
struct progress_bar * pb
progress bar
Interface to a number of general purpose functionality.
int ro_get_hscroll_height(wimp_w w)
Gets the horizontal scrollbar height.
General RISC OS WIMP/OS library functions (interface).
bool ro_gui_wimp_event_set_help_prefix(wimp_w w, const char *help_prefix)
Set the associated help prefix for a given window.
bool ro_gui_wimp_event_register_redraw_window(wimp_w w, void(*callback)(wimp_draw *redraw))
Register a function to be called for all window redraw operations.
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
bool ro_gui_wimp_event_register_mouse_click(wimp_w w, bool(*callback)(wimp_pointer *pointer))
Register a function to be called for all mouse-clicks to icons in a window that don't have registered...
bool ro_gui_wimp_event_set_user_data(wimp_w w, void *user)
Sets the user data associated with a window.
bool ro_gui_wimp_event_register_open_window(wimp_w w, void(*callback)(wimp_open *open))
Register a function to be called for all window opening requests.
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.