Slider Library
[Reference documentation]

Efficient management of slider objects in formulars. More...

Functions

void * mt_SlidCreate (APPvar *app, short min, short max, short sinc, short linc, short value, int ori, int upd)
 Initialise a slider structure.
void mt_SlidDelete (APPvar *app, void *slid)
 delete (free) a slider structure created by mt_SlidCreate()
void mt_SlidAttach (APPvar *app, void *slid, int mode, WINDOW *win, int up, int bsld, int sld, int dn)
 Attach a slider to an object structure in a formular.
short mt_SlidGetValue (APPvar *app, void *slid)
 Returns the current value of a slider.
void mt_SlidSetFunc (APPvar *app, void *slid, func_doslid func, void *data)
 define a slider event function.
void mt_SlidSetSize (APPvar *app, void *slid, int size)
 Change the size of the slider cursor widget.
void mt_SlidSetValue (APPvar *app, void *slid, short value)
 Change the current slider value.
void mt_SlidSetUpdat (APPvar *app, void *slid, int upd)
 Changes a slider update behavior.

Detailed Description

Efficient management of slider objects in formulars.


Function Documentation

void mt_SlidAttach APPvar app,
void *  sld,
int  mode,
WINDOW win,
int  up,
int  bsld,
int  curs,
int  dn
 

Attach a slider to an object structure in a formular.

Parameters:
app application descriptor,
sld slider structure,
mode OC_FORM or OC_TOOLBAR,
win window descriptor targeted,
up index of decrement widget or -1,
bsld index of slider background or -1,
curs index of cursor widget or -1,
dn index of increment widget or -1,
This function attaches a slider structure to slider object in a formular. Only window and toolbar formular are handled.

Objects up and dn are generally TOUCHEXIT SELECTABLE G_BOXCHAR object containing an up arrow and and down arrow if slider is vertical, or left arrow and right arrow if slider is horizontal. When user clicks on these widgets, slider value is increased or decreased using the small increment step defined by sinc mt_SlidCreate() parameter. up and/or dn can be set to -1. In this case, the slider won't use these widgets.

Object sld should always be a children of the bsld object. When the user click on pager object (bsld), slider value is increased or decreased using the large increment step defined by linc mt_SlidCreate() parameter. If sld and bg are set to -1, the slider won't use these widgets.

The TOUCHEXIT flag is required for the four objects specified in mt_SlidAttach().

See also:
mt_SlidCreate()

void* mt_SlidCreate APPvar app,
short  min,
short  max,
short  sinc,
short  linc,
short  value,
int  ori,
int  upd
 

Initialise a slider structure.

Parameters:
app application descriptor,
min minimal slider value,
max maximal slider value,
sinc small incremental/decremental step
linc large incremental/decremental step
value current slider value,
ori slider orientation :
  • SLD_HORI horizontal slider,
  • SLD_VERT vertical slider,
upd type of slider update :
  • SLD_IMME slider is immediatly updated,
  • SLD_DIFF slider is updated after the user action,
Returns:
a new slider structure, correctly initialized.
This function creates a slider structure. It is not an AES object tree in a formular but only some variables used to handle a set of objects representing and acting as a slider.

The object slider should be creating in a resource editor (or in other way). Then this object slider must to attached to the slider structure created by mt_SlidCreate(). The function mt_SlidAttach() performs this link. When the slider object is no more used (formular closed), the slider object should be delete using mt_SlidDelete().

min, max and value are respectively minimal value, the maximal value and the current value of the internal slider variable. To read or eventually to change an internal variable, use functions mt_SlidGetValue() and mt_SlidSetValue().

Parameters sinc and linc addresses the user interaction in the slider object. linc represents a small incrementation or decrementation of the slider value and linc represents a large incrementation or decrementation (see mt_SlidAttach()).

Parameter upd is usefull if you attach an update function to the slider (see mt_SlidSetFunc()). This function is called when the slider value is changed.

See also:
mt_SlidAttach(), mt_SlidSetValue(), mt_SlidGetValue(), mt_SlidSetFunc(); mt_SlidDelete().

void mt_SlidDelete APPvar app,
void *  slid
 

delete (free) a slider structure created by mt_SlidCreate()

Parameters:
app application descriptor,
slid a slider object created by mt_SlidCreate().
See also:
mt_SlidCreate(), mt_SlidAttach(), mt_SlidSetValue(), mt_SlidGetValue(), mt_SlidSetFunc().

short mt_SlidGetValue APPvar app,
void *  sld
 

Returns the current value of a slider.

Parameters:
app application descriptor,
sld slider structure,
Returns:
current slider value.
See also:
mt_SlidSetValue()

void mt_SlidSetFunc APPvar app,
void *  sld,
func_doslid  func,
void *  data
 

define a slider event function.

Parameters:
app application descriptor,
sld a slider structure,
func pointer to a slider event function,
data pointer to an user data.
This function attaches a slider event function to a slider. When the slider value is modified, this function is called with the following prototype :
       void doslid( WINDOW *win, int mode, short value, void *data, APPvar *ap);

win and mode are respectively the window descriptor host and the formular type (OC_FORM or OC_TOOLBAR). Parameter value is the new value of the slider. data is an optional pointer to a user data specified by mt_SlidSetFunc().

See also:
mt_SlidCreate(), mt_SlidAttach()

void mt_SlidSetSize APPvar app,
void *  sld,
int  size
 

Change the size of the slider cursor widget.

Parameters:
app application descriptor,
sld slider structure,
size new slider size, a value between 0 and 1000.
This function changes the size (width for an horizontal slider and height for a vertical slider) of the slider cursor widget. A value between 0 and 1000 is requested, 1000 means the largest possible size (it is the size of the cursor parent widget). The cursor and its root element are redrawn.

Generally, a cursor have a fixed size. But in the case of a slider associated to a window displaying a list for elements for example, this size can be used to symbolize the number of elements displayed in the window compare to the total of elements. In this case :

      size = MIN( (elements_seen / elements_total)  * 1000, 1000); 

void mt_SlidSetUpdat APPvar app,
void *  sld,
int  upd
 

Changes a slider update behavior.

Parameters:
app application descriptor,
sld slider structure,
upd type of slider update :
  • SLD_IMME slider is immediatly updated,
  • SLD_DIFF slider is updated after the user action.

void mt_SlidSetValue APPvar app,
void *  sld,
short  value
 

Change the current slider value.

Parameters:
app application descriptor,
sld slider structure,
value new value.
This function sets the internal slider value. If the slider is attached to a formular, widgets will be updated and the slider event function (see SlidSetFunc()) will be invoked if needed.

See also:
mt_SlidGetValue()


Generated on Thu Jun 22 11:45:29 2006 for WinDom by  doxygen 1.4.6