summaryrefslogtreecommitdiff
path: root/indra/llui/lltoolbarview.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-09-28 16:25:32 -0700
committerRichard Nelson <richard@lindenlab.com>2011-09-28 16:25:32 -0700
commit6a49f2947f05963c577a1644c16a8affc779da63 (patch)
treefc166c3c1ea4365de90e41dbceb4173a6f2ebcf9 /indra/llui/lltoolbarview.cpp
parentfc0f5173eb20fad8934420e6eec8873d71490894 (diff)
EXP-1234 WIP experimental drag and drop
Diffstat (limited to 'indra/llui/lltoolbarview.cpp')
-rw-r--r--indra/llui/lltoolbarview.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index b374a0bfc4..0c3a6bd0ac 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -55,7 +55,10 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
: LLUICtrl(p),
mToolbarLeft(NULL),
mToolbarRight(NULL),
- mToolbarBottom(NULL)
+ mToolbarBottom(NULL),
+ mDragButton(NULL),
+ mMouseX(0),
+ mMouseY(0)
{
}
@@ -283,4 +286,40 @@ void LLToolBarView::draw()
//gl_rect_2d(right_rect, back_color_vert, TRUE);
LLUICtrl::draw();
+
+ if (mDragButton)
+ {
+ S32 cursor_x, cursor_y;
+ mDragButton->setOrigin(mMouseX - mDragButton->getRect().getWidth(), mMouseY - mDragButton->getRect().getHeight());
+ drawChild(mDragButton);
+ }
+}
+
+void LLToolBarView::startDrag(LLToolBarButton* button)
+{
+ mDragButton = button;
+ addChild(mDragButton);
+ gFocusMgr.setMouseCapture(this);
+}
+
+BOOL LLToolBarView::handleHover(S32 x, S32 y, MASK mask)
+{
+ mMouseX = x;
+ mMouseY = y;
+ return LLUICtrl::handleHover(x, y, mask);
+}
+
+BOOL LLToolBarView::handleMouseUp(S32 x, S32 y, MASK mask)
+{
+ if (hasMouseCapture())
+ {
+ gFocusMgr.setMouseCapture(NULL);
+ }
+ return LLUICtrl::handleMouseUp(x, y, mask);
+}
+
+void LLToolBarView::onMouseCaptureLost()
+{
+ delete mDragButton;
+ mDragButton = NULL;
}