summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lluilistener.cpp23
-rw-r--r--indra/newview/lluilistener.h2
-rw-r--r--indra/newview/scripts/lua/require/UI.lua4
3 files changed, 17 insertions, 12 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 3e67531388..0280836075 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -48,8 +48,7 @@ extern LLMenuBarGL* gMenuBarView;
LLUIListener::LLUIListener():
LLEventAPI("UI",
- "LLUICtrl::CommitCallbackRegistry listener.\n"
- "Capable of invoking any function (with parameter) you can specify in XUI.")
+ "Operations to manipulate the viewer's user interface.")
{
add("call",
"Invoke the operation named by [\"function\"], passing [\"parameter\"],\n"
@@ -70,9 +69,9 @@ LLUIListener::LLUIListener():
&LLUIListener::getValue,
llsd::map("path", LLSD(), "reply", LLSD()));
- add("getParents",
+ add("getTopMenus",
"List names of Top menus suitable for passing as \"parent_menu\"",
- &LLUIListener::getParents,
+ &LLUIListener::getTopMenus,
llsd::map("reply", LLSD::String()));
LLSD required_args = llsd::map("name", LLSD(), "label", LLSD(), "reply", LLSD());
@@ -116,13 +115,15 @@ LLUIListener::LLUIListener():
add("addToolbarBtn",
"Add [\"btn_name\"] toolbar button to the [\"toolbar\"]:\n"
"\"left\", \"right\", \"bottom\" (default is \"bottom\")\n"
- "Position of the command in the original list can be specified as [\"rank\"]",
+ "Position of the command in the original list can be specified as [\"rank\"],\n"
+ "where 0 means the first item",
&LLUIListener::addToolbarBtn,
llsd::map("btn_name", LLSD(), "reply", LLSD()));
add("removeToolbarBtn",
"Remove [\"btn_name\"] toolbar button off the toolbar,\n"
"return [\"rank\"] (old position) of the command in the original list,\n"
+ "rank 0 is the first position,\n"
"rank -1 means that [\"btn_name\"] was not found",
&LLUIListener::removeToolbarBtn,
llsd::map("btn_name", LLSD(), "reply", LLSD()));
@@ -141,7 +142,7 @@ typedef LLUICtrl::CommitCallbackInfo cb_info;
void LLUIListener::call(const LLSD& event)
{
Response response(LLSD(), event);
- LLUICtrl::CommitCallbackInfo *info = LLUICtrl::CommitCallbackRegistry::getValue(event["function"]);
+ cb_info *info = LLUICtrl::CommitCallbackRegistry::getValue(event["function"]);
if (!info || !info->callback_func)
{
return response.error(stringize("Function ", std::quoted(event["function"].asString()), " was not found"));
@@ -201,13 +202,13 @@ void LLUIListener::callables(const LLSD& event) const
LLSD entry{ llsd::map("name", it->first) };
switch (it->second.handle_untrusted)
{
- case LLUICtrl::CommitCallbackInfo::UNTRUSTED_ALLOW:
+ case cb_info::UNTRUSTED_ALLOW:
entry["access"] = "allow";
break;
- case LLUICtrl::CommitCallbackInfo::UNTRUSTED_BLOCK:
+ case cb_info::UNTRUSTED_BLOCK:
entry["access"] = "block";
break;
- case LLUICtrl::CommitCallbackInfo::UNTRUSTED_THROTTLE:
+ case cb_info::UNTRUSTED_THROTTLE:
entry["access"] = "throttle";
break;
}
@@ -235,10 +236,10 @@ void LLUIListener::getValue(const LLSD& event) const
}
}
-void LLUIListener::getParents(const LLSD& event) const
+void LLUIListener::getTopMenus(const LLSD& event) const
{
Response response(LLSD(), event);
- response["parents"] = llsd::toArray(
+ response["menus"] = llsd::toArray(
*gMenuBarView->getChildList(),
[](auto childp) {return childp->getName(); });
}
diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h
index 98e4754306..c839c03a57 100644
--- a/indra/newview/lluilistener.h
+++ b/indra/newview/lluilistener.h
@@ -43,7 +43,7 @@ private:
void call(const LLSD& event);
void callables(const LLSD& event) const;
void getValue(const LLSD& event) const;
- void getParents(const LLSD& event) const;
+ void getTopMenus(const LLSD& event) const;
void addMenu(const LLSD&event) const;
void addMenuBranch(const LLSD&event) const;
diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua
index 9bc9a3685d..464e6547ea 100644
--- a/indra/newview/scripts/lua/require/UI.lua
+++ b/indra/newview/scripts/lua/require/UI.lua
@@ -144,6 +144,10 @@ end
-- Top menu
-- ***************************************************************************
+function UI.getTopMenus()
+ return leap.request('UI', {op='getTopMenus'}).menus
+end
+
function UI.addMenu(...)
local args = mapargs('name,label', ...)
args.op = 'addMenu'