00001 #ifndef __CControlRoot__ 00002 #define __CControlRoot__ 00003 00004 #include <Collections/TCountedPointerArray.hpp> 00005 #include <Exceptions/CException.hpp> 00006 #include "../Events/CMouseEvent.hpp" 00007 #include "IControlRoot.hpp" 00008 #include "IControl.hpp" 00009 00010 // =========================================================================== 00011 00012 using Exponent::Collections::TCountedPointerArray; 00013 using Exponent::Exceptions::CException; 00014 using Exponent::GUI::Events::CMouseEvent; 00015 using Exponent::GUI::Controls::IControlRoot; 00016 using Exponent::GUI::Controls::IControl; 00017 00018 // =========================================================================== 00019 00020 namespace Exponent 00021 { 00022 namespace GUI 00023 { 00024 namespace Controls 00025 { 00044 class CControlRoot : public IControlRoot 00045 { 00046 public: 00047 00052 CControlRoot(IWindow *parent); 00053 00057 virtual ~CControlRoot(); 00058 00059 // =========================================================================== 00060 00065 virtual void lockControl(IControl *control); 00066 00071 virtual void unlockControl(); 00072 00077 virtual bool controlIsLocked() const; 00078 00083 virtual IControl *getLockedControl() const; 00084 00085 // =========================================================================== 00086 00091 virtual void setParentWindow(IWindow *parent); 00092 00097 virtual IWindow *getParentWindow() const; 00098 00103 virtual CPoint getWindowOffset(); 00104 00109 virtual void isVSTAttatched(const bool attatched = true) { m_isVSTAttatched = attatched; } 00110 00111 // =========================================================================== 00112 00118 virtual IControl *getControlAtPoint(const CPoint &point); 00119 00125 virtual IControl *getMouseEnabledControlAtPoint(const CPoint &point); 00126 00132 virtual IControl *getDropEnabledControlAtPoint(const CPoint &point); 00133 00139 virtual IControl *getKeyEnabledControlAtPoint(const CPoint &point); 00140 00141 // =========================================================================== 00142 00147 virtual void addControl(IControl *control); 00148 00153 virtual void removeControl(IControl *control); 00154 00159 virtual void clearControls(); 00160 00168 virtual IControl *getControlAtIndex(const long index, bool isIndex = true); 00169 00176 virtual long getControlIndex(IControl *control); 00177 00182 virtual long getNumberOfControls(); 00183 00188 virtual long getNumberOfInsertedControls(); 00189 00195 virtual bool isControlAttatched(IControl *control); 00196 00201 virtual const IControl *getLastUsedControl() const { return m_lastControl; } 00202 00203 // =========================================================================== 00204 00209 virtual void drawRootControl(CGraphics &graphics); 00210 00215 virtual void updateControl(IControl *control); 00216 00223 virtual void updateControl(const long index, bool isIndex); 00224 00229 virtual void updateArea(const CRect &area); 00230 00231 // =========================================================================== 00232 00237 virtual void setBackgroundImage(IImage *image); 00238 00239 // =========================================================================== 00240 00244 virtual void startToolTipTimer(); 00245 00249 virtual void stopToolTipTimer() ; 00250 00251 // =========================================================================== 00252 00253 // Save or load a layout of this panel.. 00254 //virtual void serialise(const EControlRootSerialiseOption option); 00255 00256 // =========================================================================== 00257 00262 virtual void handleLeftButtonDown(CMouseEvent &event); 00263 00268 virtual void handleLeftButtonUp(CMouseEvent &event); 00269 00274 virtual void handleRightButtonDown(CMouseEvent &event); 00275 00280 virtual void handleRightButtonUp(CMouseEvent &event); 00281 00286 virtual void handleDoubleClick(CMouseEvent &event); 00287 00292 virtual void handleMouseScroll(CMouseEvent &event); 00293 00298 virtual void handleMouseMovement(CMouseEvent &event); 00299 00304 virtual void handleMouseLeavingArea(CMouseEvent &event); 00305 00306 // =========================================================================== 00307 00312 virtual bool handleKeyDown(const CKeyboardEvent &event); 00313 00318 virtual bool handleKeyUp(const CKeyboardEvent &event); 00319 00320 // =========================================================================== 00321 00326 virtual void handleFileDrop(const CDropEvent &event); 00327 00328 // =========================================================================== 00329 00335 virtual void getGlobalCoordinatesOfControl(IControl *control, CPoint &point); 00336 00342 virtual void getWindowCoordinatesOfControl(IControl *control, CPoint &point); 00343 00344 // =========================================================================== 00345 00346 protected: 00347 00348 // =========================================================================== 00349 00355 IControl *preProcessMouseEvent(CMouseEvent &event); 00356 00361 void postProcessMouseEvent(IControl *theControl); 00362 00363 // =========================================================================== 00364 00365 TCountedPointerArray<IControl> *m_controlArray; 00366 IControl *m_lockedControl; 00367 IControl *m_lastControl; 00368 IImage *m_controlRootBackgroundImage; 00369 IWindow *m_parentWindow; 00370 CMouseEvent m_subMouseEvent; 00371 CPoint m_originalPosition; 00372 bool m_isVSTAttatched; 00374 }; 00375 } 00376 } 00377 } 00378 #endif // End of CControlRoot.hpp