Added several missing mouse-event callback signals to LLUICtrl
This commit is contained in:
@@ -49,6 +49,11 @@ LLUICtrl::LLUICtrl() :
|
||||
mValidateSignal(NULL),
|
||||
mMouseEnterSignal(NULL),
|
||||
mMouseLeaveSignal(NULL),
|
||||
mMouseDownSignal(NULL),
|
||||
mMouseUpSignal(NULL),
|
||||
mRightMouseDownSignal(NULL),
|
||||
mRightMouseUpSignal(NULL),
|
||||
mDoubleClickSignal(NULL),
|
||||
mTentative(FALSE),
|
||||
mTabStop(TRUE),
|
||||
mIsChrome(FALSE)
|
||||
@@ -66,6 +71,11 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
|
||||
mViewModel(LLViewModelPtr(new LLViewModel)),
|
||||
mMouseEnterSignal(NULL),
|
||||
mMouseLeaveSignal(NULL),
|
||||
mMouseDownSignal(NULL),
|
||||
mMouseUpSignal(NULL),
|
||||
mRightMouseDownSignal(NULL),
|
||||
mRightMouseUpSignal(NULL),
|
||||
mDoubleClickSignal(NULL),
|
||||
mTentative( FALSE ),
|
||||
mTabStop( TRUE ),
|
||||
mIsChrome(FALSE)
|
||||
@@ -86,6 +96,13 @@ LLUICtrl::~LLUICtrl()
|
||||
|
||||
delete mCommitSignal;
|
||||
delete mValidateSignal;
|
||||
delete mMouseEnterSignal;
|
||||
delete mMouseLeaveSignal;
|
||||
delete mMouseDownSignal;
|
||||
delete mMouseUpSignal;
|
||||
delete mRightMouseDownSignal;
|
||||
delete mRightMouseUpSignal;
|
||||
delete mDoubleClickSignal;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +124,60 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
|
||||
}
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = LLView::handleMouseDown(x,y,mask);
|
||||
if (mMouseDownSignal)
|
||||
{
|
||||
(*mMouseDownSignal)(this,x,y,mask);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = LLView::handleMouseUp(x,y,mask);
|
||||
if (mMouseUpSignal)
|
||||
{
|
||||
(*mMouseUpSignal)(this,x,y,mask);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = LLView::handleRightMouseDown(x,y,mask);
|
||||
if (mRightMouseDownSignal)
|
||||
{
|
||||
(*mRightMouseDownSignal)(this,x,y,mask);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = LLView::handleRightMouseUp(x,y,mask);
|
||||
if(mRightMouseUpSignal)
|
||||
{
|
||||
(*mRightMouseUpSignal)(this,x,y,mask);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
BOOL handled = LLView::handleDoubleClick(x, y, mask);
|
||||
if (mDoubleClickSignal)
|
||||
{
|
||||
(*mDoubleClickSignal)(this, x, y, mask);
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
||||
void LLUICtrl::onCommit()
|
||||
{
|
||||
if (mCommitSignal)
|
||||
@@ -697,3 +768,33 @@ boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal
|
||||
if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t();
|
||||
return mMouseLeaveSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t();
|
||||
return mMouseDownSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t();
|
||||
return mMouseUpSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t();
|
||||
return mRightMouseDownSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t();
|
||||
return mRightMouseUpSignal->connect(cb);
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t();
|
||||
return mDoubleClickSignal->connect(cb);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ class LLUICtrl
|
||||
public:
|
||||
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t;
|
||||
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
|
||||
typedef boost::signals2::signal<void (LLUICtrl* ctrl, S32 x, S32 y, MASK mask)> mouse_signal_t;
|
||||
typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t;
|
||||
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t;
|
||||
|
||||
@@ -69,6 +70,11 @@ public:
|
||||
/*virtual*/ BOOL isCtrl() const;
|
||||
/*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
|
||||
|
||||
// From LLFocusableElement
|
||||
/*virtual*/ void setFocus( BOOL b );
|
||||
@@ -132,6 +138,14 @@ public:
|
||||
|
||||
boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb );
|
||||
|
||||
boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb );
|
||||
|
||||
boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb );
|
||||
|
||||
// *TODO: Deprecate; for backwards compatability only:
|
||||
boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data);
|
||||
boost::signals2::connection setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb );
|
||||
@@ -165,6 +179,13 @@ protected:
|
||||
commit_signal_t* mMouseEnterSignal;
|
||||
commit_signal_t* mMouseLeaveSignal;
|
||||
|
||||
mouse_signal_t* mMouseDownSignal;
|
||||
mouse_signal_t* mMouseUpSignal;
|
||||
mouse_signal_t* mRightMouseDownSignal;
|
||||
mouse_signal_t* mRightMouseUpSignal;
|
||||
|
||||
mouse_signal_t* mDoubleClickSignal;
|
||||
|
||||
LLViewModelPtr mViewModel;
|
||||
|
||||
LLControlVariable* mMakeVisibleControlVariable;
|
||||
|
||||
Reference in New Issue
Block a user