diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 18 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 5 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llcommandmanager.h | 9 | ||||
-rw-r--r-- | indra/llui/llfloaterreg.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llhelp.h | 1 | ||||
-rw-r--r-- | indra/llui/llsdparam.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llsdparam.h | 3 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 22 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 6 |
10 files changed, 72 insertions, 8 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index ba3748a573..2e9c7a5d3d 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -296,6 +296,24 @@ void LLButton::onCommit() LLUICtrl::onCommit(); } +boost::signals2::connection LLButton::setClickedCallback(const CommitCallbackParam& cb) +{ + return setClickedCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setMouseDownCallback(const CommitCallbackParam& cb) +{ + return setMouseDownCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setMouseUpCallback(const CommitCallbackParam& cb) +{ + return setMouseUpCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setHeldDownCallback(const CommitCallbackParam& cb) +{ + return setHeldDownCallback(initCommitCallback(cb)); +} + + boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index a0a7b4e372..ba0345f610 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -170,6 +170,11 @@ public: void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } + boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); + boost::signals2::connection setMouseDownCallback(const CommitCallbackParam& cb); + boost::signals2::connection setMouseUpCallback(const CommitCallbackParam& cb); + boost::signals2::connection setHeldDownCallback(const CommitCallbackParam& cb); + boost::signals2::connection setClickedCallback( const commit_signal_t::slot_type& cb ); // mouse down and up within button boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); // mouse up, EVEN IF NOT IN BUTTON diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index d8e035a320..128ba609cb 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -55,6 +55,8 @@ LLCommand::Params::Params() , tooltip_ref("tooltip_ref") , execute_function("execute_function") , execute_parameters("execute_parameters") + , execute_stop_function("execute_stop_function") + , execute_stop_parameters("execute_stop_parameters") , is_enabled_function("is_enabled_function") , is_enabled_parameters("is_enabled_parameters") , is_running_function("is_running_function") @@ -72,6 +74,8 @@ LLCommand::LLCommand(const LLCommand::Params& p) , mTooltipRef(p.tooltip_ref) , mExecuteFunction(p.execute_function) , mExecuteParameters(p.execute_parameters) + , mExecuteStopFunction(p.execute_stop_function) + , mExecuteStopParameters(p.execute_stop_parameters) , mIsEnabledFunction(p.is_enabled_function) , mIsEnabledParameters(p.is_enabled_parameters) , mIsRunningFunction(p.is_running_function) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 46e0fe6e69..9b93ab735a 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -116,6 +116,9 @@ public: Mandatory<std::string> execute_function; Optional<LLSD> execute_parameters; + Optional<std::string> execute_stop_function; + Optional<LLSD> execute_stop_parameters; + Optional<std::string> is_enabled_function; Optional<LLSD> is_enabled_parameters; @@ -139,6 +142,9 @@ public: const std::string& executeFunctionName() const { return mExecuteFunction; } const LLSD& executeParameters() const { return mExecuteParameters; } + const std::string& executeStopFunctionName() const { return mExecuteStopFunction; } + const LLSD& executeStopParameters() const { return mExecuteStopParameters; } + const std::string& isEnabledFunctionName() const { return mIsEnabledFunction; } const LLSD& isEnabledParameters() const { return mIsEnabledParameters; } @@ -159,6 +165,9 @@ private: std::string mExecuteFunction; LLSD mExecuteParameters; + std::string mExecuteStopFunction; + LLSD mExecuteStopParameters; + std::string mIsEnabledFunction; LLSD mIsEnabledParameters; diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d0ae9413a3..ae06eb74ac 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -110,7 +110,11 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) int index = list.size(); res = build_func(key); - + if (!res) + { + llwarns << "Failed to build floater type: '" << name << "'." << llendl; + return NULL; + } bool success = res->buildFromFile(xui_file, NULL); if (!success) { diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h index 83317bd03c..1726347a78 100644 --- a/indra/llui/llhelp.h +++ b/indra/llui/llhelp.h @@ -32,6 +32,7 @@ class LLHelp { public: virtual void showTopic(const std::string &topic) = 0; + virtual std::string getURL(const std::string &topic) = 0; // return default (fallback) topic name suitable for showTopic() virtual std::string defaultTopic() = 0; // return topic to use before the user logs in diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index da50c0ff39..242b1fca7f 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -299,6 +299,12 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI } } +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd) +{ + LLInitParam::Parser::name_stack_t stack = LLInitParam::Parser::name_stack_t(); + readSDValues(cb, sd, stack); +} namespace LLInitParam { // LLSD specialization diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index 784358d038..c1cfa98399 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -36,7 +36,8 @@ struct LLParamSDParserUtilities static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); typedef boost::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t; - static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack = LLInitParam::Parser::name_stack_t()); + static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); + static void readSDValues(read_sd_cb_t cb, const LLSD& sd); }; class LLParamSDParser diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 7c1e2017c0..d4633d7c3b 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -700,11 +700,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) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index f3457028e7..709399c59f 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,7 +47,7 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block<Params, LLButton::Params> { - Optional<LLUI::RangeS32> button_width; + Optional<LLUI::RangeS32::Params> button_width; Optional<S32> desired_height; Params() @@ -163,7 +163,7 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - + static const int RANK_NONE = -1; bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE); @@ -178,6 +178,8 @@ public: LLToolBarButton* createButton(const LLCommandId& id); + bool hasButtons() { return !mButtons.empty(); } + protected: friend class LLUICtrlFactory; LLToolBar(const Params&); |