diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 61 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 19 |
2 files changed, 60 insertions, 20 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index b0a072c00e..97dc1e3316 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -113,6 +113,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mHandleDragItemCallback(NULL), mHandleDropCallback(NULL), mButtonAddSignal(NULL), + mButtonEnterSignal(NULL), mDragAndDropTarget(false) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; @@ -123,6 +124,7 @@ LLToolBar::~LLToolBar() { delete mPopupMenuHandle.get(); delete mButtonAddSignal; + delete mButtonEnterSignal; } void LLToolBar::createContextMenu() @@ -358,6 +360,23 @@ bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) return (command_button != NULL); } +bool LLToolBar::flashCommand(const LLCommandId& commandId, bool flash) +{ + LLButton * command_button = NULL; + + if (commandId != LLCommandId::null) + { + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); + if (it != mButtonMap.end()) + { + command_button = it->second; + command_button->setFlashing(flash ? TRUE : FALSE); + } + } + + return (command_button != NULL); +} + BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { LLRect button_panel_rect; @@ -876,8 +895,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) button->setCommitCallback(executeParam); } - - + // Set up "is running" query callback const std::string& isRunningFunction = commandp->isRunningFunctionName(); if (isRunningFunction.length() > 0) { @@ -904,12 +922,18 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) return button; } -boost::signals2::connection LLToolBar::setButtonAddCallback(const button_add_signal_t::slot_type& cb) +boost::signals2::connection LLToolBar::setButtonAddCallback(const button_signal_t::slot_type& cb) { - if (!mButtonAddSignal) mButtonAddSignal = new button_add_signal_t(); + if (!mButtonAddSignal) mButtonAddSignal = new button_signal_t(); return mButtonAddSignal->connect(cb); } +boost::signals2::connection LLToolBar::setButtonEnterCallback(const button_signal_t::slot_type& cb) +{ + if (!mButtonEnterSignal) mButtonEnterSignal = new button_signal_t(); + return mButtonEnterSignal->connect(cb); +} + BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, @@ -981,8 +1005,6 @@ LLToolBarButton::LLToolBarButton(const Params& p) mOriginalImageOverlayColor(p.image_overlay_color), mOriginalImageOverlaySelectedColor(p.image_overlay_selected_color) { - mButtonFlashRate = 0.0; - mButtonFlashCount = 0; } LLToolBarButton::~LLToolBarButton() @@ -1024,6 +1046,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { handled = LLButton::handleHover(x, y, mask); } + return handled; } @@ -1036,6 +1059,12 @@ void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask) { mNeedsHighlight = TRUE; } + + LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); + if (parent_toolbar && parent_toolbar->mButtonEnterSignal) + { + (*(parent_toolbar->mButtonEnterSignal))(this); + } } void LLToolBarButton::onMouseCaptureLost() @@ -1084,25 +1113,25 @@ void LLToolBarButton::setEnabled(BOOL enabled) } } - const std::string LLToolBarButton::getToolTip() const { std::string tooltip; + if (labelIsTruncated() || getCurrentLabel().empty()) { - return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip(); + tooltip = LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip(); } else { - return LLView::getToolTip(); + tooltip = LLView::getToolTip(); } -} - - - - - - + LLToolBar* parent_toolbar = getParentByType<LLToolBar>(); + if (parent_toolbar && parent_toolbar->mButtonTooltipSuffix.length() > 0) + { + tooltip = tooltip + "\n(" + parent_toolbar->mButtonTooltipSuffix + ")"; + } + return tooltip; +} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 68fc44ee8e..7ceb75aeed 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -120,6 +120,8 @@ namespace LLToolBarEnums SIDE_RIGHT, SIDE_TOP, }; + + LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType); } // NOTE: This needs to occur before Param block declaration for proper compilation. @@ -142,6 +144,7 @@ namespace LLInitParam class LLToolBar : public LLUICtrl { + friend class LLToolBarButton; public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -187,6 +190,7 @@ public: bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); bool stopCommandInProgress(const LLCommandId& commandId); + bool flashCommand(const LLCommandId& commandId, bool flash); void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } @@ -195,9 +199,13 @@ public: LLToolBarButton* createButton(const LLCommandId& id); - typedef boost::signals2::signal<void (LLView* button)> button_add_signal_t; - boost::signals2::connection setButtonAddCallback(const button_add_signal_t::slot_type& cb); + typedef boost::signals2::signal<void (LLView* button)> button_signal_t; + boost::signals2::connection setButtonAddCallback(const button_signal_t::slot_type& cb); + boost::signals2::connection setButtonEnterCallback(const button_signal_t::slot_type& cb); + + void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; } + LLToolBarEnums::SideType getSideType() const { return mSideType; } bool hasButtons() const { return !mButtons.empty(); } bool isModified() const { return mModified; } @@ -257,9 +265,12 @@ private: LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT]; - LLHandle<class LLContextMenu> mPopupMenuHandle; + LLHandle<class LLContextMenu> mPopupMenuHandle; + + button_signal_t* mButtonAddSignal; + button_signal_t* mButtonEnterSignal; - button_add_signal_t* mButtonAddSignal; + std::string mButtonTooltipSuffix; }; |