/Users/airy/Sources/augui/AUGUIFramework/AU View/AUCarbonViewNib.h

Go to the documentation of this file.
00001 /*
00002  *  CAUCarbonViewNib.h
00003  *  CAUCarbonViewNib
00004  
00005  *
00006  *  Created by Airy André on Sun Oct 06 2002.
00007  *  Copyright (c) 2002 Airy André. All rights reserved.
00008  *
00009  */
00010 
00033 #ifndef __AUCARBONVIEWNIB_H__
00034 #define __AUCARBONVIEWNIB_H__
00035 
00036 #include <map>
00037 #include <set>
00038 
00039 // Plugin views are based on this class
00040 #include "AUCarbonViewBase.h"
00041 #include "CACFDictionary.h"
00042 
00043 #include "AUOid.h"
00044 
00048 #define kAUNibControlSignature 'AUid'
00049 
00051 #define kAUPanelControlSignature 'AUpn'
00052 
00056 #define kAUNibUserPaneControlID 9999
00057 
00058 #define kDefaultWindowNibName CFSTR("window")
00059 #define kDefaultCompositingWindowNibName CFSTR("windowCompositing")
00060 #define kDefaultNoCompositingWindowNibName kDefaultWindowNibName
00061 #define kDefaultBackgroundImageFileName CFSTR("AUBackground.png")
00062 #define kDefaultAboutImageFileName CFSTR("about.png")
00063 
00064 #define kProperty_MIDILearn 100000
00065 
00083 class CAUCarbonViewEditor;
00084 
00085 class CAUCarbonViewNib: public AUCarbonViewBase
00086 {
00087 public:
00088     // Construction ------------------------------
00089     CAUCarbonViewNib(AudioUnitCarbonView inInstance);
00090     virtual ~CAUCarbonViewNib();
00091     
00092     // Configuration Methods -----------------------
00094     virtual CFStringRef GetBundleID() = 0;
00096     virtual CFStringRef GetWindowNibName() { return kDefaultWindowNibName; }
00098     virtual CFStringRef GetWindowCompositingName() { return kDefaultCompositingWindowNibName; }
00100     virtual CFStringRef GetWindowNoCompositingName() { return kDefaultNoCompositingWindowNibName; }
00101     
00103     virtual bool HasBackgroundPict() { return true; }
00105     virtual CFStringRef GetBackgroundFilename() { return kDefaultBackgroundImageFileName; }
00107     virtual CFStringRef GetAboutFilename() { return kDefaultAboutImageFileName; }
00109     virtual CFStringRef GetTextBackgroundFilename() { return 0; }
00111     virtual CFStringRef GetFontname() { return 0; }
00113     virtual int GetFontsize() { return 12; }
00115     virtual int GetTextJustification() { return teJustLeft; }
00117         virtual void GetTextColor(RGBColor *foreColor);
00118 
00120     virtual bool PatchEraseRect() { return true; }
00121     
00123     virtual bool HasTimer() { return true;};
00125     virtual float TimerResolution() { return 50.;};
00127     virtual void Idle() {};
00128     
00130     virtual bool SupportEditMode() const { return false; }
00131 
00132     // Baseclass overrides -----------------------
00133     OSStatus CreateUI(Float32,          // x position within parent window
00134                       Float32);         // y position within parent window
00135     
00137     virtual void InitWindow(CFBundleRef sBundle); // Register custom controls...
00139     virtual void FinishWindow(CFBundleRef sBundle); // Called after window creation
00141     virtual bool HandleCommand(EventRef inEvent, HICommandExtended &cmd) { return false;};
00142     
00143         virtual bool HandleGestureEventForView(EventRef event, HIViewRef view);
00144 
00146     virtual bool HandleEventForView(EventRef event, HIViewRef view);
00147 
00149     virtual bool HandleEventForContextualMenu(EventRef event, HIViewRef view) { return false; }
00150 
00151     virtual bool HandleEvent(EventRef event);
00152     
00153     // Used by QD patch for controls to have the window background (for non compositing windows)
00154     virtual CGImageRef GetBackgroundImage() { return mBackgroundImage; }
00155     virtual void GetPaneBounds(Rect *rect);
00156     virtual HIViewRef GetRootPane() const { return mRootUserPane; }
00157     
00158     virtual void PropertyHasChanged(AudioUnitPropertyID inPropertyID, AudioUnitScope inScope,  
00159                                     AudioUnitElement inElement);
00160     
00161     CFBundleRef GetBundleRef() { return mBundleRef; }
00162     
00163         void InitXML();
00164         void SaveXML();
00165 
00166         void updateXMLForControl(HIViewRef control);
00167         void updateControlFromXML(HIViewRef control);
00168 
00169 protected:
00170         virtual HIViewRef BuildViewFromOid(AUGUI::oid_t oid);
00171         virtual bool BuildFromXML();
00172     virtual int SwitchPane(int paneID, int paneNumber);
00173     virtual void BindPane(HIViewRef thePane, AUGUI::oid_t oid);
00174     virtual void BuildMultiPane(HIViewRef control, AUGUI::oid_t parent);
00175     virtual void BuildDynamicViews(HIViewRef control, AUGUI::oid_t parent);
00176     virtual void BindView(HIViewRef control, AUGUI::oid_t oid);
00177     
00178     virtual void RegisterPropertyChanges(AudioUnitPropertyID inPropertyID);
00179     virtual void UnRegisterPropertyChanges(AudioUnitPropertyID inPropertyID);
00180     virtual void UnRegisterAllPropertiesChanges();
00181 
00182     virtual bool HandleEventPlayMode(EventRef event);
00183     
00184         virtual void DisplayOverlay(CFStringRef pictName);
00185     
00186     static void PropertyChangedProc(void* inUserData, AudioUnit inComponentInstance,  
00187                                     AudioUnitPropertyID inPropertyID, AudioUnitScope inScope,  
00188                                     AudioUnitElement inElement);
00189     
00190     void SetEditMode(bool mode);
00191     bool EditMode() const { return mEditMode; };
00192     
00193         bool GetDictionaryForOid(CACFDictionary &element, AUGUI::oid_t);
00194         bool AddDictionaryForOid(CACFDictionary &element, AUGUI::oid_t oid);
00195         
00196         void AddUnknownControls(HIViewRef view, AUGUI::oid_t fromOid);
00197         
00198         void AddControlEventHandler(HIViewRef from);
00199 
00200         // Baseclass overrides -----------------------
00201 //    virtual void RespondToEventTimer (EventLoopTimerRef inTimer) { Idle(); }
00202 
00203     CQDProcs mProcs;
00204     CQDProcs* mCurrentProcsPtr;
00205     CGImageRef mBackgroundImage;
00206     CFStringRef mBundleID;
00207     CFBundleRef mBundleRef;
00208     HIViewRef mRootUserPane;
00209     
00210     int mPaneID;
00211 
00212     bool mEditMode;
00213     CAUCarbonViewEditor *mEditor;
00214 
00215         CACFDictionary mXml;
00216         
00217     EventLoopTimerRef mTimer;
00218         
00219     std::set<AudioUnitPropertyID> mPropertiesRegistered;
00220         std::map<HIViewRef, AUGUI::oid_t> mOids;
00221         std::map<AUGUI::oid_t, HIViewRef> mViews;
00222 };
00223 #endif
00224 // -----------------------------------------------------------------------------
00225 // End of file.
00226 // -----------------------------------------------------------------------------





Generated on Sat Jul 8 13:02:17 2006 for AUGUI Framework by doxygen1.4.6

hosted on SourceForge.net Logo