summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_icons.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-06-10 21:00:17 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-06-10 21:00:17 +0000
commit031b81f8764de5e566490248dbc4bb466c0b03e9 (patch)
treeb68acf9b7ff269aae2f81ad46ed6c6975414d114 /plugins/MirLua/src/mlua_icons.cpp
parent02dc801c6e29d5dad184baff51be70a1c8b2b897 (diff)
MirLua:
- added OnModulesLoaded handler - added OnPreShutdown handler - renamed existing modules - changed modules loading - chaged examples git-svn-id: http://svn.miranda-ng.org/main/trunk@14107 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_icons.cpp')
-rw-r--r--plugins/MirLua/src/mlua_icons.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp
deleted file mode 100644
index 5c53694f15..0000000000
--- a/plugins/MirLua/src/mlua_icons.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "stdafx.h"
-
-static int lua_AddIcon(lua_State *L)
-{
- TCHAR filePath[MAX_PATH];
- GetModuleFileName(g_hInstance, filePath, SIZEOF(filePath));
-
- char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
-
- SKINICONDESC si = { 0 };
- si.flags = SIDF_PATH_TCHAR;
- si.pszName = iconName;
- si.description.a = (char*)lua_tostring(L, 2);
- si.section.a = lua_isnone(L, 3) ? "MirLua" : (char*)lua_tostring(L, 3);
- si.defaultFile.t = filePath;
- si.iDefaultIndex = -IDI_ICON;
-
- HANDLE res = ::Skin_AddIcon(&si);
- lua_pushlightuserdata(L, res);
-
- return 1;
-}
-
-static int lua_GetIcon(lua_State *L)
-{
- char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1));
-
- HANDLE res = ::Skin_GetIconHandle(iconName);
- lua_pushlightuserdata(L, res);
-
- return 1;
-}
-
-static int lua_RemoveIcon(lua_State *L)
-{
- INT_PTR res = 0;
-
- if (lua_isuserdata(L, 1))
- res = ::CallService(MS_SKIN2_REMOVEICON, (WPARAM)lua_touserdata(L, 1), 0);
- else if (lua_isstring(L, 1))
- {
- char iconName[MAX_PATH];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, lua_tostring(L, 1));
- res = ::CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)iconName);
- }
- else
- res = 1;
-
- lua_pushinteger(L, res);
-
- return 1;
-}
-
-static luaL_Reg iconsLib[] =
-{
- { "AddIcon", lua_AddIcon },
- { "GetIcon", lua_GetIcon },
- { "RemoveIcon", lua_RemoveIcon },
-
- { NULL, NULL }
-};
-
-int luaopen_m_icons(lua_State *L)
-{
- lua_getglobal(L, "M");
- luaL_checktype(L, -1, LUA_TTABLE);
-
- lua_newtable(L);
- luaL_setfuncs(L, iconsLib, 0);
- lua_setfield(L, -2, "Icons");
-
- lua_pop(L, 1);
-
- return 1;
-}