00001 #ifndef __CRangeSlider__
00002 #define __CRangeSlider__
00003
00004 #include "CControl.hpp"
00005 #include "CRolloverButton.hpp"
00006 #include <MathTools/CBounds.hpp>
00007
00008
00009
00010 using Exponent::GUI::Controls::CControl;
00011 using Exponent::GUI::Controls::CRolloverButton;
00012 using Exponent::MathTools::CBounds;
00013
00014
00015
00016 namespace Exponent
00017 {
00018 namespace GUI
00019 {
00020 namespace Controls
00021 {
00040 class CRangeSlider : public CControl
00041 {
00043 EXPONENT_CLASS_DECLARATION;
00046
00047
00048 public:
00049
00057 CRangeSlider(IControlRoot *root, const long uniqueId, const CRect &area, IActionListener *listener = NULL);
00058
00062 virtual ~CRangeSlider();
00063
00064
00065
00070 virtual void setMinimumValue(const double minValue);
00071
00076 virtual void setMaximumValue(const double maxValue);
00077
00082 virtual double getMinimumValue() const { return m_minValue; }
00083
00088 virtual double getMaximumValue() const { return m_maxValue; }
00089
00090
00091
00100 virtual void lockPositions(const bool lockMin, const bool lockMax, const double minValue, const double maxValue, const bool jumpToMax = true);
00101
00110 virtual void setColours(CAlphaColour frameColour, CAlphaColour backgroundColour, CAlphaColour handleColour, CAlphaColour handleOverColour, CAlphaColour handleDownColour);
00111
00112
00113
00118 virtual void handleLeftButtonDown(CMouseEvent &event);
00119
00124 virtual void handleLeftButtonUp(CMouseEvent &event);
00125
00130 virtual void handleMouseScroll(CMouseEvent &event);
00131
00136 virtual void handleMouseMovement(CMouseEvent &event);
00137
00142 virtual void handleMouseLeavingArea(CMouseEvent &event);
00143
00144
00145
00150 virtual void drawControl(CGraphics &graphics);
00151
00152
00153
00154 protected:
00155
00156
00157
00162 enum EDragId
00163 {
00164 e_notDragging = 0,
00165 e_draggingTop,
00166 e_draggingHandle,
00167 e_draggingBottom
00168 };
00169
00170
00171
00176 virtual void checkAndLock(const CPoint &point);
00177
00182 void handleMovement(CMouseEvent &event);
00183
00188 bool handleTopMovement(CMouseEvent &event);
00189
00194 bool handleBottomMovement(CMouseEvent &event);
00195
00200 bool handleBarMovement(CMouseEvent &event);
00201
00202
00203
00204 CRect m_sliderArea;
00205 CPoint m_grabOffset;
00206 CAlphaColour m_handleColour;
00207 CAlphaColour m_handleOverColour;
00208 CAlphaColour m_handleDownColour;
00210 CRolloverButton::ERolloverState m_state;
00211 bool m_isVertical;
00212 EDragId m_dragId;
00214 double m_minValue;
00215 double m_maxValue;
00217 bool m_lockMax;
00218 bool m_lockMin;
00219 bool m_jumpToMax;
00220 };
00221 }
00222 }
00223 }
00224 #endif // End of CRangeSlider.hpp