summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-11 08:03:36 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-11 08:03:36 +0000
commit8f5721964ac7ee042e04776c722e459490061204 (patch)
tree0c936caa3cb1c851d512c7daa451e4b876420add
parenta15cfbf2d3abc5a66b394e2da551828d39994d51 (diff)
MirLua:
- added ability to create submenu - fixed event hook for parameterless function git-svn-id: http://svn.miranda-ng.org/main/trunk@14112 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/MirLua/docs/examples/menus.lua8
-rw-r--r--plugins/MirLua/src/m_core.cpp4
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp2
3 files changed, 12 insertions, 2 deletions
diff --git a/plugins/MirLua/docs/examples/menus.lua b/plugins/MirLua/docs/examples/menus.lua
index aee6ab8559..50e7e75cde 100644
--- a/plugins/MirLua/docs/examples/menus.lua
+++ b/plugins/MirLua/docs/examples/menus.lua
@@ -12,6 +12,7 @@ local hIcon = icolib.AddIcon('testMenuIcon', 'Lua icon for menus')
-- @param position The position of menu item in main menu (default 0)
-- @param icon The handle of icon of menu item (default NULL)
-- @param service The name of service which will be called (default '')
+-- @param hParentMenu The handle of parent menu (default 0)
-- @return handle of menu item
genmenu.AddMainMenuItem('Main menu item', 0, 0, hIcon, 'Srv/MMI')
@@ -21,6 +22,7 @@ genmenu.AddMainMenuItem('Main menu item', 0, 0, hIcon, 'Srv/MMI')
-- @param position The position of menu item in main menu (default 0)
-- @param icon The handle of icon of menu item (default NULL)
-- @param service The name of service which will be called (default '')
+-- @param hParentMenu The handle of parent menu (default 0)
-- @return handle of menu item
genmenu.AddContactMenuItem('Contact menu item', 0, 0, hIcon, 'Srv/CMI')
@@ -31,3 +33,9 @@ local hMenuItem = genmenu.AddContactMenuItem('testRemove', 0, 0, 0, 'Srv/TestRem
-- @param handle The handle of menu item
-- @return 0 on success
genmenu.RemoveMenuItem(hMenuItem)
+
+--- Add root menu item
+local CMIF_ROOTHANDLE = 384
+local hRoot = genmenu.AddMainMenuItem('Main menu root', CMIF_ROOTHANDLE)
+--- Add child menu item
+genmenu.AddMainMenuItem('Main menu child', CMIF_ROOTHANDLE, 0, nil, 'Srv/CMI', hRoot)
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp
index 21cd25ce80..99166d3236 100644
--- a/plugins/MirLua/src/m_core.cpp
+++ b/plugins/MirLua/src/m_core.cpp
@@ -23,8 +23,8 @@ static int lua_DestroyHookableEvent(lua_State *L)
static int lua_NotifyEventHooks(lua_State *L)
{
HANDLE hEvent = (HANDLE)lua_touserdata(L, 1);
- WPARAM wParam = (WPARAM)luaL_checkinteger(L, 2);
- LPARAM lParam = (LPARAM)luaL_checkinteger(L, 3);
+ WPARAM wParam = (WPARAM)lua_tointeger(L, 2);
+ LPARAM lParam = (LPARAM)lua_tointeger(L, 3);
int res = ::NotifyEventHooks(hEvent, wParam, lParam);
lua_pushinteger(L, res);
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index 5a185f64bd..064758da2e 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -8,6 +8,7 @@ static int lua_AddMainMenuItem(lua_State *L)
mi.position = lua_tointeger(L, 3);
mi.icolibItem = (HANDLE)lua_touserdata(L, 4);
mi.pszService = (char*)lua_tostring(L, 5);
+ mi.hParentMenu = (HGENMENU)lua_touserdata(L, 6);
HGENMENU res = ::Menu_AddMainMenuItem(&mi);
lua_pushlightuserdata(L, res);
@@ -23,6 +24,7 @@ static int lua_AddContactMenuItem(lua_State *L)
mi.position = lua_tointeger(L, 3);
mi.icolibItem = (HANDLE)lua_touserdata(L, 4);
mi.pszService = (char*)lua_tostring(L, 5);
+ mi.hParentMenu = (HGENMENU)lua_touserdata(L, 6);
HGENMENU res = ::Menu_AddContactMenuItem(&mi);
lua_pushlightuserdata(L, res);