diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2024-08-02 18:47:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-02 18:47:44 +0300 |
commit | d6abce3968925c5cb58c11f1c6fc936605f55c57 (patch) | |
tree | 16142170d61f2ecf0ad8a4d6194a152658527589 /indra/newview/scripts/lua/require | |
parent | 2390b0d623a09c0ec4f46fa10567bb02b7d49cfe (diff) | |
parent | 365030aa33d991006e093557cb7ce93d18ea2e4e (diff) |
Merge pull request #2047 from secondlife/lua-top-menu
Lua api for adding new menu items to the Top menu
Diffstat (limited to 'indra/newview/scripts/lua/require')
-rw-r--r-- | indra/newview/scripts/lua/require/UI.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 1eee4657f4..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 @@ -135,4 +139,34 @@ 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 + +-- see UI.callables() for valid values of 'func' +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 |