summaryrefslogtreecommitdiff
path: root/indra/newview/lluilistener.cpp
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-08-07 11:40:21 -0400
committerGitHub <noreply@github.com>2024-08-07 11:40:21 -0400
commit10799e968aa562078519346594732fc62714c1db (patch)
tree9f0c16833ab6a72e0232a116e6f073e3a40e9b3b /indra/newview/lluilistener.cpp
parentf8c70f4855b4163c82aa7c2e0cc07a5cd81a206f (diff)
parentba57f099642ff2e8e74150bc1d92e40a72b9b243 (diff)
Merge pull request #2218 from secondlife/lua-ui-tweak
Rename 'UI' 'getParents' op to 'getTopMenus', add UI.lua function.
Diffstat (limited to 'indra/newview/lluilistener.cpp')
-rw-r--r--indra/newview/lluilistener.cpp23
1 files changed, 12 insertions, 11 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(); });
}