summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-10-05 17:38:56 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-10-05 17:38:56 -0700
commit55d2e0020b62f64133151c70adc3acc084685e3e (patch)
tree2daaa162184a28888ac678f85b4dfc00a6a012ad /indra/llui
parent83dd4b68712846b6f5a9a8218fdf5c80dcb6a3fa (diff)
parentf7cd012d96c2978954262aed30bbc2e2b1772b2b (diff)
Merge!
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltoolbar.cpp14
-rw-r--r--indra/llui/lltoolbar.h7
2 files changed, 14 insertions, 7 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 392e26f496..7fc6a6de8d 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -103,7 +103,11 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mPadTop(p.pad_top),
mPadBottom(p.pad_bottom),
mPadBetween(p.pad_between),
- mPopupMenuHandle()
+ mPopupMenuHandle(),
+ mStartDragItemCallback(NULL),
+ mHandleDragItemCallback(NULL),
+ mHandleDropCallback(NULL),
+ mDragAndDropTarget(false)
{
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text;
mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon;
@@ -253,7 +257,7 @@ bool LLToolBar::removeCommand(const LLCommandId& commandId)
mButtons.erase(it_button);
mNeedsLayout = true;
-
+
return true;
}
@@ -635,8 +639,6 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
cbParam.parameter = commandp->executeParameters();
button->setCommitCallback(cbParam);
- button->setStartDragCallback(mStartDragItemCallback);
- button->setHandleDragCallback(mHandleDragItemCallback);
const std::string& isEnabledFunction = commandp->isEnabledFunctionName();
if (isEnabledFunction.length() > 0)
@@ -671,6 +673,10 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
}
}
+ // Drag and drop behavior must work also if provided in the Toybox and, potentially, any read-only toolbar
+ button->setStartDragCallback(mStartDragItemCallback);
+ button->setHandleDragCallback(mHandleDragItemCallback);
+
button->setCommandId(id);
return button;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index ac99e23aae..3fbe5a7703 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -75,7 +75,7 @@ private:
S32 mMouseDownY;
LLUI::RangeS32 mWidthRange;
S32 mDesiredHeight;
- bool mIsDragged;
+ bool mIsDragged;
tool_startdrag_callback_t mStartDragItemCallback;
tool_handledrag_callback_t mHandleDragItemCallback;
@@ -159,7 +159,7 @@ public:
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
-
+
bool addCommand(const LLCommandId& commandId, int rank = -1);
bool removeCommand(const LLCommandId& commandId);
bool hasCommand(const LLCommandId& commandId) const;
@@ -168,6 +168,7 @@ public:
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; }
+ bool isReadOnly() const { return mReadOnly; }
LLToolBarButton* createButton(const LLCommandId& id);
@@ -180,7 +181,7 @@ protected:
tool_startdrag_callback_t mStartDragItemCallback;
tool_handledrag_callback_t mHandleDragItemCallback;
tool_handledrop_callback_t mHandleDropCallback;
- bool mDragAndDropTarget;
+ bool mDragAndDropTarget;
public:
// Methods used in loading and saving toolbar settings