diff options
Diffstat (limited to 'indra/newview/llfloatertoybox.cpp')
-rw-r--r-- | indra/newview/llfloatertoybox.cpp | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 66f644748e..324afe661f 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -42,6 +42,7 @@ LLFloaterToybox::LLFloaterToybox(const LLSD& key) , mToolBar(NULL) { mCommitCallbackRegistrar.add("Toybox.RestoreDefaults", boost::bind(&LLFloaterToybox::onBtnRestoreDefaults, this)); + mCommitCallbackRegistrar.add("Toybox.ClearAll", boost::bind(&LLFloaterToybox::onBtnClearAll, this)); } LLFloaterToybox::~LLFloaterToybox() @@ -63,6 +64,7 @@ BOOL LLFloaterToybox::postBuild() mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragTool,_1,_2,_3,_4)); mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDropTool,_1,_2,_3,_4)); + mToolBar->setButtonEnterCallback(boost::bind(&LLFloaterToybox::onToolBarButtonEnter,this,_1)); // // Sort commands by localized labels so they will appear alphabetized in all languages @@ -105,8 +107,8 @@ void LLFloaterToybox::draw() { const LLCommandId& id = *it; - const bool commandOnToolbar = gToolBarView->hasCommand(id); - mToolBar->enableCommand(id, !commandOnToolbar); + const bool command_not_present = (gToolBarView->hasCommand(id) == LLToolBarView::TOOLBAR_NONE); + mToolBar->enableCommand(id, command_not_present); } LLFloater::draw(); @@ -120,15 +122,35 @@ static bool finish_restore_toybox(const LLSD& notification, const LLSD& response { LLToolBarView::loadDefaultToolbars(); } + + return false; +} + +static bool finish_clear_all_toybox(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (option == 0) + { + LLToolBarView::clearAllToolbars(); + } + return false; } + static LLNotificationFunctorRegistration finish_restore_toybox_reg("ConfirmRestoreToybox", finish_restore_toybox); +static LLNotificationFunctorRegistration finish_clear_all_toybox_reg("ConfirmClearAllToybox", finish_clear_all_toybox); void LLFloaterToybox::onBtnRestoreDefaults() { LLNotificationsUtil::add("ConfirmRestoreToybox"); } +void LLFloaterToybox::onBtnClearAll() +{ + LLNotificationsUtil::add("ConfirmClearAllToybox"); +} + BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, @@ -140,5 +162,30 @@ BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } +void LLFloaterToybox::onToolBarButtonEnter(LLView* button) +{ + std::string suffix = ""; + + LLCommandId commandId(button->getName()); + LLCommand* command = LLCommandManager::instance().getCommand(commandId); + + if (command) + { + S32 command_loc = gToolBarView->hasCommand(commandId); + + switch(command_loc) + { + case LLToolBarView::TOOLBAR_BOTTOM: suffix = LLTrans::getString("Toolbar_Bottom_Tooltip"); break; + case LLToolBarView::TOOLBAR_LEFT: suffix = LLTrans::getString("Toolbar_Left_Tooltip"); break; + case LLToolBarView::TOOLBAR_RIGHT: suffix = LLTrans::getString("Toolbar_Right_Tooltip"); break; + + default: + break; + } + } + + mToolBar->setTooltipButtonSuffix(suffix); +} + // eof |