µGFX  2.9
version 2.9
Slider

Detailed Description

Slider widget.

Extended events can be enabled using gwinSliderSendExtendedEvents().

Precondition
GFX_USE_GWIN must be set to GFXON in your gfxconf.h
GWIN_NEED_SLIDER must be set to GFXON in your gfxconf.h

Modules

 Renderings
 Built-in rendering functions for the slider widget.
 

Functions

GHandle gwinGSliderCreate (GDisplay *g, GSliderObject *gb, const GWidgetInit *pInit)
 Create a slider window. More...
 
void gwinSliderSetRange (GHandle gh, int min, int max)
 Set the slider range. More...
 
void gwinSliderSetPosition (GHandle gh, int pos)
 Set the slider position. More...
 
void gwinSliderSendExtendedEvents (GHandle gh, gBool enabled)
 Should the slider send extended events. More...
 
#define GSLIDER_FLG_EXTENDED_EVENTS   0x01
 The internal slider object flags. More...
 

Macros

#define gwinSliderGetPosition(gh)   (((GSliderObject *)(gh))->pos)
 Get the current slider position. More...
 

Function Documentation

◆ gwinGSliderCreate()

GHandle gwinGSliderCreate ( GDisplay *  g,
GSliderObject *  gb,
const GWidgetInit pInit 
)

Create a slider window.

Returns
NULL if there is no resultant drawing area, otherwise a window handle.
Parameters
[in]gThe GDisplay to display this window on
[in]gbThe GSliderObject structure to initialise. If this is NULL the structure is dynamically allocated.
[in]pInitThe initialization parameters to use
Note
The drawing color and the background color get set to the current defaults. If you haven't called gwinSetDefaultColor() or gwinSetDefaultBgColor() then these are GFX_WHITE and GFX_BLACK respectively.
The font gets set to the current default font. If you haven't called gwinSetDefaultFont() then there is no default font and text drawing operations will no nothing.
A slider remembers its normal drawing state. If there is a window manager then it is automatically redrawn if the window is moved or its visibility state is changed.
The initial slider range is from 0 to 100 with an initial position of 0.
A slider supports mouse, toggle and dial input.
When assigning a toggle, only one toggle is supported per role. If you try to assign more than one toggle to a role it will forget the previous toggle. Two roles are supported: Role 0 = toggle for down, Role 1 = toggle for up.
When assigning a dial, only one dial is supported. If you try to assign more than one dial it will forget the previous dial. Only dial role 0 is supported.
Function Class: Normal API, this function can be invoked by regular system threads.

Definition at line 275 of file gwin_slider.c.

◆ gwinSliderSendExtendedEvents()

void gwinSliderSendExtendedEvents ( GHandle  gh,
gBool  enabled 
)

Should the slider send extended events.

Parameters
[in]ghThe window handle (must be a slider window)
[in]enabledgTrue to enable extended events, gFalse to disable them
Note
The slider by default will only send slider events with an action of GSLIDER_EVENT_SET. This call can be used to enable other slider action's to be sent as events
Function Class: Normal API, this function can be invoked by regular system threads.

Definition at line 329 of file gwin_slider.c.

References GWindowObject::vmt.

◆ gwinSliderSetPosition()

void gwinSliderSetPosition ( GHandle  gh,
int  pos 
)

Set the slider position.

Parameters
[in]ghThe window handle (must be a slider window)
[in]posThe new position
Note
If the new position is outside the slider range then the position is set to the closest end of the range.
The slider is not automatically drawn. Call gwinRedraw() after changing the position.
Function Class: Normal API, this function can be invoked by regular system threads.

Definition at line 308 of file gwin_slider.c.

References GWindowObject::vmt.

◆ gwinSliderSetRange()

void gwinSliderSetRange ( GHandle  gh,
int  min,
int  max 
)

Set the slider range.

Parameters
[in]ghThe window handle (must be a slider window)
[in]minThe minimum value
[in]maxThe maximum value
Note
Sets the position to the minimum value.
The slider is not automatically drawn. Call gwinRedraw() after changing the range.
Function Class: Normal API, this function can be invoked by regular system threads.

Definition at line 293 of file gwin_slider.c.

References GWindowObject::vmt.

Macro Definition Documentation

◆ GSLIDER_FLG_EXTENDED_EVENTS

#define GSLIDER_FLG_EXTENDED_EVENTS   0x01

The internal slider object flags.

Note
Used only for writing a custom draw routine.

Definition at line 53 of file gwin_slider.h.

◆ gwinSliderGetPosition

#define gwinSliderGetPosition (   gh)    (((GSliderObject *)(gh))->pos)

Get the current slider position.

Returns
The slider position
Parameters
[in]ghThe window handle (must be a slider window)
Note
The use of a listener to get the slider position is recommended if you want continuous updates on the slider position.
Function Class: Normal API, this function can be invoked by regular system threads.

Definition at line 136 of file gwin_slider.h.