From 779e5910d73c0b14454bcbce6206f77e139c8df8 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 15 Jun 2015 12:45:08 +0000 Subject: MirLua: added tray menu support git-svn-id: http://svn.miranda-ng.org/main/trunk@14174 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/docs/examples/menus.lua | 5 +++++ plugins/MirLua/src/m_genmenu.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'plugins/MirLua') diff --git a/plugins/MirLua/docs/examples/menus.lua b/plugins/MirLua/docs/examples/menus.lua index fd20f92fe1..d1adec03d0 100644 --- a/plugins/MirLua/docs/examples/menus.lua +++ b/plugins/MirLua/docs/examples/menus.lua @@ -23,6 +23,11 @@ menuItem.Icon = hIcon menuItem.Service = "Srv/MMI" genmenu.AddMainMenuItem(menuItem) +--- Add menu item to main menu +menuItem.Name = "Tray menu item" +menuItem.Service = "Srv/TMI" +genmenu.AddTrayMenuItem(menuItem) + --- Add menu item to contact menu menuItem.Name = "Contact menu item" menuItem.Service = "Srv/CMI" diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 3ded59d384..cda7655a77 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -70,6 +70,22 @@ static int lua_AddContactMenuItem(lua_State *L) return 1; } +static int lua_AddTrayMenuItem(lua_State *L) +{ + if (lua_type(L, 1) != LUA_TTABLE) + { + lua_pushlightuserdata(L, 0); + return 1; + } + + mir_ptr pmi(MakeMenuItem(L)); + + HGENMENU res = ::Menu_AddTrayMenuItem(pmi); + lua_pushlightuserdata(L, res); + + return 1; +} + static int lua_ModifyMenuItem(lua_State *L) { HGENMENU hMenuItem = (HGENMENU)lua_touserdata(L, 1); @@ -102,6 +118,7 @@ static luaL_Reg genmenuApi[] = { { "AddMainMenuItem", lua_AddMainMenuItem }, { "AddContactMenuItem", lua_AddContactMenuItem }, + { "AddTrayMenuItem", lua_AddTrayMenuItem }, { "ModifyMenuItem", lua_ModifyMenuItem }, { "RemoveMenuItem", lua_RemoveMenuItem }, -- cgit v1.2.3