added xui param to turn off drag-and-drop reordering of bottom tray buttons

meow-7.2.2
Richard Linden 2010-09-28 17:13:24 -07:00
parent 6c1f89ea6e
commit ebb4920894
2 changed files with 35 additions and 26 deletions

View File

@ -65,31 +65,42 @@ LLDefaultChildRegistry::Register<LLBottomtrayButton> bottomtray_button("bottomtr
// virtual
BOOL LLBottomtrayButton::handleHover(S32 x, S32 y, MASK mask)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass hover to bottomtray
LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY);
return FALSE;
if (mCanDrag)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass hover to bottomtray
LLBottomTray::getInstance()->onDraggableButtonHover(screenX, screenY);
return TRUE;
}
else
{
return LLButton::handleHover(x, y, mask);
}
}
//virtual
BOOL LLBottomtrayButton::handleMouseUp(S32 x, S32 y, MASK mask)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass mouse up to bottomtray
LLBottomTray::getInstance()->onDraggableButtonMouseUp(this, screenX, screenY);
LLButton::handleMouseUp(x, y, mask);
return FALSE;
if (mCanDrag)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass mouse up to bottomtray
LLBottomTray::getInstance()->onDraggableButtonMouseUp(this, screenX, screenY);
}
return LLButton::handleMouseUp(x, y, mask);
}
//virtual
BOOL LLBottomtrayButton::handleMouseDown(S32 x, S32 y, MASK mask)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass mouse up to bottomtray
LLBottomTray::getInstance()->onDraggableButtonMouseDown(this, screenX, screenY);
LLButton::handleMouseDown(x, y, mask);
return FALSE;
if (mCanDrag)
{
S32 screenX, screenY;
localPointToScreen(x, y, &screenX, &screenY);
// pass mouse up to bottomtray
LLBottomTray::getInstance()->onDraggableButtonMouseDown(this, screenX, screenY);
}
return LLButton::handleMouseDown(x, y, mask);
}
static void update_build_button_enable_state()
@ -150,8 +161,6 @@ public:
{
mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL);
buildFromFile("panel_bottomtray_lite.xml");
// Necessary for focus movement among child controls
setFocusRoot(TRUE);
}
BOOL postBuild()
@ -211,16 +220,11 @@ LLBottomTray::LLBottomTray(const LLSD&)
buildFromFile("panel_bottomtray.xml");
LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
//this is to fix a crash that occurs because LLBottomTray is a singleton
//and thus is deleted at the end of the viewers lifetime, but to be cleanly
//destroyed LLBottomTray requires some subsystems that are long gone
//LLUI::getRootView()->addChild(this);
// Necessary for focus movement among child controls
setFocusRoot(TRUE);
{
mBottomTrayLite = new LLBottomTrayLite();
mBottomTrayLite->setFollowsAll();

View File

@ -54,7 +54,9 @@ class LLBottomtrayButton : public LLButton
public:
struct Params : public LLInitParam::Block<Params, LLButton::Params>
{
Params(){}
Optional<bool> can_drag;
Params()
: can_drag("can_drag", true){}
};
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
@ -62,11 +64,14 @@ public:
protected:
LLBottomtrayButton(const Params& p)
: LLButton(p)
: LLButton(p),
mCanDrag(p.can_drag)
{
}
friend class LLUICtrlFactory;
bool mCanDrag;
};
class LLBottomTray