diff options
author | Palmer Truelson <palmer@lindenlab.com> | 2009-11-25 09:42:58 -0800 |
---|---|---|
committer | Palmer Truelson <palmer@lindenlab.com> | 2009-11-25 09:42:58 -0800 |
commit | bb614fa887ec7cadc5b370c1dcf412ae5cf662e1 (patch) | |
tree | 2ee594428704e0f4774f717d71485ee0bdde8748 /indra/llui/llslider.cpp | |
parent | 6d66910c6e2fbb25bf8b5c7b90e795f350342104 (diff) | |
parent | 57bc7dc44f31ef132a4abec228459c490c425eed (diff) |
Merge of viewer 2
Diffstat (limited to 'indra/llui/llslider.cpp')
-rw-r--r-- | indra/llui/llslider.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index da2fc7c68b..a6f729b396 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -77,7 +77,9 @@ LLSlider::LLSlider(const LLSlider::Params& p) mTrackImageHorizontal(p.track_image_horizontal), mTrackImageVertical(p.track_image_vertical), mTrackHighlightHorizontalImage(p.track_highlight_horizontal_image), - mTrackHighlightVerticalImage(p.track_highlight_vertical_image) + mTrackHighlightVerticalImage(p.track_highlight_vertical_image), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL) { mViewModel->setValue(p.initial_value); updateThumbRect(); @@ -86,9 +88,19 @@ LLSlider::LLSlider(const LLSlider::Params& p) setValue(getValueF32()); if (p.mouse_down_callback.isProvided()) - initCommitCallback(p.mouse_down_callback, mMouseDownSignal); + { + setMouseDownCallback(initCommitCallback(p.mouse_down_callback)); + } if (p.mouse_up_callback.isProvided()) - initCommitCallback(p.mouse_up_callback, mMouseUpSignal); + { + setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); + } +} + +LLSlider::~LLSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; } void LLSlider::setValue(F32 value, BOOL from_event) @@ -202,7 +214,8 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - mMouseUpSignal( this, getValueF32() ); + if (mMouseUpSignal) + (*mMouseUpSignal)( this, getValueF32() ); handled = TRUE; make_ui_sound("UISndClickRelease"); @@ -222,7 +235,8 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - mMouseDownSignal( this, getValueF32() ); + if (mMouseDownSignal) + (*mMouseDownSignal)( this, getValueF32() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -364,3 +378,15 @@ void LLSlider::draw() LLUICtrl::draw(); } + +boost::signals2::connection LLSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} |