summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-10-31 19:54:58 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-10-31 19:54:58 +0000
commit68adcd86746d69d04ef38b59ca5955cee467014b (patch)
treef7fdcbcf0dc6727d2034c73cde797e1cc87da625 /plugins/MirLua/src
parent42fe6e5513e163a90fc5152945e2a502a2ae3017 (diff)
MirLua: added CreateRoot to m_genmenu
git-svn-id: http://svn.miranda-ng.org/main/trunk@15658 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src')
-rw-r--r--plugins/MirLua/src/m_database.cpp2
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp14
2 files changed, 15 insertions, 1 deletions
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp
index a165fed50e..ab9224bb1e 100644
--- a/plugins/MirLua/src/m_database.cpp
+++ b/plugins/MirLua/src/m_database.cpp
@@ -639,7 +639,7 @@ static int dbei__gc(lua_State *L)
mir_free(dbei->pBlob);
- return 1;
+ return 0;
}
static const luaL_Reg dbeiMeta[] =
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index 1c729c43c9..d47bf7c012 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -45,6 +45,19 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi)
lua_pop(L, 1);
}
+static int lua_CreateRoot(lua_State *L)
+{
+ int hMenuObject = lua_tointeger(L, 1);
+ const char *name = luaL_checkstring(L, 2);
+ int position = lua_tointeger(L, 3);
+ HANDLE hIcon = (HANDLE)lua_touserdata(L, -4);
+
+ HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrT(Utf8DecodeT(name)), position, hIcon);
+ lua_pushlightuserdata(L, res);
+
+ return 1;
+}
+
static int lua_AddMenuItem(lua_State *L)
{
int hMenuObject = lua_tointeger(L, 1);
@@ -121,6 +134,7 @@ static int lua_RemoveMenuItem(lua_State *L)
static luaL_Reg genmenuApi[] =
{
+ { "CreateRoot", lua_CreateRoot },
{ "AddMenuItem", lua_AddMenuItem },
{ "ModifyMenuItem", lua_ModifyMenuItem },
{ "ShowMenuItem", lua_ShowMenuItem },