CADSREditor.hpp

Go to the documentation of this file.
00001 #ifndef __CADSREditor__
00002 #define __CADSREditor__
00003 
00004 #include "CControl.hpp"
00005 #include <MathTools/CBounds.hpp>
00006 using Exponent::GUI::Controls::CControl;
00007 using Exponent::MathTools::CBounds;
00008 
00009 //  ===========================================================================
00010 
00011 namespace Exponent
00012 {
00013     namespace GUI
00014     {
00015         namespace Controls
00016         {
00034             class CADSREditor : public CControl
00035             {
00037                 EXPONENT_CLASS_DECLARATION;
00040 //  ===========================================================================
00041         
00042             public:
00043 
00044 //  ===========================================================================
00045 
00053                 CADSREditor(IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener = NULL);
00054 
00058                 virtual ~CADSREditor();
00059 
00060 //  ===========================================================================
00061 
00066                 virtual void drawControl(CGraphics &graphics);
00067 
00068 //  ===========================================================================
00069 
00074                 virtual void handleLeftButtonDown(CMouseEvent &event);
00075 
00080                 virtual void handleLeftButtonUp(CMouseEvent &event);
00081 
00086                 virtual void handleMouseMovement(CMouseEvent &event);
00087 
00092                 virtual void handleMouseLeavingArea(CMouseEvent &event);
00093 
00094 //  ===========================================================================
00095 
00101                 virtual double getValue(const long index) { return m_values[index]; }
00102 
00108                 virtual void setValue(const long index, const double value);
00109 
00110 //  ===========================================================================
00111 
00112             protected:
00113 
00114 //  ===========================================================================
00115 
00120                 enum EADSRHandles
00121                 {
00122                     e_noSelection = -1,         
00124                     e_attackSelected,           
00125                     e_decaySelected,            
00126                     e_sustainSelected,          
00127                     e_releaseSelected,          
00129                     e_numberOfHandles,          
00130                 };
00131 
00132 //  ===========================================================================
00133 
00134                 const static long CADSR_EDITOR_WINDOW_OFFSET = 4;               
00135                 const static long CADSR_EDITOR_HANDLE_SIZE = 8;                 
00136                 const static long CADSR_EDITOR_HANDLE_HALF_SIZE = 4;            
00138 //  ===========================================================================
00139 
00144                 void moveAttack(CMouseEvent &event);
00145 
00150                 void moveDecay(CMouseEvent &event);
00151 
00156                 void moveSustain(CMouseEvent &event);
00157 
00162                 void moveRelease(CMouseEvent &event);
00163 
00167                 void constructHandlePositions();
00168 
00169 //  ===========================================================================
00170 
00171                 bool m_mouseIsOver;                     
00172                 bool m_mouseDown;                       
00173                 long m_selectedPoint;                   
00174                 long m_sizeOfQuarter;                   
00175                 long m_innerHeight;                     
00176                 long m_innerWidth;                      
00178                 CPolygon m_envelopePolygon;             
00179                 CRect m_handles[e_numberOfHandles];     
00181                 double m_values[4];                     
00182             };
00183         }
00184     }
00185 }
00186 #endif  // End of CADSREditor.hpp

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