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

CAUGuiKnob Class Reference

CAUGuiKnob - Knob control - stirr da mouse. More...

#include <CAUGuiKnob.h>

Inheritance diagram for CAUGuiKnob:

CAUGuiCtrl CAUGuiItem List of all members.

Public Member Functions

 CAUGuiKnob (CAUGuiMan *theChief, CAAUParameter &theAuvp, eRect *theWhere, CAUGuiResolution theRes, CAUGuiGraphic *theForeGround, CAUGuiGraphic *theBackground)
 constructor for a knob control

virtual ~CAUGuiKnob ()
 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

virtual void setCenter (SInt32 x, SInt32 y)
 center of rotation/mouse stirring in relative coordinates


Detailed Description

CAUGuiKnob - Knob control - stirr da mouse.

Knobs take either CAUGuiSpinImages or multiframed CAUGuiGraphics

CAUGuiSpinImages can be either rotating or trailing along a circular path.

a typical rotating knob:
CAUGuiGraphic* fore = new CAUGuiSpinImage ( "fore.png", -0.375f, 0.375f, 0, 0, false );

myCAUGuiMan->addImage( fore );

CAUGuiGraphic* back = new CAUGuiGraphic ( "back.png" );

myCAUGuiMan->addImage( back );

CAAUParameter myAUVP(mEditAudioUnit, kMyParameter, kAudioUnitScope_Global, 0);

eRect* where = new eRect ( 20, 30, 32, 32 );

CAUGuiKnob* myKnob = new CAUGuiKnob( myCAUGuiMan, myAUVP, where, kCAUGui_res_100, fore, back );

myCAUGuiMan->addCtrl( myKnob );

kMyParameter should have a range like 0.0 - 100.0

myCAUGuiMan is the View's CAUGuiMan (you can add controls directly to it, but you'll most likely get along better using CAUGuiPane or CAUGuiLayeredPane to manage controls...

now, for orbital behaviour, it get's a little tricky. You have to set the foreBounds in a way that the Pivot of the orbitting image sits at the top most position. It will then orbit around the center of the Knob control. You can displace the center with setCenter().

A bit of experimantation will be necessary, though...

Definition at line 66 of file CAUGuiKnob.h.


Constructor & Destructor Documentation

CAUGuiKnob::CAUGuiKnob CAUGuiMan theChief,
CAAUParameter &  theAuvp,
eRect theWhere,
CAUGuiResolution  theRes,
CAUGuiGraphic theForeGround,
CAUGuiGraphic theBackground
 

constructor for a knob control

Parameters:
theChief instance of controlling CAUGuiMan
theAuvp the CAAUParameter to be controlled
theWhere Control Bounds in pane-relative coordinates
theRes CAUGuiResolution
theForeGround foreground CAUGuiGraphic, usually a CAUGuiSpinImage or a multiframe CAUGuiGraphic
theBackground background CAUGuiGraphic (can be NULL)
if the foreground graphics is multiframe, it maps the parameter's values accordingly and shows the correct subframe

Definition at line 13 of file CAUGuiKnob.cpp.

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

CAUGuiKnob::~CAUGuiKnob  )  [virtual]
 

destructor

Definition at line 58 of file CAUGuiKnob.cpp.


Member Function Documentation

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

receives draws from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 70 of file CAUGuiKnob.cpp.

References CAUGuiGraphic::draw(), CAUGuiCtrl::getBounds(), CAUGuiCtrl::getCarbonControl(), CAUGuiCtrl::getForeBounds(), CAUGuiGraphic::getImage(), CAUGuiItem::getType(), eRect::h, kCAUGui_SpinImage, eRect::to(), val, eRect::w, eRect::x, and eRect::y.

void CAUGuiKnob::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 117 of file CAUGuiKnob.cpp.

References cent_X, cent_Y, CAUGuiCtrl::getCarbonControl(), mouseTrack(), tmp, and val.

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

receives MouseTracking from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 132 of file CAUGuiKnob.cpp.

References cent_X, cent_Y, CAUGuiCtrl::getCarbonControl(), CAUGuiCtrl::getRange(), CAUGuiCtrl::getResolution(), tmp, and val.

Referenced by mouseDown(), and mouseUp().

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

receives Mouse ups from CAUGuiControlHandler

Reimplemented from CAUGuiCtrl.

Definition at line 159 of file CAUGuiKnob.cpp.

References mouseTrack().

virtual void CAUGuiKnob::setCenter SInt32  x,
SInt32  y
[inline, virtual]
 

center of rotation/mouse stirring in relative coordinates

Definition at line 100 of file CAUGuiKnob.h.


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:14 2004 for CAUGui by doxygen 1.3.6