00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __COREGRAPHICS_AUDIOUNIT_GUI__
00021 #define __COREGRAPHICS_AUDIOUNIT_GUI__
00022
00023
00024
00025
00026 #include <Carbon/Carbon.h>
00027 #include "AUCarbonViewBase.h"
00028 #include "AUCarbonViewControl.h"
00029
00030 #include "CAUGuiConfig.h"
00031
00032 #ifndef __CAUGUI_TOOLS__
00033 #include "CAUGuiTools.h"
00034 #endif
00035
00036 #ifndef __CAUGUI_CONTROL__
00037 #include "CAUGuiControl.h"
00038 #endif
00039
00040
00041
00042 typedef enum
00043 {
00044 kCAUGui_res_0 = 0,
00045 kCAUGui_res_1 = 1,
00046 kCAUGui_res_10 = 10,
00047 kCAUGui_res_100 = 100,
00048 kCAUGui_res_50 = 50
00051 } CAUGuiResolution;
00052
00053
00061 extern "C" static pascal OSStatus CAUGuiControlHandler ( EventHandlerCallRef, EventRef, void* );
00062
00068 extern "C" static void TimerProc ( EventLoopTimerRef inTimer, void *inUserData );
00069
00070 class CAUGuiCtrl;
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00094 class CAUGuiMan
00095 {
00096 public:
00097
00104 CAUGuiMan (AUCarbonViewBase*, UInt32 x, UInt32 y );
00105
00113 ~CAUGuiMan();
00114
00116 void initialize();
00117
00118
00119
00121 void addImage ( CAUGuiGraphic* theImage );
00122
00124 CAUGuiGraphic* getImageByID ( UInt32 theID );
00125
00126
00127
00129 void addCtrl( CAUGuiCtrl* theCtrl );
00130
00132 CAUGuiCtrl* getCtrlByID( UInt32 theID );
00133
00135 CAUGuiCtrl* getCtrlByControlRef ( ControlRef theControl );
00136
00138 CAUGuiCtrl* getControls (){ return Controls; }
00139
00140
00141
00143 void setRelaxed ( bool r ) { relaxed = r; }
00144
00146 bool isRelaxed ( void ) { return relaxed; }
00147
00149 AUCarbonViewBase* getAUCarbonViewBase() { return myAUCarbonViewBase; }
00150
00152 void requestInternalParameters();
00153
00155 float getInternalParameter ( int index );
00156
00158 void idle();
00159
00161 UInt32 requestID ( void );
00162
00163 UInt32 X;
00164 UInt32 Y;
00165
00166 private:
00167
00168 UInt32 itemCount;
00169
00170 CAUGuiGraphic* Images;
00171 CAUGuiCtrl* Controls;
00172
00173 bool relaxed;
00174
00175 EventLoopTimerRef timer;
00176
00177 AUCarbonViewBase* myAUCarbonViewBase;
00178
00179
00180 ControlDefSpec ControlSpec;
00181 ToolboxObjectClassRef ControlClass;
00182 char defString[ 64 ];
00183
00184
00185
00186
00187 float* internalParameters;
00188
00189
00190 };
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00207 class CAUGuiCtrl : public CAUGuiItem
00208 {
00209 public:
00210
00211
00212
00223 CAUGuiCtrl ( CAUGuiMan* theCAUGuiMan, CAAUParameter& theAUVP, eRect* bounds, CAUGuiResolution resolution );
00224
00225
00226
00234 CAUGuiCtrl ( CAUGuiMan* theCAUGuiMan, eRect* bounds, UInt32 Range );
00235
00244 CAUGuiCtrl ( CAUGuiMan* theCAUGuiMan, eRect* bounds );
00245
00247 virtual ~CAUGuiCtrl();
00248
00250 void setDefaults();
00251
00252
00253
00255 virtual void setCarbonControl(ControlRef theCarbonControl) {carbonControl = theCarbonControl;}
00256
00258 virtual ControlRef getCarbonControl() { return carbonControl; }
00259
00260
00261
00262
00264 virtual void clip ( bool drawing );
00265
00267 virtual void setVisible ( bool viz );
00268
00269
00270
00272 virtual void draw(CGContextRef context, UInt32 portHeight) {};
00273
00283 virtual void mouseDown(Point *P, bool with_option, bool with_shift) {};
00284
00286 virtual void mouseTrack(Point *P, bool with_option, bool with_shift) {};
00287
00289 virtual void mouseUp(Point *P, bool with_option, bool with_shift) {};
00290
00292 virtual void mouseRight(Point *P) {};
00293
00294
00295
00297 virtual void setDefault();
00298
00299
00300
00301
00303 virtual void idle();
00304
00306 virtual bool isControlRef ( ControlRef theControl );
00307
00308
00309
00311 virtual bool providesForeignControls () { return false; }
00312
00314 virtual void initForeignControls (ControlDefSpec &ControlSpec) {};
00315
00317 virtual bool isAUVPattached() { return AUVPattached; }
00318
00319
00320
00322 virtual void embedCAUGuiCtrl() {};
00323
00325 virtual void addCtrl( CAUGuiCtrl* theCtrl );
00326
00327
00328
00330 bool getOpaque() { return opaque; }
00331
00333 void setOpaque(bool o) { opaque = o; }
00334
00335
00336
00338 virtual void getBounds ( Rect* r ) { where.to ( r ); }
00339
00341 virtual void getForeBounds ( Rect* r ) { vizArea.to ( r ); }
00342
00344 virtual CAUGuiResolution getResolution () { return Resolution; }
00345
00347 virtual CAAUParameter& getAUVP() { return auvp; }
00348
00350 virtual float getRange() { return Range; }
00351
00353 virtual eRect* getBounds() { return &where; }
00354
00356 virtual eRect* getForeBounds() { return &vizArea; }
00357
00359 virtual CAUGuiMan* getCAUGuiMan() { return Chief; }
00360
00362 virtual CAUGuiCtrl* getDaddy() { return Daddy; }
00363
00365 virtual CAUGuiCtrl* getChild(ControlRef theControl);
00366
00368 virtual void setDaddy( CAUGuiCtrl* theDaddy ) { this->Daddy = theDaddy; }
00369
00371 virtual void setOffset ( SInt32 x, SInt32 y );
00372
00374 virtual void setBounds ( eRect* r ) { where.set ( r ); }
00375
00377 virtual void setForeBounds ( eRect* r ) { vizArea.set ( r ); }
00378
00380 virtual void setForeBounds ( SInt32 x, SInt32 y, SInt32 w, SInt32 h );
00381
00383 virtual void shrinkForeBounds ( SInt32 x, SInt32 y, SInt32 w, SInt32 h );
00384
00386 virtual void setLastUpdated ( SInt32 v ) { lastUpdatedValue = v; }
00387
00389 virtual SInt32 getLastUpdated (void ) { return lastUpdatedValue; }
00390
00392 virtual void setTolerance ( SInt32 t ) { tolerance = t; }
00393
00395 virtual bool mustUpdate ( void );
00396
00398 virtual bool wantsTracking ( void ) { return wantsTrackingFlag;}
00399
00400
00402 virtual void setColour ( float r, float g, float b, float a )
00403 {
00404 col_red = r;
00405 col_green = g;
00406 col_blue = b;
00407 col_alpha = a;
00408 }
00409
00411 virtual void setFont ( char *theFont ) { strcpy ( font_name, theFont ); }
00412
00414 virtual void setTextAlign ( int a ) { textalign = a; }
00415
00416
00417
00418
00419
00420
00421 protected:
00422
00423 CAUGuiMan* Chief;
00424 CAAUParameter auvp;
00425 CAUGuiCtrl* Daddy;
00426 CAUGuiCtrl* children;
00427 UInt32 id;
00428 CAUGuiResolution Resolution;
00429 float Range;
00430
00431 bool AUVPattached;
00432
00433 bool opaque;
00434
00435 ControlRef carbonControl;
00436 eRect where;
00437 eRect vizArea;
00438
00439 SInt32 lastUpdatedValue;
00440 SInt32 tolerance;
00441 bool becameVisible;
00442
00443 bool wantsTrackingFlag;
00444
00445 float col_red;
00446 float col_green;
00447 float col_blue;
00448 float col_alpha;
00449
00450 float font_size;
00451 int textalign;
00452 char font_name[ 32 ];
00453
00454 };
00455
00456
00457
00458
00459
00460
00461
00462 #endif