NetSurf
status_bar.c
Go to the documentation of this file.
1/*
2 * Copyright 2006 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 * UTF8 status bar (implementation).
21 */
22
23#include <assert.h>
24#include <stdbool.h>
25#include <string.h>
26#include "swis.h"
27#include "oslib/colourtrans.h"
28#include "oslib/os.h"
29#include "oslib/wimp.h"
30#include "oslib/wimpspriteop.h"
31
32#include "utils/log.h"
33#include "utils/utils.h"
34#include "netsurf/plotters.h"
35
36#include "riscos/gui.h"
37#include "riscos/wimp.h"
38#include "riscos/wimp_event.h"
39#include "riscos/wimputils.h"
40#include "riscos/font.h"
43
44#define ICON_WIDGET 0
45#define WIDGET_WIDTH 12
46#define PROGRESS_WIDTH 160
47
48struct status_bar {
49 wimp_w w; /**< status bar window handle */
50 wimp_w parent; /**< parent window handle */
51 const char *text; /**< status bar text */
52 struct progress_bar *pb; /**< progress bar */
53 unsigned int scale; /**< current status bar scale */
54 int width; /**< current status bar width */
55 bool visible; /**< status bar is visible? */
56};
57
58static char status_widget_text[] = "";
59static char status_widget_validation[] = "R5;Pptr_lr,8,6";
60
61wimp_WINDOW(1) status_bar_definition = {
62 {0, 0, 1, 1},
63 0,
64 0,
65 wimp_TOP,
66 wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE |
67 wimp_WINDOW_FURNITURE_WINDOW |
68 wimp_WINDOW_IGNORE_XEXTENT,
69 wimp_COLOUR_BLACK,
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,
75 wimp_COLOUR_CREAM,
76 wimp_WINDOW_NEVER3D | 0x16u /* RISC OS 5.03+ */,
77 {0, 0, 65535, 65535},
78 0,
79 0,
80 wimpspriteop_AREA,
81 1,
82 1,
83 {""},
84 1,
85 {
86 {
87 {0, 0, 1, 1},
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),
94 {
95 .indirected_text = {
98 1
99 }
100 }
101 }
102 }
103};
104
105static void ro_gui_status_bar_open(wimp_open *open);
106static bool ro_gui_status_bar_click(wimp_pointer *pointer);
107static void ro_gui_status_bar_redraw(wimp_draw *redraw);
108static void ro_gui_status_bar_redraw_callback(void *handle);
109static void ro_gui_status_position_progress_bar(struct status_bar *sb);
110
111
112/**
113 * Create a new status bar
114 *
115 * \param parent the window to contain the status bar
116 * \param width the proportional width to use (0...10,000)
117 */
118struct status_bar *ro_gui_status_bar_create(wimp_w parent, unsigned int width)
119{
120 struct status_bar *sb;
121 os_error *error;
122
123 sb = calloc(1, sizeof(*sb));
124 if (!sb)
125 return NULL;
126
128 if (!sb->pb)
129 return NULL;
130
131 error = xwimp_create_window((wimp_window *)&status_bar_definition,
132 &sb->w);
133 if (error) {
134 NSLOG(netsurf, INFO, "xwimp_create_window: 0x%x: %s",
135 error->errnum, error->errmess);
136 free(sb);
137 return NULL;
138 }
139 sb->parent = parent;
140 sb->scale = width;
141 sb->visible = true;
142
150 ro_gui_wimp_event_set_help_prefix(sb->w, "HelpStatus");
152 return sb;
153}
154
155
156/**
157 * Destroy a status bar and free all associated resources
158 *
159 * \param sb the status bar to destroy
160 */
162{
163 os_error *error;
164 assert(sb);
165
167 error = xwimp_delete_window(sb->w);
168 if (error) {
169 NSLOG(netsurf, INFO, "xwimp_delete_window: 0x%x:%s",
170 error->errnum, error->errmess);
171 }
172
174
175 /* Remove any scheduled redraw callbacks */
177
178 free(sb);
179}
180
181
182/**
183 * Get the handle of the window that represents a status bar
184 *
185 * \param sb the status bar to get the window handle of
186 * \return the status bar's window handle
187 */
189{
190 assert(sb);
191
192 return sb->w;
193}
194
195
196/**
197 * Get the proportional width the status bar is currently using
198 *
199 * \param sb the status bar to get the width of
200 * \return the status bar's width (0...10,000)
201 */
203{
204 assert(sb);
205
206 return sb->scale;
207}
208
209
210/**
211 * Set the visibility status of the status bar
212 *
213 * \param sb the status bar to check the visiblity of
214 * \param visible if the status bar should be shown or not.
215 * \return whether the status bar is visible
216 */
218{
219 assert(sb);
220
221 sb->visible = visible;
222 if (visible) {
224 } else {
225 os_error *error = xwimp_close_window(sb->w);
226 if (error) {
227 NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s",
228 error->errnum, error->errmess);
229 }
230 }
231}
232
233
234/**
235 * Get the visibility status of the status bar
236 *
237 * \param sb the status bar to check the visiblity of
238 * \return whether the status bar is visible
239 */
241{
242 assert(sb);
243
244 return sb->visible;
245}
246
247
248/**
249 * Set the value of the progress bar
250 *
251 * \param sb the status bar to set the progress of
252 * \param value the value to use
253 */
255 unsigned int value)
256{
257 assert(sb);
258
262}
263
264
265/**
266 * Set the range of the progress bar
267 *
268 * \param sb the status bar to set the range of
269 * \param range the range of the progress bar
270 */
272 unsigned int range)
273{
274 unsigned int old_range;
275
276 assert(sb);
277
278 old_range = ro_gui_progress_bar_get_range(sb->pb);
280
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(
287 if (error) {
288 NSLOG(netsurf, INFO, "xwimp_close_window: 0x%x:%s",
289 error->errnum, error->errmess);
290 }
291 }
292}
293
294
295/**
296 * Set the icon for the progress bar
297 *
298 * \param sb the status bar to set the icon for
299 * \param icon the icon to use, or NULL for no icon
300 */
302 const char *icon)
303{
304 assert(sb);
305
307}
308
309
310/**
311 * Set the text to display in the status bar
312 *
313 * \param sb the status bar to set the text for
314 * \param text the UTF8 text to display, or NULL for none
315 */
316void ro_gui_status_bar_set_text(struct status_bar *sb, const char *text)
317{
318 assert(sb);
319
320 sb->text = text;
321
322 /* Schedule a window redraw for 1cs' time.
323 *
324 * We do this to ensure that redraws as a result of text changes
325 * do not prevent other applications obtaining CPU time.
326 *
327 * The scheduled callback will be run when we receive the first
328 * null poll after 1cs has elapsed. It may then issue a redraw
329 * request to the Wimp.
330 *
331 * The scheduler ensures that only one instance of the
332 * { callback, handle } pair is registered at once.
333 */
334 if (sb->visible && text != NULL) {
336 }
337}
338
339
340/**
341 * Resize a status bar following a change in the dimensions of the
342 * parent window.
343 *
344 * \param sb the status bar to resize
345 */
347{
348 int window_width;
349 int status_width, status_height;
350 wimp_window_state state;
351 os_error *error;
352 os_box extent;
353
354 if ((!sb) || (!sb->visible))
355 return;
356
357 /* get the window work area dimensions */
358 state.w = sb->parent;
359 error = xwimp_get_window_state(&state);
360 if (error) {
361 NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
362 error->errnum, error->errmess);
363 return;
364 }
365 window_width = state.visible.x1 - state.visible.x0;
366
367
368 /* recalculate the scaled width */
369 status_width = (window_width * sb->scale) / 10000;
370 if (status_width < WIDGET_WIDTH)
371 status_width = WIDGET_WIDTH;
372 status_height = ro_get_hscroll_height(sb->parent);
373
374 /* resize the status/resize icons */
375 if (status_width != sb->width) {
376 /* update the window extent */
377 int redraw_left, redraw_right;
378
379 extent.x0 = 0;
380 extent.y0 = 0;
381 extent.x1 = status_width;
382 extent.y1 = status_height - 4;
383 error = xwimp_set_extent(sb->w, &extent);
384 if (error) {
385 NSLOG(netsurf, INFO, "xwimp_set_extent: 0x%x: %s",
386 error->errnum, error->errmess);
387 return;
388 }
389
390 /* re-open the nested window */
391 state.w = sb->w;
392 state.xscroll = 0;
393 state.yscroll = 0;
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;
399 error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state),
400 sb->parent,
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);
413 if (error) {
414 NSLOG(netsurf, INFO,
415 "xwimp_open_window_nested: 0x%x: %s",
416 error->errnum,
417 error->errmess);
418 return;
419 }
421 error = xwimp_resize_icon(sb->w, ICON_WIDGET,
422 status_width - WIDGET_WIDTH, 0,
423 status_width, status_height - 4);
424 if (error) {
425 NSLOG(netsurf, INFO, "xwimp_resize_icon: 0x%x: %s",
426 error->errnum, error->errmess);
427 return;
428 }
429
430 redraw_left = min(status_width, sb->width) - WIDGET_WIDTH - 2;
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;
435 }
436}
437
438
439/**
440 * Process a WIMP redraw request
441 *
442 * \param redraw the redraw request to process
443 */
444void ro_gui_status_bar_redraw(wimp_draw *redraw)
445{
446 struct status_bar *sb;
447 os_error *error;
448 osbool more;
449 rufl_code code;
450 struct redraw_context ctx = {
451 .interactive = true,
452 .background_images = true,
453 .plot = &ro_plotters
454 };
455 struct rect rect;
456
457 sb = (struct status_bar *)ro_gui_wimp_event_get_user_data(redraw->w);
458 assert(sb);
459
460 /* initialise the plotters */
463
464 /* redraw the window */
465 error = xwimp_redraw_window(redraw, &more);
466 if (error) {
467 NSLOG(netsurf, INFO, "xwimp_redraw_window: 0x%x: %s",
468 error->errnum, error->errmess);
469 return;
470 }
471 while (more) {
472 /* redraw the status text */
473 if (sb->text) {
474 error = xcolourtrans_set_font_colours(font_CURRENT,
475 0xeeeeee00, 0x00000000, 14, 0, 0, 0);
476 if (error) {
477 NSLOG(netsurf, INFO,
478 "xcolourtrans_set_font_colours: 0x%x: %s",
479 error->errnum,
480 error->errmess);
481 return;
482 }
483 code = rufl_paint(ro_gui_desktop_font_family,
486 sb->text, strlen(sb->text),
487 redraw->box.x0 + 6, redraw->box.y0 + 8,
488 rufl_BLEND_FONT);
489 if (code != rufl_OK) {
490 if (code == rufl_FONT_MANAGER_ERROR)
491 NSLOG(netsurf, INFO,
492 "rufl_FONT_MANAGER_ERROR: 0x%x: %s",
493 rufl_fm_error->errnum,
494 rufl_fm_error->errmess);
495 else
496 NSLOG(netsurf, INFO,
497 "rufl_paint: 0x%x", code);
498 }
499 }
500
501 rect.x0 = (redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1;
502 rect.y0 = -redraw->box.y0 >> 1;
503 rect.x1 = (redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1;
504 rect.y1 = -redraw->box.y1 >> 1;
505
506 /* separate the widget from the text with a line */
507 ctx.plot->rectangle(&ctx,
509 &rect);
510
511 error = xwimp_get_rectangle(redraw, &more);
512 if (error) {
513 NSLOG(netsurf, INFO, "xwimp_get_rectangle: 0x%x: %s",
514 error->errnum, error->errmess);
515 return;
516 }
517 }
518}
519
520/**
521 * Callback for scheduled redraw
522 *
523 * \param handle Callback handle
524 */
526{
527 struct status_bar *sb = handle;
528
529 wimp_force_redraw(sb->w, 0, 0, sb->width - WIDGET_WIDTH, 65536);
530}
531
532
533/**
534 * Process an mouse_click event for a status window.
535 *
536 * \param pointer details of the mouse click
537 */
538bool ro_gui_status_bar_click(wimp_pointer *pointer)
539{
540 wimp_drag drag;
541 os_error *error;
542
543 switch (pointer->i) {
544 case ICON_WIDGET:
545 drag.w = pointer->w;
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);
552 if (error) {
553 NSLOG(netsurf, INFO,
554 "xwimp_drag_box: 0x%x: %s",
555 error->errnum,
556 error->errmess);
557 }
558 break;
559 }
560 return true;
561}
562
563
564/**
565 * Process an open_window request for a status window.
566 *
567 * \param open the request to process
568 */
569void ro_gui_status_bar_open(wimp_open *open)
570{
571 struct status_bar *sb;
572 int window_width, status_width;
573 wimp_window_state state;
574 os_error *error;
575
576 /* get the parent width for scaling */
577 sb = (struct status_bar *)ro_gui_wimp_event_get_user_data(open->w);
578 state.w = sb->parent;
579 error = xwimp_get_window_state(&state);
580 if (error) {
581 NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
582 error->errnum, error->errmess);
583 return;
584 }
585 window_width = state.visible.x1 - state.visible.x0;
586 if (window_width == 0)
587 window_width = 1;
588 status_width = open->visible.x1 - open->visible.x0;
589 if (status_width <= 12)
590 status_width = 0;
591
592 /* store the new size */
593 sb->scale = (10000 * status_width) / window_width;
594 if (sb->scale > 10000)
595 sb->scale = 10000;
597}
598
599
600/**
601 * Reposition the progress component following a change in the
602 * dimension of the status window.
603 *
604 * \param sb the status bar to update
605 */
607{
608 wimp_window_state state;
609 os_error *error;
610 int left, right;
611
612 if (!sb)
613 return;
614 if (ro_gui_progress_bar_get_range(sb->pb) == 0)
615 return;
616
617 /* get the window work area dimensions */
618 state.w = sb->w;
619 error = xwimp_get_window_state(&state);
620 if (error) {
621 NSLOG(netsurf, INFO, "xwimp_get_window_state: 0x%x: %s",
622 error->errnum, error->errmess);
623 return;
624 }
625
626 /* calculate the dimensions */
627 right = state.visible.x1 - WIDGET_WIDTH - 2;
628 left = max(state.visible.x0, right - PROGRESS_WIDTH);
629
630 /* re-open the nested window */
631 state.w = ro_gui_progress_bar_get_window(sb->pb);
632 state.xscroll = 0;
633 state.yscroll = 0;
634 state.next = wimp_TOP;
635 state.visible.x0 = left;
636 state.visible.x1 = right;
637 error = xwimp_open_window_nested(PTR_WIMP_OPEN(&state),
638 sb->w,
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);
651 if (error) {
652 NSLOG(netsurf, INFO, "xwimp_open_window: 0x%x: %s",
653 error->errnum, error->errmess);
654 }
655
656 /* update the progress bar display on non-standard width */
657 if ((right - left) != PROGRESS_WIDTH)
658 ro_gui_progress_bar_update(sb->pb, right - left,
659 state.visible.y1 - state.visible.y0);
660}
wimp_w parent
Definition: dialog.c:88
rufl_style ro_gui_desktop_font_style
Definition: font.c:47
int ro_gui_desktop_font_size
Definition: font.c:46
char ro_gui_desktop_font_family[80]
desktop font, size and style being used
Definition: font.c:45
RISC OS font interface.
Target independent plotting interface.
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
plot_style_t * plot_style_fill_black
Definition: plot_style.c:38
void ro_gui_progress_bar_set_icon(struct progress_bar *pb, const char *icon)
Set the icon for a progress bar.
Definition: progress_bar.c:197
unsigned int ro_gui_progress_bar_get_range(struct progress_bar *pb)
Get the range of a progress bar.
Definition: progress_bar.c:269
void ro_gui_progress_bar_update(struct progress_bar *pb, int width, int height)
Update the progress bar to a new dimension.
Definition: progress_bar.c:284
void ro_gui_progress_bar_set_value(struct progress_bar *pb, unsigned int value)
Set the value of a progress bar.
Definition: progress_bar.c:221
void ro_gui_progress_bar_destroy(struct progress_bar *pb)
Destroy a progress bar and free all associated resources.
Definition: progress_bar.c:158
wimp_w ro_gui_progress_bar_get_window(struct progress_bar *pb)
Get the handle of the window that represents a progress bar.
Definition: progress_bar.c:183
struct progress_bar * ro_gui_progress_bar_create(void)
Create a new progress bar.
Definition: progress_bar.c:128
void ro_gui_progress_bar_set_range(struct progress_bar *pb, unsigned int range)
Set the range of a progress bar.
Definition: progress_bar.c:252
Progress bar (interface).
int width
Definition: gui.c:160
int ro_plot_origin_x
Definition: plotters.c:40
nserror riscos_schedule(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Definition: schedule.c:93
int ro_plot_origin_y
Definition: plotters.c:41
const struct plotter_table ro_plotters
RISC OS plotter operation table.
Definition: plotters.c:727
unsigned int ro_gui_status_bar_get_width(struct status_bar *sb)
Get the proportional width the status bar is currently using.
Definition: status_bar.c:202
void ro_gui_status_bar_resize(struct status_bar *sb)
Resize a status bar following a change in the dimensions of the parent window.
Definition: status_bar.c:346
void ro_gui_status_bar_set_progress_range(struct status_bar *sb, unsigned int range)
Set the range of the progress bar.
Definition: status_bar.c:271
wimp_w ro_gui_status_bar_get_window(struct status_bar *sb)
Get the handle of the window that represents a status bar.
Definition: status_bar.c:188
void ro_gui_status_bar_set_text(struct status_bar *sb, const char *text)
Set the text to display in the status bar.
Definition: status_bar.c:316
static void ro_gui_status_bar_redraw(wimp_draw *redraw)
Process a WIMP redraw request.
Definition: status_bar.c:444
void ro_gui_status_bar_set_progress_icon(struct status_bar *sb, const char *icon)
Set the icon for the progress bar.
Definition: status_bar.c:301
static char status_widget_validation[]
Definition: status_bar.c:59
#define PROGRESS_WIDTH
Definition: status_bar.c:46
static char status_widget_text[]
Definition: status_bar.c:58
static void ro_gui_status_bar_redraw_callback(void *handle)
Callback for scheduled redraw.
Definition: status_bar.c:525
#define ICON_WIDGET
Definition: status_bar.c:44
wimp_WINDOW(1)
Definition: status_bar.c:61
void ro_gui_status_bar_set_visible(struct status_bar *sb, bool visible)
Set the visibility status of the status bar.
Definition: status_bar.c:217
bool ro_gui_status_bar_get_visible(struct status_bar *sb)
Get the visibility status of the status bar.
Definition: status_bar.c:240
static bool ro_gui_status_bar_click(wimp_pointer *pointer)
Process an mouse_click event for a status window.
Definition: status_bar.c:538
struct status_bar * ro_gui_status_bar_create(wimp_w parent, unsigned int width)
Create a new status bar.
Definition: status_bar.c:118
void ro_gui_status_bar_set_progress_value(struct status_bar *sb, unsigned int value)
Set the value of the progress bar.
Definition: status_bar.c:254
#define WIDGET_WIDTH
Definition: status_bar.c:45
static void ro_gui_status_bar_open(wimp_open *open)
Process an open_window request for a status window.
Definition: status_bar.c:569
void ro_gui_status_bar_destroy(struct status_bar *sb)
Destroy a status bar and free all associated resources.
Definition: status_bar.c:161
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.
Definition: status_bar.c:606
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.
Definition: plotters.h:188
os_box visible
progress bar position
Definition: progress_bar.c:50
Rectangle coordinates.
Definition: types.h:40
int x0
Definition: types.h:41
int y0
Top left.
Definition: types.h:41
int x1
Definition: types.h:42
int y1
Bottom right.
Definition: types.h:42
Redraw context.
Definition: plotters.h:51
const struct plotter_table * plot
Current plot operation table.
Definition: plotters.h:73
bool interactive
Redraw to show interactive features.
Definition: plotters.h:59
bool visible
status bar is visible?
Definition: status_bar.c:55
wimp_w w
status bar window handle
Definition: status_bar.c:49
const char * text
status bar text
Definition: status_bar.c:51
unsigned int scale
current status bar scale
Definition: status_bar.c:53
wimp_w parent
parent window handle
Definition: status_bar.c:50
int width
current status bar width
Definition: status_bar.c:54
struct progress_bar * pb
progress bar
Definition: status_bar.c:52
Interface to a number of general purpose functionality.
#define min(x, y)
Definition: utils.h:46
#define max(x, y)
Definition: utils.h:50
int ro_get_hscroll_height(wimp_w w)
Gets the horizontal scrollbar height.
Definition: wimp.c:58
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.
Definition: wimp_event.c:390
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.
Definition: wimp_event.c:1507
void ro_gui_wimp_event_finalise(wimp_w w)
Free any resources associated with a window.
Definition: wimp_event.c:296
void * ro_gui_wimp_event_get_user_data(wimp_w w)
Gets the user data associated with a window.
Definition: wimp_event.c:486
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...
Definition: wimp_event.c:1439
bool ro_gui_wimp_event_set_user_data(wimp_w w, void *user)
Sets the user data associated with a window.
Definition: wimp_event.c:467
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.
Definition: wimp_event.c:1477
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.
#define PTR_WIMP_OPEN(pstate)
Definition: wimputils.h:39
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.
Definition: plot.c:978