diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-06-15 12:45:08 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-06-15 12:45:08 +0000 |
commit | 779e5910d73c0b14454bcbce6206f77e139c8df8 (patch) | |
tree | d70718a31bbb18e394539dd27977de7f05508f0c /plugins/MirLua | |
parent | 69941e28fe11ce3b7958f48e22ea1ecbb8fe64b0 (diff) |
MirLua: added tray menu support
git-svn-id: http://svn.miranda-ng.org/main/trunk@14174 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-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 },
|