Remove mCommitCallback, mValidateCallback, and mCallbackUserData and related functions from LLUICtrl and derived classes
This commit is contained in:
@@ -291,9 +291,8 @@ void LLMultiSliderCtrl::onEditorCommit(const LLSD& value)
|
||||
val = (F32) atof( text.c_str() );
|
||||
if( mMultiSlider->getMinValue() <= val && val <= mMultiSlider->getMaxValue() )
|
||||
{
|
||||
setCurSliderValue( val );
|
||||
if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
|
||||
(!mValidateSignal || (*(mValidateSignal))(this, val)))
|
||||
setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
|
||||
if( !mValidateSignal || (*(mValidateSignal))( this, val ) )
|
||||
{
|
||||
success = TRUE;
|
||||
}
|
||||
@@ -322,8 +321,7 @@ void LLMultiSliderCtrl::onSliderCommit(const LLSD& value)
|
||||
F32 new_val = mMultiSlider->getCurSliderValue();
|
||||
|
||||
mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
|
||||
if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
|
||||
(!mValidateSignal || (*mValidateSignal)(this, new_val ) ))
|
||||
if( !mValidateSignal || (*(mValidateSignal))( this, new_val ) )
|
||||
{
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
@@ -767,9 +767,9 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*))
|
||||
void LLPanel::childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb)
|
||||
{
|
||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||
LLUICtrl* child = findChild<LLUICtrl>(id);
|
||||
if (child)
|
||||
{
|
||||
child->setValidateBeforeCommit(cb);
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
// a named callback and reference it in XML.
|
||||
void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data = NULL);
|
||||
|
||||
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
|
||||
void childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb );
|
||||
|
||||
void childSetColor(const std::string& id, const LLColor4& color);
|
||||
void childSetAlpha(const std::string& id, F32 alpha);
|
||||
|
||||
@@ -227,9 +227,8 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata )
|
||||
val = (F32) atof( text.c_str() );
|
||||
if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() )
|
||||
{
|
||||
self->setValue( val );
|
||||
if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) &&
|
||||
(!self->mValidateSignal || (*(self->mValidateSignal))( self, val )))
|
||||
self->setValue( val ); // set the value temporarily so that the callback can retrieve it.
|
||||
if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
|
||||
{
|
||||
success = TRUE;
|
||||
}
|
||||
@@ -263,8 +262,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata )
|
||||
F32 new_val = self->mSlider->getValueF32();
|
||||
|
||||
self->mValue = new_val; // set the value temporarily so that the callback can retrieve it.
|
||||
if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) &&
|
||||
(!self->mValidateSignal || (*(self->mValidateSignal))( self, new_val )))
|
||||
if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
|
||||
{
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
@@ -198,8 +198,7 @@ void LLSpinCtrl::onUpBtn( const LLSD& data )
|
||||
|
||||
F32 saved_val = (F32)getValue().asReal();
|
||||
setValue(val);
|
||||
if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) ||
|
||||
(mValidateSignal && !(*mValidateSignal)( this, val ) ))
|
||||
if( mValidateSignal && !(*mValidateSignal)( this, val ) )
|
||||
{
|
||||
setValue( saved_val );
|
||||
reportInvalidData();
|
||||
@@ -227,8 +226,7 @@ void LLSpinCtrl::onDownBtn( const LLSD& data )
|
||||
|
||||
F32 saved_val = (F32)getValue().asReal();
|
||||
setValue(val);
|
||||
if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) ||
|
||||
(mValidateSignal && !(*mValidateSignal)( this, val ) ))
|
||||
if( mValidateSignal && !(*mValidateSignal)( this, val ) )
|
||||
{
|
||||
setValue( saved_val );
|
||||
reportInvalidData();
|
||||
@@ -317,9 +315,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data )
|
||||
|
||||
F32 saved_val = mValue;
|
||||
mValue = val;
|
||||
|
||||
if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) &&
|
||||
(!mValidateSignal || (*mValidateSignal)(this, val) ))
|
||||
if( !mValidateSignal || (*mValidateSignal)( this, val ) )
|
||||
{
|
||||
success = TRUE;
|
||||
onCommit();
|
||||
|
||||
@@ -139,7 +139,6 @@ private:
|
||||
|
||||
std::vector<S32> mLineLengthList;
|
||||
callback_t mClickedCallback;
|
||||
void* mCallbackUserData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,9 +45,6 @@ LLUICtrl::LLUICtrl() :
|
||||
mViewModel(LLViewModelPtr(new LLViewModel)),
|
||||
mCommitSignal(NULL),
|
||||
mValidateSignal(NULL),
|
||||
mCommitCallback(NULL),
|
||||
mValidateCallback(NULL),
|
||||
mCallbackUserData(NULL),
|
||||
mTentative(FALSE),
|
||||
mTabStop(TRUE),
|
||||
mIsChrome(FALSE)
|
||||
@@ -62,10 +59,7 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque
|
||||
LLView( name, rect, mouse_opaque, reshape ),
|
||||
mCommitSignal(NULL),
|
||||
mValidateSignal(NULL),
|
||||
mCommitCallback(NULL),
|
||||
mViewModel(LLViewModelPtr(new LLViewModel)),
|
||||
mValidateCallback( NULL ),
|
||||
mCallbackUserData( NULL ),
|
||||
mTentative( FALSE ),
|
||||
mTabStop( TRUE ),
|
||||
mIsChrome(FALSE)
|
||||
@@ -90,10 +84,6 @@ LLUICtrl::~LLUICtrl()
|
||||
|
||||
void LLUICtrl::onCommit()
|
||||
{
|
||||
if( mCommitCallback )
|
||||
{
|
||||
mCommitCallback( this, mCallbackUserData );
|
||||
}
|
||||
if (mCommitSignal)
|
||||
(*mCommitSignal)(this, getValue());
|
||||
}
|
||||
|
||||
@@ -50,9 +50,6 @@ public:
|
||||
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
|
||||
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t;
|
||||
|
||||
typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata);
|
||||
typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata);
|
||||
|
||||
LLUICtrl();
|
||||
LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE,
|
||||
commit_callback_t commit_callback = NULL,
|
||||
@@ -126,13 +123,6 @@ public:
|
||||
boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
|
||||
boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
|
||||
|
||||
// *TODO: Deprecate; for backwards compatability only:
|
||||
//Keeping userdata around with legacy setCommitCallback because it's used ALL OVER THE PLACE.
|
||||
void* getCallbackUserData() const { return mCallbackUserData; }
|
||||
void setCallbackUserData( void* data ) { mCallbackUserData = data; }
|
||||
|
||||
void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; }
|
||||
void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = 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 );
|
||||
@@ -155,10 +145,6 @@ protected:
|
||||
enable_signal_t* mValidateSignal;
|
||||
|
||||
LLViewModelPtr mViewModel;
|
||||
void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
|
||||
BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );
|
||||
|
||||
void* mCallbackUserData;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user