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. |
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.
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, |
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().
void* mt_SlidCreate | ( | APPvar * | app, | |
short | min, | |||
short | max, | |||
short | sinc, | |||
short | linc, | |||
short | value, | |||
int | ori, | |||
int | upd | |||
) |
Initialise a slider structure.
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 :
| |
upd | type of slider update :
|
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.
void mt_SlidDelete | ( | APPvar * | app, | |
void * | slid | |||
) |
delete (free) a slider structure created by mt_SlidCreate()
app | application descriptor, | |
slid | a slider object created by mt_SlidCreate(). |
short mt_SlidGetValue | ( | APPvar * | app, | |
void * | sld | |||
) |
Returns the current value of a slider.
app | application descriptor, | |
sld | slider structure, |
void mt_SlidSetFunc | ( | APPvar * | app, | |
void * | sld, | |||
func_doslid | func, | |||
void * | data | |||
) |
define a slider event function.
app | application descriptor, | |
sld | a slider structure, | |
func | pointer to a slider event function, | |
data | pointer to an user data. |
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().
void mt_SlidSetSize | ( | APPvar * | app, | |
void * | sld, | |||
int | size | |||
) |
Change the size of the slider cursor widget.
app | application descriptor, | |
sld | slider structure, | |
size | new slider size, a value between 0 and 1000. |
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.
app | application descriptor, | |
sld | slider structure, | |
upd | type of slider update :
|
void mt_SlidSetValue | ( | APPvar * | app, | |
void * | sld, | |||
short | value | |||
) |
Change the current slider value.
app | application descriptor, | |
sld | slider structure, | |
value | new value. |