Removed LLUICtrl::setDoubleClickCallback and LLPanel::childSetDoubleClickCallback as they aren't used/needed and complicate things. Added LLPanel::childSetAction overload that accepts boost::singal2::signal (for boost::bind). Now using boost::function for various callbacks in LLScrollListCtrl (for boost::bind).
This commit is contained in:
@@ -765,19 +765,6 @@ void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void *userdata )
|
||||
{
|
||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||
if (child)
|
||||
{
|
||||
child->setDoubleClickCallback(cb);
|
||||
if (userdata)
|
||||
{
|
||||
child->setCallbackUserData(userdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*))
|
||||
{
|
||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||
@@ -962,7 +949,7 @@ void LLPanel::childSetWrappedText(const std::string& id, const std::string& text
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void* value)
|
||||
void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
|
||||
{
|
||||
LLButton* button = getChild<LLButton>(id);
|
||||
if (button)
|
||||
@@ -971,6 +958,15 @@ void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
|
||||
{
|
||||
LLButton* button = getChild<LLButton>(id);
|
||||
if (button)
|
||||
{
|
||||
button->setClickedCallback(function);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value)
|
||||
{
|
||||
LLTextBox* textbox = getChild<LLTextBox>(id);
|
||||
|
||||
@@ -170,7 +170,6 @@ public:
|
||||
BOOL childHasFocus(const std::string& id);
|
||||
|
||||
void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
|
||||
void childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void* userdata = NULL );
|
||||
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
|
||||
void childSetUserData(const std::string& id, void* userdata);
|
||||
|
||||
@@ -211,7 +210,8 @@ public:
|
||||
void childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) );
|
||||
|
||||
// LLButton
|
||||
void childSetAction(const std::string& id, void(*function)(void*), void* value);
|
||||
void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value);
|
||||
void childSetAction(const std::string& id, const commit_signal_t::slot_type& function);
|
||||
void childSetActionTextbox(const std::string& id, void(*function)(void*), void* value = NULL);
|
||||
void childSetControlName(const std::string& id, const std::string& control_name);
|
||||
|
||||
|
||||
@@ -2050,7 +2050,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if(mOnMaximumSelectCallback)
|
||||
{
|
||||
mOnMaximumSelectCallback(mCallbackUserData);
|
||||
mOnMaximumSelectCallback();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2088,7 +2088,7 @@ BOOL LLScrollListCtrl::selectItemAt(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if(mOnMaximumSelectCallback)
|
||||
{
|
||||
mOnMaximumSelectCallback(mCallbackUserData);
|
||||
mOnMaximumSelectCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2181,7 +2181,7 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if( mCanSelect && mOnDoubleClickCallback )
|
||||
{
|
||||
mOnDoubleClickCallback( mCallbackUserData );
|
||||
mOnDoubleClickCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3320,7 +3320,7 @@ void LLScrollListCtrl::onClickColumn(void *userdata)
|
||||
|
||||
if (parent->mOnSortChangedCallback)
|
||||
{
|
||||
parent->mOnSortChangedCallback(parent->getCallbackUserData());
|
||||
parent->mOnSortChangedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
|
||||
public LLCtrlListInterface, public LLCtrlScrollInterface
|
||||
{
|
||||
public:
|
||||
typedef boost::function<void (void)> callback_t;
|
||||
LLScrollListCtrl(
|
||||
const std::string& name,
|
||||
const LLRect& rect,
|
||||
@@ -466,9 +467,11 @@ public:
|
||||
void deselectAllItems(BOOL no_commit_on_change = FALSE); // by default, go ahead and commit on selection change
|
||||
|
||||
void highlightNthItem( S32 index );
|
||||
void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; }
|
||||
void setMaximumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; }
|
||||
void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; }
|
||||
void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
|
||||
void setMaximumSelectCallback( callback_t cb ) { mOnMaximumSelectCallback = cb; }
|
||||
void setSortChangedCallback( callback_t cb ) { mOnSortChangedCallback = cb; }
|
||||
// Convenience function; *TODO: replace with setter above + boost::bind() in calling code
|
||||
void setDoubleClickCallback( boost::function<void (void* userdata)> cb, void* userdata) { mOnDoubleClickCallback = boost::bind(cb, userdata); }
|
||||
|
||||
void swapWithNext(S32 index);
|
||||
void swapWithPrevious(S32 index);
|
||||
@@ -700,9 +703,9 @@ private:
|
||||
LLColor4 mDefaultListTextColor;
|
||||
|
||||
S32 mBorderThickness;
|
||||
void (*mOnDoubleClickCallback)(void* userdata);
|
||||
void (*mOnMaximumSelectCallback)(void* userdata );
|
||||
void (*mOnSortChangedCallback)(void* userdata);
|
||||
callback_t mOnDoubleClickCallback;
|
||||
callback_t mOnMaximumSelectCallback;
|
||||
callback_t mOnSortChangedCallback;
|
||||
|
||||
S32 mHighlightedItem;
|
||||
class LLViewBorder* mBorder;
|
||||
|
||||
@@ -527,10 +527,6 @@ BOOL LLUICtrl::getTentative() const
|
||||
return mTentative;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLUICtrl::setDoubleClickCallback( void (*cb)(void*) )
|
||||
{
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLUICtrl::setColor(const LLColor4& color)
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
// Default to no-op:
|
||||
virtual void onTabInto();
|
||||
virtual void clear();
|
||||
virtual void setDoubleClickCallback( void (*cb)(void*) );
|
||||
virtual void setColor(const LLColor4& color);
|
||||
virtual void setAlpha(F32 alpha);
|
||||
virtual void setMinValue(LLSD min_value);
|
||||
|
||||
Reference in New Issue
Block a user