diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.h | 6 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 12 | ||||
-rw-r--r-- | indra/llui/lltoolbarview.cpp | 44 | ||||
-rw-r--r-- | indra/llui/lltoolbarview.h | 6 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 10 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 3 |
7 files changed, 34 insertions, 51 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 783990780b..b1147134c2 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -53,7 +53,7 @@ LLCommand::Params::Params() , icon("icon") , label_ref("label_ref") , name("name") - , param("param") + , parameter("parameter") , tooltip_ref("tooltip_ref") { } @@ -64,7 +64,7 @@ LLCommand::LLCommand(const LLCommand::Params& p) , mIcon(p.icon) , mIdentifier(p.name) , mLabelRef(p.label_ref) - , mParam(p.param) + , mParameter(p.parameter) , mTooltipRef(p.tooltip_ref) { } diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 4781f77177..6481a05689 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -93,7 +93,7 @@ public: Mandatory<std::string> icon; Mandatory<std::string> label_ref; Mandatory<std::string> name; - Optional<std::string> param; + Optional<LLSD> parameter; Mandatory<std::string> tooltip_ref; Params(); @@ -106,7 +106,7 @@ public: const std::string& icon() const { return mIcon; } const LLCommandId& id() const { return mIdentifier; } const std::string& labelRef() const { return mLabelRef; } - const std::string& param() const { return mParam; } + const LLSD& parameter() const { return mParameter; } const std::string& tooltipRef() const { return mTooltipRef; } private: @@ -116,7 +116,7 @@ private: std::string mFunction; std::string mIcon; std::string mLabelRef; - std::string mParam; + LLSD mParameter; std::string mTooltipRef; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index fe989cee22..caad896a06 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -204,7 +204,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) LLCommand * command = LLCommandManager::instance().getCommand(commandId); if (!command) return false; - mButtonCommands.push_back(commandId); + mButtonCommands.push_back(commandId); LLToolBarButton* button = createButton(commandId); mButtons.push_back(button); mButtonPanel->addChild(button); @@ -505,14 +505,24 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!commandp) return NULL; LLToolBarButton::Params button_p; + button_p.name = id.name(); button_p.label = LLTrans::getString(commandp->labelRef()); button_p.tool_tip = button_p.label(); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); + if (!mReadOnly) + { + LLUICtrl::CommitCallbackParam cbParam; + cbParam.function_name = commandp->functionName(); + cbParam.parameter = commandp->parameter(); + button->setCommitCallback(cbParam); + } + button->setCommandId(id); return button; + } // diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 0c3a6bd0ac..bb4ea815c9 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -55,10 +55,7 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) : LLUICtrl(p), mToolbarLeft(NULL), mToolbarRight(NULL), - mToolbarBottom(NULL), - mDragButton(NULL), - mMouseX(0), - mMouseY(0) + mToolbarBottom(NULL) { } @@ -79,9 +76,6 @@ BOOL LLToolBarView::postBuild() mToolbarRight = getChild<LLToolBar>("toolbar_right"); mToolbarBottom = getChild<LLToolBar>("toolbar_bottom"); - // Load the toolbars from the settings - loadToolbars(); - return TRUE; } @@ -286,40 +280,4 @@ 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; } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index cbe3d6c083..ea3422f04e 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -70,7 +70,10 @@ public: virtual void onMouseCaptureLost(); void startDrag(LLToolBarButton*); // Toolbar view interface with the rest of the world + // Checks if the commandId is being used somewhere in one of the toolbars bool hasCommand(const LLCommandId& commandId) const; + // Loads the toolbars from the existing user or default settings + bool loadToolbars(); // return false if load fails protected: friend class LLUICtrlFactory; @@ -79,10 +82,9 @@ protected: void initFromParams(const Params&); private: - // Loads the toolbars from the existing user or default settings - bool loadToolbars(); // return false if load fails void saveToolbars() const; bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); + void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const; // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..5e8bf498c0 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -992,6 +992,16 @@ void LLUICtrl::setTransparencyType(ETypeTransparency type) mTransparencyType = type; } +boost::signals2::connection LLUICtrl::setCommitCallback(const CommitCallbackParam& cb) +{ + return setCommitCallback(initCommitCallback(cb)); +} + +boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackParam& cb) +{ + return setValidateCallback(initEnableCallback(cb)); +} + boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..fc56e5fc35 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -235,6 +235,9 @@ public: // topic then put in help_topic_out bool findHelpTopic(std::string& help_topic_out); + boost::signals2::connection setCommitCallback(const CommitCallbackParam& cb); + boost::signals2::connection setValidateCallback(const EnableCallbackParam& cb); + boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ); |