NetSurf
Data Structures | Macros | Functions | Variables
status_bar.c File Reference

UTF8 status 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/wimp.h"
#include "oslib/wimpspriteop.h"
#include "utils/log.h"
#include "utils/utils.h"
#include "netsurf/plotters.h"
#include "riscos/gui.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
#include "riscos/wimputils.h"
#include "riscos/font.h"
#include "riscos/gui/progress_bar.h"
#include "riscos/gui/status_bar.h"
Include dependency graph for status_bar.c:

Go to the source code of this file.

Data Structures

struct  status_bar
 

Macros

#define ICON_WIDGET   0
 
#define WIDGET_WIDTH   12
 
#define PROGRESS_WIDTH   160
 

Functions

 wimp_WINDOW (1)
 
static void ro_gui_status_bar_open (wimp_open *open)
 Process an open_window request for a status window. More...
 
static bool ro_gui_status_bar_click (wimp_pointer *pointer)
 Process an mouse_click event for a status window. More...
 
static void ro_gui_status_bar_redraw (wimp_draw *redraw)
 Process a WIMP redraw request. More...
 
static void ro_gui_status_bar_redraw_callback (void *handle)
 Callback for scheduled redraw. More...
 
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. More...
 
struct status_barro_gui_status_bar_create (wimp_w parent, unsigned int width)
 Create a new status bar. More...
 
void ro_gui_status_bar_destroy (struct status_bar *sb)
 Destroy a status bar and free all associated resources. More...
 
wimp_w ro_gui_status_bar_get_window (struct status_bar *sb)
 Get the handle of the window that represents a status bar. More...
 
unsigned int ro_gui_status_bar_get_width (struct status_bar *sb)
 Get the proportional width the status bar is currently using. More...
 
void ro_gui_status_bar_set_visible (struct status_bar *sb, bool visible)
 Set the visibility status of the status bar. More...
 
bool ro_gui_status_bar_get_visible (struct status_bar *sb)
 Get the visibility status of the status bar. More...
 
void ro_gui_status_bar_set_progress_value (struct status_bar *sb, unsigned int value)
 Set the value of the progress bar. More...
 
void ro_gui_status_bar_set_progress_range (struct status_bar *sb, unsigned int range)
 Set the range of the progress bar. More...
 
void ro_gui_status_bar_set_progress_icon (struct status_bar *sb, const char *icon)
 Set the icon for the progress bar. More...
 
void ro_gui_status_bar_set_text (struct status_bar *sb, const char *text)
 Set the text to display in the status bar. More...
 
void ro_gui_status_bar_resize (struct status_bar *sb)
 Resize a status bar following a change in the dimensions of the parent window. More...
 

Variables

static char status_widget_text [] = ""
 
static char status_widget_validation [] = "R5;Pptr_lr,8,6"
 

Detailed Description

UTF8 status bar (implementation).

Definition in file status_bar.c.

Macro Definition Documentation

◆ ICON_WIDGET

#define ICON_WIDGET   0

Definition at line 44 of file status_bar.c.

◆ PROGRESS_WIDTH

#define PROGRESS_WIDTH   160

Definition at line 46 of file status_bar.c.

◆ WIDGET_WIDTH

#define WIDGET_WIDTH   12

Definition at line 45 of file status_bar.c.

Function Documentation

◆ ro_gui_status_bar_click()

bool ro_gui_status_bar_click ( wimp_pointer *  pointer)
static

Process an mouse_click event for a status window.

Parameters
pointerdetails of the mouse click

Definition at line 538 of file status_bar.c.

References ICON_WIDGET, and NSLOG.

Referenced by ro_gui_status_bar_create().

Here is the caller graph for this function:

◆ ro_gui_status_bar_create()

struct status_bar * ro_gui_status_bar_create ( wimp_w  parent,
unsigned int  width 
)

Create a new status bar.

Parameters
parentthe window to contain the status bar
widththe proportional width to use (0...10,000)

Definition at line 118 of file status_bar.c.

References NSLOG, parent, status_bar::parent, status_bar::pb, ro_gui_progress_bar_create(), ro_gui_status_bar_click(), ro_gui_status_bar_open(), ro_gui_status_bar_redraw(), ro_gui_status_bar_resize(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_open_window(), ro_gui_wimp_event_register_redraw_window(), ro_gui_wimp_event_set_help_prefix(), ro_gui_wimp_event_set_user_data(), status_bar::scale, status_bar::visible, status_bar::w, and width.

Referenced by gui_window_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_destroy()

void ro_gui_status_bar_destroy ( struct status_bar sb)

Destroy a status bar and free all associated resources.

Parameters
sbthe status bar to destroy

Definition at line 161 of file status_bar.c.

References NSLOG, status_bar::pb, riscos_schedule(), ro_gui_progress_bar_destroy(), ro_gui_status_bar_redraw_callback(), ro_gui_wimp_event_finalise(), and status_bar::w.

Referenced by gui_window_destroy().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_get_visible()

bool ro_gui_status_bar_get_visible ( struct status_bar sb)

Get the visibility status of the status bar.

Parameters
sbthe status bar to check the visiblity of
Returns
whether the status bar is visible

Definition at line 240 of file status_bar.c.

References status_bar::visible.

◆ ro_gui_status_bar_get_width()

unsigned int ro_gui_status_bar_get_width ( struct status_bar sb)

Get the proportional width the status bar is currently using.

Parameters
sbthe status bar to get the width of
Returns
the status bar's width (0...10,000)

Definition at line 202 of file status_bar.c.

References status_bar::scale.

Referenced by ro_gui_window_default_options().

Here is the caller graph for this function:

◆ ro_gui_status_bar_get_window()

wimp_w ro_gui_status_bar_get_window ( struct status_bar sb)

Get the handle of the window that represents a status bar.

Parameters
sbthe status bar to get the window handle of
Returns
the status bar's window handle

Definition at line 188 of file status_bar.c.

References status_bar::w.

◆ ro_gui_status_bar_open()

void ro_gui_status_bar_open ( wimp_open *  open)
static

Process an open_window request for a status window.

Parameters
openthe request to process

Definition at line 569 of file status_bar.c.

References NSLOG, status_bar::parent, ro_gui_status_bar_resize(), ro_gui_wimp_event_get_user_data(), and status_bar::scale.

Referenced by ro_gui_status_bar_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_redraw()

void ro_gui_status_bar_redraw ( wimp_draw *  redraw)
static

Process a WIMP redraw request.

Parameters
redrawthe redraw request to process

Definition at line 444 of file status_bar.c.

References redraw_context::interactive, NSLOG, redraw_context::plot, plot_style_fill_black, plotter_table::rectangle, ro_gui_desktop_font_family, ro_gui_desktop_font_size, ro_gui_desktop_font_style, ro_gui_wimp_event_get_user_data(), ro_plot_origin_x, ro_plot_origin_y, ro_plotters, status_bar::text, WIDGET_WIDTH, status_bar::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by ro_gui_status_bar_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_redraw_callback()

void ro_gui_status_bar_redraw_callback ( void *  handle)
static

Callback for scheduled redraw.

Parameters
handleCallback handle

Definition at line 525 of file status_bar.c.

References status_bar::w, WIDGET_WIDTH, and status_bar::width.

Referenced by ro_gui_status_bar_destroy(), and ro_gui_status_bar_set_text().

Here is the caller graph for this function:

◆ ro_gui_status_bar_resize()

void ro_gui_status_bar_resize ( struct status_bar sb)

Resize a status bar following a change in the dimensions of the parent window.

Parameters
sbthe status bar to resize

Definition at line 346 of file status_bar.c.

References ICON_WIDGET, max, min, NSLOG, status_bar::parent, PTR_WIMP_OPEN, ro_get_hscroll_height(), ro_gui_status_position_progress_bar(), status_bar::scale, status_bar::visible, status_bar::w, WIDGET_WIDTH, and status_bar::width.

Referenced by ro_gui_status_bar_create(), ro_gui_status_bar_open(), ro_gui_status_bar_set_visible(), and ro_gui_window_open().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_set_progress_icon()

void ro_gui_status_bar_set_progress_icon ( struct status_bar sb,
const char *  icon 
)

Set the icon for the progress bar.

Parameters
sbthe status bar to set the icon for
iconthe icon to use, or NULL for no icon

Definition at line 301 of file status_bar.c.

References status_bar::pb, and ro_gui_progress_bar_set_icon().

Here is the call graph for this function:

◆ ro_gui_status_bar_set_progress_range()

void ro_gui_status_bar_set_progress_range ( struct status_bar sb,
unsigned int  range 
)

Set the range of the progress bar.

Parameters
sbthe status bar to set the range of
rangethe range of the progress bar

Definition at line 271 of file status_bar.c.

References NSLOG, status_bar::pb, ro_gui_progress_bar_get_range(), ro_gui_progress_bar_get_window(), ro_gui_progress_bar_set_range(), and ro_gui_status_position_progress_bar().

Referenced by ro_gui_status_bar_set_progress_value().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_set_progress_value()

void ro_gui_status_bar_set_progress_value ( struct status_bar sb,
unsigned int  value 
)

Set the value of the progress bar.

Parameters
sbthe status bar to set the progress of
valuethe value to use

Definition at line 254 of file status_bar.c.

References max, status_bar::pb, ro_gui_progress_bar_get_range(), ro_gui_progress_bar_set_value(), and ro_gui_status_bar_set_progress_range().

Here is the call graph for this function:

◆ ro_gui_status_bar_set_text()

void ro_gui_status_bar_set_text ( struct status_bar sb,
const char *  text 
)

Set the text to display in the status bar.

Parameters
sbthe status bar to set the text for
textthe UTF8 text to display, or NULL for none

Definition at line 316 of file status_bar.c.

References riscos_schedule(), ro_gui_status_bar_redraw_callback(), status_bar::text, text(), and status_bar::visible.

Referenced by riscos_window_set_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_gui_status_bar_set_visible()

void ro_gui_status_bar_set_visible ( struct status_bar sb,
bool  visible 
)

Set the visibility status of the status bar.

Parameters
sbthe status bar to check the visiblity of
visibleif the status bar should be shown or not.
Returns
whether the status bar is visible

Definition at line 217 of file status_bar.c.

References NSLOG, ro_gui_status_bar_resize(), status_bar::visible, and status_bar::w.

Here is the call graph for this function:

◆ ro_gui_status_position_progress_bar()

void ro_gui_status_position_progress_bar ( struct status_bar sb)
static

Reposition the progress component following a change in the dimension of the status window.

Parameters
sbthe status bar to update

Definition at line 606 of file status_bar.c.

References max, NSLOG, status_bar::pb, PROGRESS_WIDTH, PTR_WIMP_OPEN, ro_gui_progress_bar_get_range(), ro_gui_progress_bar_get_window(), ro_gui_progress_bar_update(), progress_bar::visible, status_bar::w, and WIDGET_WIDTH.

Referenced by ro_gui_status_bar_resize(), and ro_gui_status_bar_set_progress_range().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wimp_WINDOW()

wimp_WINDOW ( )

Definition at line 61 of file status_bar.c.

References status_widget_text, and status_widget_validation.

Variable Documentation

◆ status_widget_text

char status_widget_text[] = ""
static

Definition at line 58 of file status_bar.c.

Referenced by wimp_WINDOW().

◆ status_widget_validation

char status_widget_validation[] = "R5;Pptr_lr,8,6"
static

Definition at line 59 of file status_bar.c.

Referenced by wimp_WINDOW().