Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CAUGuiSlider Class Reference

CAUGuiSlider - a one dimensional control for fader like behaviour. More...

#include <CAUGuiSlider.h>

Inheritance diagram for CAUGuiSlider:

CAUGuiCtrl CAUGuiItem List of all members.

Public Member Functions

 CAUGuiSlider (CAUGuiMan *theChief, CAAUParameter &theAuvp, eRect *theWhere, UInt32 theOrientation, CAUGuiResolution theRes, CAUGuiGraphic *theForeGround, CAUGuiGraphic *theBackground)
 constructor for a slider control (aka fader)

virtual ~CAUGuiSlider ()
 destructor

virtual void draw (CGContextRef context, UInt32 portHeight)
 receives draws from CAUGuiControlHandler

virtual void mouseDown (Point *P, bool, bool)
 receives Mouse clicks from CAUGuiControlHandler

virtual void mouseTrack (Point *P, bool, bool)
 receives MouseTracking from CAUGuiControlHandler

virtual void mouseUp (Point *P, bool, bool)
 receives Mouse ups from CAUGuiControlHandler


Detailed Description

CAUGuiSlider - a one dimensional control for fader like behaviour.

Sliders can be more than just Faders. You can also build switches with 2 or more values upon them.

They are commonly used with a CAUGuiHandleImage to draw the faderhandle above its background. To achieve this in a proper manner, just create your foreBounds accordingly.

An example:

Assume you have a background image h_slider_back that is 120x20 pixels and a 10x10 pixel handle image h_slider_image the value should be adjustable in 100 steps (or better 101, taking 0-100 into account) where each pixel of the fader way should represent 1 step. The handle furthermore should be centered in a way to have a 5 pixel border at each side of the fader. You'd have to do this

eRect where;

where.set ( 50, 50, 120, 20 );

CAUGuiSlider* mySlider = new CAUGuiSlider(myCAUGui, AUVParameterForSlider, &where, 1, kCAUGui_res_100, h_slider_image, h_slider_back );

mySlider->shrinkForeBounds ( 10, 5, 10, 5 );

This sets the eRect passed to the handle image to a size of 100x10 pixels that perfectly lays centered in our fader's bounds.

Definition at line 44 of file CAUGuiSlider.h.


Constructor & Destructor Documentation

CAUGuiSlider::CAUGuiSlider CAUGuiMan theChief,
CAAUParameter &  theAuvp,
eRect theWhere,
UInt32  theOrientation,
CAUGuiResolution  theRes,
CAUGuiGraphic theForeGround,
CAUGuiGraphic theBackground
 

constructor for a slider control (aka fader)

Parameters:
theChief instance of controlling CAUGuiMan
theAuvp the CAAUParameter to be controlled
theWhere Control Bounds in pane-relative coordinates
theOrientation 0 = verical, 1 = horizontal
theRes CAUGuiResolution
theForeGround foreground CAUGuiGraphic, usually a CAUGuiHandleImage
theBackground background CAUGuiGraphic

Definition at line 14 of file CAUGuiSlider.cpp.

References CAUGuiGraphic::getHeight(), CAUGuiGraphic::getWidth(), eRect::h, kCAUGui_Slider, CAUGuiCtrl::setBounds(), CAUGuiCtrl::setTolerance(), CAUGuiItem::setType(), and eRect::w.

CAUGuiSlider::~CAUGuiSlider  )  [virtual]
 

destructor

Definition at line 77 of file CAUGuiSlider.cpp.


Member Function Documentation

void CAUGuiSlider::draw CGContextRef  context,
UInt32  portHeight
[virtual]
 

receives draws from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 89 of file CAUGuiSlider.cpp.

References CAUGuiGraphic::draw(), CAUGuiCtrl::getBounds(), CAUGuiCtrl::getCarbonControl(), CAUGuiCtrl::getForeBounds(), CAUGuiGraphic::getImage(), eRect::to(), and val.

void CAUGuiSlider::mouseDown Point *  P,
bool  with_option,
bool  with_shift
[virtual]
 

receives Mouse clicks from CAUGuiControlHandler

Parameters:
P the point where the mouse is, relative to control bounds
with_option is option key pressed?
with_shift is shift key pressed?
(Currently the status of modifiers is only tested on first click and then maintained over the whole interaction)

Reimplemented from CAUGuiCtrl.

Definition at line 120 of file CAUGuiSlider.cpp.

References mouseTrack(), sldr_X, and sldr_Y.

void CAUGuiSlider::mouseTrack Point *  P,
bool  with_option,
bool  with_shift
[virtual]
 

receives MouseTracking from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 131 of file CAUGuiSlider.cpp.

References CAUGuiCtrl::getBounds(), CAUGuiCtrl::getCarbonControl(), CAUGuiCtrl::getForeBounds(), eRect::h, eRect::set(), sldr_X, sldr_Y, val, eRect::w, eRect::x, and eRect::y.

Referenced by mouseDown(), and mouseUp().

void CAUGuiSlider::mouseUp Point *  P,
bool  with_option,
bool  with_shift
[virtual]
 

receives Mouse ups from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 218 of file CAUGuiSlider.cpp.

References mouseTrack().


The documentation for this class was generated from the following files:
(c) 2002 - 2003 by Urs Heckmann www.u-he.com
Generated on Thu May 6 15:13:15 2004 for CAUGui by doxygen 1.3.6