diff options
-rw-r--r-- | plugins/MirLua/docs/examples/menus.lua | 5 | ||||
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 17 |
2 files changed, 22 insertions, 0 deletions
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<CLISTMENUITEM> 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 },
|