diff options
| author | Rick Pasetto <rick@lindenlab.com> | 2009-11-25 09:54:19 -0800 |
|---|---|---|
| committer | Rick Pasetto <rick@lindenlab.com> | 2009-11-25 09:54:19 -0800 |
| commit | 05ae52a37f9f4d2519c40fe38f1b7143270c46ee (patch) | |
| tree | ba3ea89cda34343550a909700f53ab18043a5d4a /indra/llui/llmultislider.cpp | |
| parent | e2e7d544b6a114e70e3b46f516a4f0e8d7db4bd1 (diff) | |
| parent | 46b36d4fde4de97cd9960553ea77a64fbbe34b6a (diff) | |
merge
Diffstat (limited to 'indra/llui/llmultislider.cpp')
| -rw-r--r-- | indra/llui/llmultislider.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 68e496aed1..1891bca36c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -84,17 +84,30 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mThumbCenterSelectedColor(p.thumb_center_selected_color()), mDisabledThumbColor(p.thumb_disabled_color()), mTriangleColor(p.triangle_color()), - mThumbWidth(p.thumb_width) + mThumbWidth(p.thumb_width), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL) { mValue.emptyMap(); mCurSlider = LLStringUtil::null; 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)); + } +} + +LLMultiSlider::~LLMultiSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; } + void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { // exit if not there @@ -325,7 +338,8 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - mMouseUpSignal( this, LLSD() ); + if (mMouseUpSignal) + (*mMouseUpSignal)( this, LLSD() ); handled = TRUE; make_ui_sound("UISndClickRelease"); @@ -345,7 +359,8 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - mMouseDownSignal( this, LLSD() ); + if (mMouseDownSignal) + (*mMouseDownSignal)( this, LLSD() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -557,3 +572,15 @@ void LLMultiSlider::draw() LLF32UICtrl::draw(); } + +boost::signals2::connection LLMultiSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLMultiSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} |
