From 0e39a7881e29fe58761403424941b78f82042ac1 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 18 Feb 2011 11:31:18 -0800 Subject: Initial stub for getValue() and path walker --- indra/newview/lluilistener.cpp | 31 +++++++++++++++++++++++++++++++ indra/newview/lluilistener.h | 1 + 2 files changed, 32 insertions(+) (limited to 'indra') diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp index 4d6eac4958..dafca0abf2 100644 --- a/indra/newview/lluilistener.cpp +++ b/indra/newview/lluilistener.cpp @@ -47,6 +47,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, + LLSD().with("path", LLSD())); } void LLUIListener::call(const LLSD& event) const @@ -71,3 +77,28 @@ void LLUIListener::call(const LLSD& event) const (*func)(NULL, event["parameter"]); } } + +const LLUICtrl* resolve_path(const LLUICtrl* base, const std::string path) +{ + // *TODO: walk the path + return NULL; +} + +void LLUIListener::getValue(const LLSD&event) const +{ + LLSD reply; + + const LLUICtrl* root = NULL; // *TODO: look this up + const LLUICtrl* ctrl = resolve_path(root, event["path"].asString()); + + if (ctrl) + { + reply["value"] = ctrl->getValue(); + } + else + { + // *TODO: ??? return something indicating failure to resolve + } + + sendReply(reply, event, "reply"); +} diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h index e7847f01e8..08724024dc 100644 --- a/indra/newview/lluilistener.h +++ b/indra/newview/lluilistener.h @@ -41,6 +41,7 @@ public: private: void call(const LLSD& event) const; + void getValue(const LLSD&event) const; }; #endif /* ! defined(LL_LLUILISTENER_H) */ -- cgit v1.2.3