summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJoshua Bell <josh@lindenlab.com>2011-02-18 11:31:18 -0800
committerJoshua Bell <josh@lindenlab.com>2011-02-18 11:31:18 -0800
commit0e39a7881e29fe58761403424941b78f82042ac1 (patch)
tree2b8ebb85ad5116c6df6b40fd6902baa23caf0667 /indra
parent4ef02bc1b6cf5e044d2cf57725eac1a4ccd7580d (diff)
Initial stub for getValue() and path walker
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/lluilistener.cpp31
-rw-r--r--indra/newview/lluilistener.h1
2 files changed, 32 insertions, 0 deletions
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) */