diff options
author | Leslie Linden <leslie@lindenlab.com> | 2011-10-11 10:07:19 -0700 |
---|---|---|
committer | Leslie Linden <leslie@lindenlab.com> | 2011-10-11 10:07:19 -0700 |
commit | aec61c579a40687e2696d38a535143d59f771416 (patch) | |
tree | 149049d34f2668c187578275b437c435289a6756 /indra/llui/lltoolbar.cpp | |
parent | 05b31ff3b235bdcf7e9bb0fe1ff701c006e8ec66 (diff) |
Added 'execute_stop_function' command parameter to handle mouse down/up actions on toolbar buttons
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 89184f781f..e74aab6e21 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -659,11 +659,25 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!mReadOnly) { - LLUICtrl::CommitCallbackParam cbParam; - cbParam.function_name = commandp->executeFunctionName(); - cbParam.parameter = commandp->executeParameters(); + LLUICtrl::CommitCallbackParam executeParam; + executeParam.function_name = commandp->executeFunctionName(); + executeParam.parameter = commandp->executeParameters(); - button->setCommitCallback(cbParam); + // If we have a "stop" function then we map the command to mouse down / mouse up otherwise commit + const std::string& executeStopFunction = commandp->executeStopFunctionName(); + if (executeStopFunction.length() > 0) + { + LLUICtrl::CommitCallbackParam executeStopParam; + executeStopParam.function_name = executeStopFunction; + executeStopParam.parameter = commandp->executeStopParameters(); + + button->setMouseDownCallback(executeParam); + button->setMouseUpCallback(executeStopParam); + } + else + { + button->setCommitCallback(executeParam); + } const std::string& isEnabledFunction = commandp->isEnabledFunctionName(); if (isEnabledFunction.length() > 0) |