Documentation from slider.h

ROV

Introduction

[top]

ROV - Easy applications from C

Copyright - © Jason Tribbeck / 7th ARM 1994-2001

Contributing authors - Jason Tribbeck

File - slider.h

Type - helper

Description

The slider helper generates standard sliders on canvasses.

See the slider tutorial for more information.

Note - Sliders are internally held as integers, which have a number of decimal places afterwards. This means that the integer value of 31412 with 4 decimal places equates to 3.1412, and with 2 decimal places 314.12.

Note - Canvasses must have redraw handlers that call slider_redraw() in order to display the sliders.

See also: slider_redraw()

slider (type definition)

[top]

The definition of a slider.

typedef void *slider;

slider_changeval (function pointer)

[top]

The definition of a slider event handler.

Parameters:

 - slider s - the slider.
 - int event - the event code.
 - int val - the new value.

Returns:

 -  non-zero for handled, zero for not handled.

typedef int (*slider_changeval)(slider s,
				int event,
				int val);

See also: Slider event codes

slider_create

[top]

Create a slider.

Parameters:

 - canvas c - the canvas to create the canvas on.
 - int x - the (canvas) left hand coordinate.
 - int y - the (canvas) bottom coordinate.
 - int l - the slider length.
 - int flags - the flags for the slider.
 - char *comment - the text for the comment (if bit 0 of flags is set).
 - char *units - the text for the units (if bit 2 of flags is set).
 - int value - the default value.
 - int min - the minimum value.
 - int max - the maximum value.
 - int step - the step between valid values.
 - int decimals - the number of decimal places.
 - int valuewidth - the width of the value text box.
 - int unitwidth - the width of the unit icon.
 - slider_changeval handler - the slider event handler.

Note - the comment appears to the left of the left hand coordinate.

Note - the slider subsystem will claim the mouse click events for this canvas.

slider slider_create(canvas c,
		     int x,
		     int y,
		     int l,
		     int flags,
		     char *comment,
		     char *units,
		     int value,
		     int min,
		     int max,
		     int step,
		     int decimals,
		     int valuewidth,
		     int unitwidth,
		     slider_changeval handler);

See also: Slider flags

slider_redraw

[top]

Slider redrawing

Parameters:

 - canvas c - the canvas being redrawn.
 - int x0 - the (canvas) left hand coordinate.
 - int y0 - the (canvas) bottom coordiate.
 - int x1 - the (canvas) right hand coordinate.
 - int y1 - the (canvas) top coordinate.

Note - This is normally called from the canvas redraw event handler.

void slider_redraw(canvas c,
		   int x0,
		   int y0,
		   int x1,
		   int y1);

slider_setvalue

[top]

Set the value of a slider.

Parameters:

 - slider s - the slider.
 - int value - the value.

void slider_setvalue(slider s,
		     int value);

slider_setcolour

[top]

Set the colour of a slider.

Parameters:

 - slider s - the slider.
 - int col - the WIMP colour.

void slider_setcolour(slider s,
		      int col);

Slider flags

[top]
#define SLIDER_COMMENT (1<<0)
#define SLIDER_TEXT    (1<<1)
#define SLIDER_UNITS   (1<<2)
#define SLIDER_ARROWS  (1<<3)
#define SLIDER_CENTRE  (1<<4)
#define SLIDER_ALL     (31)

Slider event codes

[top]
#define SLIDER_RETURNPRESSED (0)
#define SLIDER_INCREMENT     (1)
#define SLIDER_DECREMENT     (2)
#define SLIDER_DRAGTO        (3)
#define SLIDER_DRAGEND       (4)
#define SLIDER_KEYPRESSED    (5)

Generated Thu Feb 7 23:22:52 2002