summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lluilistener.cpp24
-rw-r--r--indra/newview/lluilistener.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index beae71e7bf..d95560b306 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -37,6 +37,7 @@
#include "llui.h" // getRootView(), resolvePath()
#include "lluictrl.h"
#include "llerror.h"
+#include "llcombobox.h"
LLUIListener::LLUIListener():
@@ -55,6 +56,12 @@ LLUIListener::LLUIListener():
"current value as [\"value\"] reply.",
&LLUIListener::getValue,
LLSDMap("path", LLSD())("reply", LLSD()));
+
+ add("setSelectedByValue",
+ "For the combobox identified by the path in [\"path\"] set selection by [\"value\"],\n"
+ "and return result as [\"reply\"]",
+ &LLUIListener::setSelectedByValue,
+ llsd::map("path", LLSD(), "value", LLSD(), "reply", LLSD()));
}
void LLUIListener::call(const LLSD& event) const
@@ -99,3 +106,20 @@ void LLUIListener::getValue(const LLSD&event) const
sendReply(reply, event);
}
+
+void LLUIListener::setSelectedByValue(const LLSD& event) const
+{
+ Response response(LLSD(), event);
+ std::string path(event["path"]);
+ LLComboBox* combo_ctrl = dynamic_cast<LLComboBox*>(LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path));
+ if (combo_ctrl)
+ {
+ response.setResponse(combo_ctrl->setSelectedByValue(event["value"], true));
+ return;
+ }
+ else
+ {
+ LL_WARNS() << "Specified combobox doesn't exist: " << path << LL_ENDL;
+ }
+ response.setResponse(false);
+}
diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h
index 70455c2c68..228e67ae26 100644
--- a/indra/newview/lluilistener.h
+++ b/indra/newview/lluilistener.h
@@ -42,6 +42,7 @@ public:
private:
void call(const LLSD& event) const;
void getValue(const LLSD&event) const;
+ void setSelectedByValue(const LLSD& event) const;
};
#endif /* ! defined(LL_LLUILISTENER_H) */