From 50d60c2518710e92cff05b806624b11ac714369f Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 17 Jul 2024 16:46:00 +0300 Subject: Lua api for adding new menu items to the Top menu --- indra/newview/scripts/lua/require/UI.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 1eee4657f4..28488ff3e1 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -135,4 +135,32 @@ function UI.snapshot(...) args.op = 'saveSnapshot' return leap.request('LLViewerWindow', args).result end + +-- *************************************************************************** +-- Top menu +-- *************************************************************************** + +function UI.addMenu(...) + local args = mapargs('name,label', ...) + args.op = 'addMenu' + return leap.request('UI', args) +end + +function UI.addMenuBranch(...) + local args = mapargs('name,label,parent_menu', ...) + args.op = 'addMenuBranch' + return leap.request('UI', args) +end + +function UI.addMenuItem(...) + local args = mapargs('name,label,parent_menu,func,param', ...) + args.op = 'addMenuItem' + return leap.request('UI', args) +end + +function UI.addMenuSeparator(...) + local args = mapargs('parent_menu', ...) + args.op = 'addMenuSeparator' + return leap.request('UI', args) +end return UI -- cgit v1.2.3 From fdb7207aa0d1f25ed3e14fbc4e8615e8383e508c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 1 Aug 2024 16:52:44 -0400 Subject: Add UI.callables() and corresponding entry point. --- indra/newview/scripts/lua/require/UI.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/scripts/lua/require') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 28488ff3e1..06b49c6269 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -14,6 +14,10 @@ function UI.call(func, parameter) leap.request('UI', {op='call', ['function']=func, parameter=parameter}) end +function UI.callables() + return leap.request('UI', {op='callables'}).callables +end + function UI.getValue(path) return leap.request('UI', {op='getValue', path=path})['value'] end @@ -152,6 +156,7 @@ function UI.addMenuBranch(...) return leap.request('UI', args) end +-- see UI.callables() for valid values of 'func' function UI.addMenuItem(...) local args = mapargs('name,label,parent_menu,func,param', ...) args.op = 'addMenuItem' @@ -163,4 +168,5 @@ function UI.addMenuSeparator(...) args.op = 'addMenuSeparator' return leap.request('UI', args) end + return UI -- cgit v1.2.3