diff options
author | Oz Linden <oz@lindenlab.com> | 2011-04-08 09:24:07 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-04-08 09:24:07 -0400 |
commit | 444311d58082ae1277a3628fbe380f7407910f50 (patch) | |
tree | 9349d5caf656ac427da037fe6fc4b1f4f387ded1 /indra/newview/lluilistener.cpp | |
parent | a22e3df7e5570e52abcba4a28103c3d76960a010 (diff) | |
parent | c492bffaa6cd0d9bb05bbc3671c7658b7ba52862 (diff) |
pull tags and late fixes back from viewer-pre-release
Diffstat (limited to 'indra/newview/lluilistener.cpp')
-rw-r--r-- | indra/newview/lluilistener.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp index 4d6eac4958..6b2cd71d40 100644 --- a/indra/newview/lluilistener.cpp +++ b/indra/newview/lluilistener.cpp @@ -34,9 +34,11 @@ // std headers // external library headers // other Linden headers +#include "llui.h" // getRootView(), resolvePath() #include "lluictrl.h" #include "llerror.h" + LLUIListener::LLUIListener(): LLEventAPI("UI", "LLUICtrl::CommitCallbackRegistry listener.\n" @@ -47,6 +49,12 @@ LLUIListener::LLUIListener(): "as if from a user gesture on a menu -- or a button click.", &LLUIListener::call, LLSD().with("function", LLSD())); + + add("getValue", + "For the UI control identified by the path in [\"path\"], return the control's\n" + "current value as [\"value\"] reply.", + &LLUIListener::getValue, + LLSDMap("path", LLSD())("reply", LLSD())); } void LLUIListener::call(const LLSD& event) const @@ -71,3 +79,23 @@ void LLUIListener::call(const LLSD& event) const (*func)(NULL, event["parameter"]); } } + +void LLUIListener::getValue(const LLSD&event) const +{ + LLSD reply = LLSD::emptyMap(); + + const LLView* root = LLUI::getRootView(); + const LLView* view = LLUI::resolvePath(root, event["path"].asString()); + const LLUICtrl* ctrl(dynamic_cast<const LLUICtrl*>(view)); + + if (ctrl) + { + reply["value"] = ctrl->getValue(); + } + else + { + // *TODO: ??? return something indicating failure to resolve + } + + sendReply(reply, event); +} |