llmultislider.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_MULTI_SLIDER_H
00033 #define LL_MULTI_SLIDER_H
00034 
00035 #include "lluictrl.h"
00036 #include "v4color.h"
00037 
00038 class LLUICtrlFactory;
00039 
00040 class LLMultiSlider : public LLUICtrl
00041 {
00042 public:
00043         LLMultiSlider( 
00044                 const LLString& name,
00045                 const LLRect& rect,
00046                 void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
00047                 void* callback_userdata,
00048                 F32 initial_value,
00049                 F32 min_value,
00050                 F32 max_value,
00051                 F32 increment,
00052                 S32 max_sliders,
00053                 BOOL allow_overlap,
00054                 BOOL draw_track,
00055                 BOOL use_triangle,
00056                 const LLString& control_name = LLString::null );
00057 
00058         virtual LLXMLNodePtr getXML(bool save_children = true) const;
00059         static  LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
00060 
00061         void                    setSliderValue(const LLString& name, F32 value, BOOL from_event = FALSE);
00062         F32                             getSliderValue(const LLString& name) const;
00063 
00064         const LLString& getCurSlider() const                                    { return mCurSlider; }
00065         F32                             getCurSliderValue() const                               { return getSliderValue(mCurSlider); }
00066         void                    setCurSlider(const LLString& name);
00067         void                    setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }
00068 
00069         virtual void    setValue(const LLSD& value);
00070         virtual LLSD    getValue() const                { return mValue; }
00071 
00072         virtual void    setMinValue(LLSD min_value)     { setMinValue((F32)min_value.asReal()); }
00073         virtual void    setMaxValue(LLSD max_value)     { setMaxValue((F32)max_value.asReal());  }
00074 
00075         F32                             getInitialValue() const { return mInitialValue; }
00076         F32                             getMinValue() const             { return mMinValue; }
00077         F32                             getMaxValue() const             { return mMaxValue; }
00078         F32                             getIncrement() const    { return mIncrement; }
00079         void                    setMinValue(F32 min_value) { mMinValue = min_value; }
00080         void                    setMaxValue(F32 max_value) { mMaxValue = max_value; }
00081         void                    setIncrement(F32 increment) { mIncrement = increment; }
00082         void                    setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
00083         void                    setMouseUpCallback(     void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
00084 
00085         bool findUnusedValue(F32& initVal);
00086         const LLString& addSlider();
00087         const LLString& addSlider(F32 val);
00088         void                    deleteSlider(const LLString& name);
00089         void                    deleteCurSlider()                       { deleteSlider(mCurSlider); }
00090         void                    clear();
00091 
00092         virtual BOOL    handleHover(S32 x, S32 y, MASK mask);
00093         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00094         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00095         virtual BOOL    handleKeyHere(KEY key, MASK mask);
00096         virtual void    draw();
00097 
00098 protected:
00099         LLSD                    mValue;
00100         F32                             mInitialValue;
00101         F32                             mMinValue;
00102         F32                             mMaxValue;
00103         F32                             mIncrement;
00104         LLString                mCurSlider;
00105         static S32              mNameCounter;
00106 
00107         S32                             mMaxNumSliders;
00108         BOOL                    mAllowOverlap;
00109         BOOL                    mDrawTrack;
00110         BOOL                    mUseTriangle;                   
00111 
00112         S32                             mMouseOffset;
00113         LLRect                  mDragStartThumbRect;
00114 
00115         std::map<LLString, LLRect>      mThumbRects;
00116         LLColor4                mTrackColor;
00117         LLColor4                mThumbOutlineColor;
00118         LLColor4                mThumbCenterColor;
00119         LLColor4                mThumbCenterSelectedColor;
00120         LLColor4                mDisabledThumbColor;
00121         LLColor4                mTriangleColor;
00122         
00123         void                    (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
00124         void                    (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
00125 };
00126 
00127 #endif  // LL_LLSLIDER_H

Generated on Fri May 16 08:32:54 2008 for SecondLife by  doxygen 1.5.5