00001 #ifndef __CRolloverButton__ 00002 #define __CRolloverButton__ 00003 00004 #include "CControl.hpp" 00005 using Exponent::GUI::Controls::CControl; 00006 00007 // =========================================================================== 00008 00009 namespace Exponent 00010 { 00011 namespace GUI 00012 { 00013 namespace Controls 00014 { 00038 class CRolloverButton : public CControl 00039 { 00041 EXPONENT_CLASS_DECLARATION; 00044 // =========================================================================== 00045 00046 public: 00047 00048 // =========================================================================== 00049 00054 enum ERolloverState 00055 { 00056 e_mouseOff = 0, 00057 e_mouseOver, 00058 e_mouseDown, 00059 }; 00060 00061 // =========================================================================== 00062 00070 CRolloverButton(IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener = NULL); 00071 00075 virtual ~CRolloverButton(); 00076 00077 // =========================================================================== 00078 00084 virtual void useCursorChange(const bool use = true) { m_cursorChange = use; } 00085 00086 // =========================================================================== 00087 00092 virtual void drawControl(CGraphics &graphics); 00093 00094 // =========================================================================== 00095 00100 virtual void handleLeftButtonDown(CMouseEvent &event); 00101 00106 virtual void handleLeftButtonUp(CMouseEvent &event); 00107 00112 virtual void handleMouseMovement(CMouseEvent &event); 00113 00118 virtual void handleMouseLeavingArea(CMouseEvent &event); 00119 00120 // =========================================================================== 00121 00126 virtual void setDownImage(IImage *theImage); 00127 00132 virtual void setOverImage(IImage *theImage); 00133 00138 void setLabelText(const CString &text) { m_labelText = text; } 00139 00140 // =========================================================================== 00141 00142 protected: 00143 00144 // =========================================================================== 00145 00146 IImage *m_downImage; 00147 IImage *m_overImage; 00148 ERolloverState m_state; 00149 bool m_cursorChange; 00150 bool m_mouseIsDown; 00151 CString m_labelText; 00152 }; 00153 } 00154 } 00155 } 00156 #endif // End of CRolloverButton.hpp