summaryrefslogtreecommitdiff
path: root/indra/llui/lltoolbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r--indra/llui/lltoolbar.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 515605200e..b0a072c00e 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -112,6 +112,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mStartDragItemCallback(NULL),
mHandleDragItemCallback(NULL),
mHandleDropCallback(NULL),
+ mButtonAddSignal(NULL),
mDragAndDropTarget(false)
{
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
@@ -121,6 +122,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
LLToolBar::~LLToolBar()
{
delete mPopupMenuHandle.get();
+ delete mButtonAddSignal;
}
void LLToolBar::createContextMenu()
@@ -212,7 +214,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
mButtonPanel->addChild(button);
mButtonMap.insert(std::make_pair(commandId.uuid(), button));
-
// Insert the command and button in the right place in their respective lists
if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE))
{
@@ -236,6 +237,11 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank)
mButtons.insert(it_button,button);
}
+ if (mButtonAddSignal)
+ {
+ (*mButtonAddSignal)(button);
+ }
+
mNeedsLayout = true;
return true;
@@ -898,6 +904,12 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
return button;
}
+boost::signals2::connection LLToolBar::setButtonAddCallback(const button_add_signal_t::slot_type& cb)
+{
+ if (!mButtonAddSignal) mButtonAddSignal = new button_add_signal_t();
+ return mButtonAddSignal->connect(cb);
+}
+
BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,