CSlider

#include <vstcontrols.h>

class CSlider : public CControl;

Define a slider with a given background and handle. The range of variation of the handle should be defined. By default the handler is drawn with transparency (white color). By clicking Alt+Left Mouse the default value is used.

See also :

[source] source


CSlider

2.2

CSlider (CRect &size, CControlListener *listener, long tag, int iMinPos, int iMaxPos, CBitmap *handle, CBitmap *bk, CPoint &offset, long style);

Creates a slider object.

size The coordinates of the enclosing rectangle, relative to the parent frame.
listener The object responsible for handling events in this control. for this control.
tag The index of the control.
iMinPos The minimal position of the slider, in pixel relative to the parent frame.
iMaxPos The maximal position of the slider, in pixel relative to the parent frame.
handle The pixmap of the slider
bk The pixmap of the background.
offset The top-left point of the displayed area of the background, relative to the control.
style Used to define the orientation and the zero position of the slider. For example kLeft|kHorizontal defines an horizontal slider, with the 0 on the left. See CControlEnum.

Example of a vertical slider :

CVerticalSlider

Code example :

myFaderBodyPixmap
= new CBitmap (kFaderBodyPixmapID);
myFaderHandlePixmap
= new CBitmap (kFaderHandlePixmapID);
size (
kMyFader_left,
kMyFader_top,
kMyFader_left + myFaderBodyPixmap->getWidth (),
kMyFader_top + myFaderBodyPixmap->getHeight ()
);
int minPos = kMyFader_top;
int maxPos = kMyFader_top
+ myFaderBodyPixmap->getHeight ()
- myFaderHandlePixmap->getHeight () - 1;
CPoint offset (0, 0);
myFader = new CSlider (
size,
this,
kMyParameter,
minPos,
maxPos,
myFaderHandlePixmap,
myFaderBodyPixmap,
offset,
kVertical | kBottom
);
myFader->setOffsetHandle (offset);
myFader->setValue (effect->getParameter (kMyParameter));
frame->addView (myFader);

CSlider

2.2

CSlider (CRect&size, CControlListener *listener, long tag, CPoint &offsetHandle, long rangeHandle, CBitmap *handle, CBitmap *bk, CPoint &offset, long style);

Creates a slider object.

size The coordinates of the enclosing rectangle, relative to the parent frame.
listener The object responsible for handling events in this control. for this control.
tag The index of the control.
offsetHandle The offset of the handle.
rangeHandle The size of the handle range.
handle The pixmap of the slider
bk The pixmap of the background.
offset The top-left point of the displayed area of the background, relative to the control.
style Used to define the orientation and the zero position of the slider. For example kLeft|kHorizontal defines an horizontal slider, with the 0 on the left. See CControlEnum.



~CSlider

2.2

~CSlider ();

Destroys a Slider object. The bitmaps are destroyed if there is no more reference on it.


attached

2.2

virtual bool attached (CView *parent);

Creates a COffscreenContext for the slider.


removed

2.2

virtual bool removed (CView*parent);

Removes the COffscreenContext created for the slider.


draw

2.2

void draw (CDrawContext *drawContext);

Called when this control object needs to be drawn.

[source] source


mouse

2.2

void mouse (CDrawContext *context, CPoint &where);

Called when there is a mouse-click inside this control object.

See also :

[source] source


onWheel

2.2

virtual bool onWheel (CDrawContext *pContext, const CPoint &where, float distance);

[source] source


onKeyDown

2.2

virtual bool onKeyDown (VstKeyCode& keyCode);


setDrawTransparentHandle

2.2

void setDrawTransparentHandle (bool val);

Allows to specify if the handle must be drawn with or without transparency.


setFreeClick

2.2

void setFreeClick (bool val);

With true the current position is set at click position (default behaviour), else you have to drag the handle.


getFreeClick

2.2

bool getFreeClick () ;

Returns the current status of the handle mode.


setOffsetHandle

2.2

void setOffsetHandle (CPoint val);

Allows to specify the offset of the handle in the slider background.


setHandle

2.2

void setHandle (CBitmap handle);

Sets the handle pixmap.

[source] source


getHandle

2.2

CBitmap *getHandle ();

Returns the handle pixmap.


setZoomFactor

2.2

void setZoomFactor (float val);

Sets the zoom factor for the shift mode (slower move).


getZoomFactor

2.2

float getZoomFactor ();

Returns the zoom factor.


Copyright ©2003 Steinberg Media Technologies GmbH. All Rights Reserved.