CVstWindow.hpp

Go to the documentation of this file.
00001 #ifndef __CVstWindow__
00002 #define __CVstWindow__
00003 
00004 
00005 //  ===========================================================================
00006 
00007 #include <audioeffectx.h>
00008 #ifdef VST_2_4_EXTENSIONS
00009 #include <aeffeditor.h>
00010 #else
00011 #include <AEffEditor.hpp>
00012 #endif
00013 #include <Host/CApplication.hpp>
00014 #include <Listeners/IActionListener.hpp>
00015 #include <Windowing/CWindow.hpp>
00016 #include <Threading/CCriticalSectionScope.hpp>
00017 
00018 //  ===========================================================================
00019 
00020 using Exponent::GUI::Windowing::CWindow;
00021 using Exponent::Host::CApplication;
00022 using Exponent::GUI::Listeners::IActionListener;
00023 using Exponent::Threading::CCriticalSectionScope;
00024 
00025 //  ===========================================================================
00026 
00027 namespace Exponent
00028 {
00029     namespace Vst
00030     {
00052         class CVstWindow : public AEffEditor, public CWindow, public IActionListener, public IKeyboardListener
00053         {
00055             EXPONENT_CLASS_DECLARATION;
00058 //  ===========================================================================
00059 
00060         public:
00061 
00062 //  ===========================================================================
00063 
00070             CVstWindow(AudioEffect *theEffect, const CRect &windowArea, CWindowAttributes *attributes);
00071 
00075             virtual ~CVstWindow();
00076 
00077 //  ===========================================================================
00078 
00084 #ifdef VST_2_4_EXTENSIONS
00085             virtual bool getRect(ERect **rect);
00086 #else
00087             virtual long getRect(ERect **rect);
00088 #endif
00089 
00093             virtual void update();
00094 
00095 //  ===========================================================================
00096 
00101             void blockUpdates(const bool block) { m_blockUpdates = block; }
00102 
00107             virtual void redrawWindow(const CRect &area);
00108 
00112             virtual void redrawWindow();
00113 
00114 //  ===========================================================================
00115 
00121 #ifdef VST_2_4_EXTENSIONS
00122             virtual bool open(void *windowHandle);
00123 #else
00124             virtual long open(void *windowHandle);
00125 #endif
00126 
00130             virtual void close();
00131 
00136             virtual void startVSTWindow();
00137 
00141             virtual void idle();
00142 
00143 //  ===========================================================================
00144 
00149             virtual void handleActionEvent(const CActionEvent &event);
00150 
00156             virtual void setParameter(const long index, const double value);
00157 
00158 //  ===========================================================================
00159 
00164             virtual bool parameterSetFromEditor() const { return m_setFromEditor; }
00165 
00170             virtual void parameterIsBeingSetFromEditor(const bool setFromEditor = true) { m_setFromEditor = setFromEditor; }
00171 
00172 //  ===========================================================================
00173 
00179             virtual bool handleKeyDown(const CKeyboardEvent &event);
00180 
00186             virtual bool handleKeyUp(const CKeyboardEvent &event);
00187 
00188 //  ===========================================================================
00189             #if MAC
00190 
00194                 virtual void draw (ERect *rect);
00195             #endif
00196 
00197             #ifndef WIN32
00198 
00202                 virtual CPoint getWindowOffset();
00203             #endif
00204 
00205 //  ===========================================================================
00206 
00207         protected:
00208 
00209 //  ===========================================================================
00210 
00215             class CParentWindow : public CWindow
00216             {
00217             public:
00218 
00223                 CParentWindow(void *windowHandle);
00224 
00228                 virtual ~CParentWindow();
00229 
00230 
00231                 SWindowHandle *m_myParentWindowHandle;      
00232             };
00233 
00234 //  ===========================================================================
00235 
00240             virtual void createVSTWindow(void *windowHandle);
00241 
00245             virtual void destroyVSTWindow();
00246 
00247             #ifndef WIN32
00248 
00254                 virtual pascal OSStatus handleVstWindowEvents(EventHandlerCallRef handler, EventRef theEvent);
00255 
00263                 static pascal OSStatus VSTWindowProc(EventHandlerCallRef handler, EventRef theEvent, void *userData);
00264                 
00271                 virtual pascal OSStatus handleHIViewControlEvents(EventHandlerCallRef handler, EventRef theEvent);
00272                 
00280                 static pascal OSStatus HIViewControlProc(EventHandlerCallRef handler, EventRef theEvent, void *userData);
00281                 
00286                 HIViewRef getUserPane() { return m_userPane; }
00287                 
00292                 class CVstWindowTimer : public ITimedObject
00293                 {
00294                 public:
00295                 
00300                     CVstWindowTimer(CVstWindow *window);
00301                     
00305                     virtual ~CVstWindowTimer();
00306 
00310                     virtual void timerExpired();
00311 
00317                     virtual long getTimerId() const { return -5000; }
00318                     
00319                 protected:
00320                 
00321                     CVstWindow *m_window;           
00322                 };
00323             #endif
00324 
00325 //  ===========================================================================
00326 
00327             CParentWindow *m_theVSTParentWindow;                
00328             bool m_setFromEditor;                               
00329             bool m_blockUpdates;                                
00330             ERect m_myRect;                                     
00332             #ifndef WIN32
00333                 CCriticalSection *m_idleSection;                
00334                 HIViewRef m_userPane;                           
00335                 HIViewRef m_contentPane;                        
00336                 CVstWindowTimer *m_windowTimer;                 
00337             #endif
00338 
00339 //  ===========================================================================
00340         };
00341     }
00342 }
00343 #endif  // End of CVstWindow.hpp

Infinity API - CVstWindow.hpp Source File generated on 7 Mar 2007