Merge!
commit
55d2e0020b
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@ BOOL LLFloaterToybox::postBuild()
|
|||
|
||||
mBtnRestoreDefaults = getChild<LLButton>("btn_restore_defaults");
|
||||
mToolBar = getChild<LLToolBar>("toybox_toolbar");
|
||||
|
||||
mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3));
|
||||
mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4));
|
||||
mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4));
|
||||
|
||||
LLCommandManager& cmdMgr = LLCommandManager::instance();
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -377,24 +377,26 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb
|
|||
if (command)
|
||||
{
|
||||
// Convert the (x,y) position in rank in toolbar
|
||||
int rank = toolbar->getRankFromPosition(x,y);
|
||||
int rank = 0;
|
||||
if (!toolbar->isReadOnly())
|
||||
{
|
||||
rank = toolbar->getRankFromPosition(x,y);
|
||||
}
|
||||
// Suppress the command from the toolbars (including the one it's dropped in,
|
||||
// this will handle move position).
|
||||
gToolBarView->mToolbarLeft->removeCommand(command->id());
|
||||
gToolBarView->mToolbarRight->removeCommand(command->id());
|
||||
gToolBarView->mToolbarBottom->removeCommand(command->id());
|
||||
// Now insert it in the toolbar at the detected rank
|
||||
toolbar->addCommand(command->id(),rank);
|
||||
if (!toolbar->isReadOnly())
|
||||
{
|
||||
toolbar->addCommand(command->id(),rank);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llwarns << "Command couldn't be found in command manager" << llendl;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "Merov debug : handleDrop. Drop source is not a widget -> nothing to do" << llendl;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue