diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-08-02 10:49:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 10:49:40 -0400 |
commit | 365030aa33d991006e093557cb7ce93d18ea2e4e (patch) | |
tree | 16142170d61f2ecf0ad8a4d6194a152658527589 /indra | |
parent | 3591afb2a8eba2599d76f3f41d413c882634f017 (diff) | |
parent | c8ba633a4564da29d9b58b0e08ffb590bb3bce5f (diff) |
Merge pull request #2180 from secondlife/lua-top-parents
Add 'UI' 'getParents' op to list top-menu 'parent_menu' names.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lluilistener.cpp | 15 | ||||
-rw-r--r-- | indra/newview/lluilistener.h | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp index 2b2187a73b..b81859a764 100644 --- a/indra/newview/lluilistener.cpp +++ b/indra/newview/lluilistener.cpp @@ -68,6 +68,11 @@ LLUIListener::LLUIListener(): &LLUIListener::getValue, llsd::map("path", LLSD(), "reply", LLSD())); + add("getParents", + "List names of Top menus suitable for passing as \"parent_menu\"", + &LLUIListener::getParents, + llsd::map("reply", LLSD::String())); + LLSD required_args = llsd::map("name", LLSD(), "label", LLSD(), "reply", LLSD()); add("addMenu", "Add new drop-down menu [\"name\"] with displayed [\"label\"] to the Top menu.", @@ -174,7 +179,7 @@ void LLUIListener::callables(const LLSD& event) const response["callables"] = list; } -void LLUIListener::getValue(const LLSD&event) const +void LLUIListener::getValue(const LLSD& event) const { Response response(LLSD(), event); @@ -192,6 +197,14 @@ void LLUIListener::getValue(const LLSD&event) const } } +void LLUIListener::getParents(const LLSD& event) const +{ + Response response(LLSD(), event); + response["parents"] = llsd::toArray( + *gMenuBarView->getChildList(), + [](auto childp) {return childp->getName(); }); +} + LLMenuGL::Params get_params(const LLSD&event) { LLMenuGL::Params item_params; diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h index c90253ab59..671eb5f29b 100644 --- a/indra/newview/lluilistener.h +++ b/indra/newview/lluilistener.h @@ -42,7 +42,8 @@ public: private: void call(const LLSD& event); void callables(const LLSD& event) const; - void getValue(const LLSD&event) const; + void getValue(const LLSD& event) const; + void getParents(const LLSD& event) const; void addMenu(const LLSD&event) const; void addMenuBranch(const LLSD&event) const; |