llslider.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLSLIDER_H
00033 #define LL_LLSLIDER_H
00034 
00035 #include "lluictrl.h"
00036 #include "v4color.h"
00037 
00038 class LLUICtrlFactory;
00039 
00040 class LLSlider : public LLUICtrl
00041 {
00042 public:
00043         LLSlider( 
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                 BOOL volume,
00053                 const LLString& control_name = LLString::null );
00054 
00055         virtual EWidgetType getWidgetType() const;
00056         virtual LLString getWidgetTag() const;
00057         virtual LLXMLNodePtr getXML(bool save_children = true) const;
00058         static  LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
00059 
00060         void                    setValue( F32 value, BOOL from_event = FALSE );
00061         F32                             getValueF32() const;
00062 
00063         virtual void    setValue(const LLSD& value )    { setValue((F32)value.asReal(), TRUE); }
00064         virtual LLSD    getValue() const                { return LLSD(getValueF32()); }
00065 
00066         virtual void    setMinValue(LLSD min_value)     { setMinValue((F32)min_value.asReal()); }
00067         virtual void    setMaxValue(LLSD max_value)     { setMaxValue((F32)max_value.asReal());  }
00068 
00069         F32                             getInitialValue() const { return mInitialValue; }
00070         F32                             getMinValue() const             { return mMinValue; }
00071         F32                             getMaxValue() const             { return mMaxValue; }
00072         F32                             getIncrement() const    { return mIncrement; }
00073         BOOL                    getVolumeSlider() const { return mVolumeSlider; }
00074         void                    setMinValue(F32 min_value) {mMinValue = min_value;}
00075         void                    setMaxValue(F32 max_value) {mMaxValue = max_value;}
00076         void                    setIncrement(F32 increment) {mIncrement = increment;}
00077         void                    setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
00078         void                    setMouseUpCallback(     void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
00079 
00080         virtual BOOL    handleHover(S32 x, S32 y, MASK mask);
00081         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00082         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00083         virtual BOOL    handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
00084         virtual void    draw();
00085 
00086 protected:
00087         void                    setValueAndCommit(F32 value);
00088 
00089 protected:
00090         F32                             mValue;
00091         F32                             mInitialValue;
00092         F32                             mMinValue;
00093         F32                             mMaxValue;
00094         F32                             mIncrement;
00095 
00096         BOOL                    mVolumeSlider;
00097         S32                             mMouseOffset;
00098         LLRect                  mDragStartThumbRect;
00099 
00100         LLRect                  mThumbRect;
00101         LLColor4                mTrackColor;
00102         LLColor4                mThumbOutlineColor;
00103         LLColor4                mThumbCenterColor;
00104         LLColor4                mDisabledThumbColor;
00105         
00106         void                    (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
00107         void                    (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
00108 };
00109 
00110 #endif  // LL_LLSLIDER_H

Generated on Thu Jul 1 06:09:11 2010 for Second Life Viewer by  doxygen 1.4.7