diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 08:04:56 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-06-21 08:04:56 +0000 |
commit | 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 (patch) | |
tree | 4a505c1e0919af52800b3ffb3eaf135e7d6f9ce6 /indra/llui/llscrollbar.h | |
parent | 351ebe9fcb76f3b99c2957004bb8493a904869ee (diff) |
merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3
ignore-dead-branch
Diffstat (limited to 'indra/llui/llscrollbar.h')
-rw-r--r-- | indra/llui/llscrollbar.h | 72 |
1 files changed, 49 insertions, 23 deletions
diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 0bbf8662aa..43604d37b7 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -36,12 +36,7 @@ #include "stdtypes.h" #include "lluictrl.h" #include "v4color.h" - -// -// Constants -// -const S32 SCROLLBAR_SIZE = 16; - +#include "llbutton.h" // // Classes @@ -50,15 +45,41 @@ class LLScrollbar : public LLUICtrl { public: + enum ORIENTATION { HORIZONTAL, VERTICAL }; + + typedef boost::function<void (S32, LLScrollbar*)> callback_t; + struct Params + : public LLInitParam::Block<Params, LLUICtrl::Params> + { + Mandatory<ORIENTATION> orientation; + Mandatory<S32> doc_size; + Mandatory<S32> doc_pos; + Mandatory<S32> page_size; + + Optional<callback_t> change_callback; + Optional<S32> step_size; + Optional<S32> thickness; + + Optional<LLUIImage*> thumb_image, + track_image; - LLScrollbar(const std::string& name, LLRect rect, - ORIENTATION orientation, - S32 doc_size, S32 doc_pos, S32 page_size, - void(*change_callback)( S32 new_pos, LLScrollbar* self, void* userdata ), - void* callback_user_data = NULL, - S32 step_size = 1); + Optional<LLUIColor> track_color, + thumb_color; + Optional<LLButton::Params> up_button; + Optional<LLButton::Params> down_button; + Optional<LLButton::Params> left_button; + Optional<LLButton::Params> right_button; + + Params(); + }; + +protected: + LLScrollbar (const Params & p); + friend class LLUICtrlFactory; + +public: virtual ~LLScrollbar(); virtual void setValue(const LLSD& value); @@ -101,13 +122,11 @@ public: void pageUp(S32 overlap); void pageDown(S32 overlap); - static void onLineUpBtnPressed(void* userdata); - static void onLineDownBtnPressed(void* userdata); + void onLineUpBtnPressed(const LLSD& data); + void onLineDownBtnPressed(const LLSD& data); void setTrackColor( const LLColor4& color ) { mTrackColor = color; } void setThumbColor( const LLColor4& color ) { mThumbColor = color; } - void setHighlightColor( const LLColor4& color ) { mHighlightColor = color; } - void setShadowColor( const LLColor4& color ) { mShadowColor = color; } void setOnScrollEndCallback(void (*callback)(void*), void* userdata) { mOnScrollEndCallback = callback; mOnScrollEndData = userdata;} @@ -115,8 +134,7 @@ private: void updateThumbRect(); void changeLine(S32 delta, BOOL update_thumb ); - void (*mChangeCallback)( S32 new_pos, LLScrollbar* self, void* userdata ); - void* mCallbackUserData; + callback_t mChangeCallback; const ORIENTATION mOrientation; S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. @@ -134,16 +152,24 @@ private: LLRect mOrigRect; S32 mLastDelta; - LLColor4 mTrackColor; - LLColor4 mThumbColor; - LLColor4 mFocusColor; - LLColor4 mHighlightColor; - LLColor4 mShadowColor; + LLUIColor mTrackColor; + LLUIColor mThumbColor; + + LLUIImagePtr mThumbImage; + LLUIImagePtr mTrackImage; + + S32 mThickness; void (*mOnScrollEndCallback)(void*); void *mOnScrollEndData; }; +namespace LLInitParam +{ + template<> + bool ParamCompare<boost::function<void (S32, LLScrollbar*)> >::equals( + const boost::function<void (S32, LLScrollbar*)> &a, const boost::function<void (S32, LLScrollbar*)> &b); +} #endif // LL_SCROLLBAR_H |