diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-04-04 08:39:22 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-04-04 08:39:22 +0000 |
commit | e1110157f8c2989a58aa12ddeef91669525d188f (patch) | |
tree | 23cd9c6c845c5e38659a072457566d7a5fe7e79d /plugins/MirLua/src/m_toptoolbar.cpp | |
parent | e6dce54eeeedb43855b694c921b97c5119deef32 (diff) |
MirLua: m_toptoolbar moved to separate project
git-svn-id: http://svn.miranda-ng.org/main/trunk@16583 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_toptoolbar.cpp')
-rw-r--r-- | plugins/MirLua/src/m_toptoolbar.cpp | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/plugins/MirLua/src/m_toptoolbar.cpp b/plugins/MirLua/src/m_toptoolbar.cpp deleted file mode 100644 index 310243e734..0000000000 --- a/plugins/MirLua/src/m_toptoolbar.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "stdafx.h"
-
-static LIST<void> TBButtons(1, PtrKeySortT);
-
-void KillModuleTTBButton()
-{
- while (TBButtons.getCount())
- {
- HANDLE hTTButton = TBButtons[0];
- ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- TBButtons.remove(0);
- }
-}
-
-static TTBButton* MakeTBButton(lua_State *L)
-{
- TTBButton *tbb = (TTBButton*)mir_calloc(sizeof(TTBButton));
- tbb->dwFlags = TTBBF_ISLBUTTON;
-
- lua_getfield(L, -1, "Name");
- tbb->name = mir_utf8decodeA(luaL_checkstring(L, -1));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Service");
- tbb->pszService = (char*)lua_tostring(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "Flags");
- tbb->dwFlags = lua_tointeger(L, -1);
- lua_pop(L, 1);
-
- // up state
- lua_getfield(L, -1, "IconUp");
- tbb->hIconHandleUp = (HANDLE)lua_touserdata(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "TooltipUp");
- tbb->pszTooltipUp = mir_utf8decodeA(lua_tostring(L, -1));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "wParamUp");
- tbb->wParamUp = luaM_towparam(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "lParamUp");
- tbb->lParamUp = luaM_tolparam(L, -1);
- lua_pop(L, 1);
-
- // dn state
- lua_getfield(L, -1, "IconDown");
- tbb->hIconHandleDn = (HANDLE)lua_touserdata(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "TooltipDown");
- tbb->pszTooltipDn = mir_utf8decodeA(lua_tostring(L, -1));
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "wParamDown");
- tbb->wParamDown = luaM_towparam(L, -1);
- lua_pop(L, 1);
-
- lua_getfield(L, -1, "lParamDown");
- tbb->lParamDown = luaM_tolparam(L, -1);
- lua_pop(L, 1);
-
- return tbb;
-}
-
-static int lua_AddButton(lua_State *L)
-{
- if (lua_type(L, 1) != LUA_TTABLE)
- {
- lua_pushlightuserdata(L, 0);
- return 1;
- }
-
- TTBButton* tbb = MakeTBButton(L);
-
- HANDLE res = ::TopToolbar_AddButton(tbb);
- lua_pushlightuserdata(L, res);
-
- if (res != INVALID_HANDLE_VALUE)
- TBButtons.insert(res);
-
- mir_free(tbb->name);
- mir_free(tbb->pszTooltipUp);
- mir_free(tbb->pszTooltipDn);
- mir_free(tbb);
-
- return 1;
-}
-
-static int lua_RemoveButton(lua_State *L)
-{
- HANDLE hTTButton = (HANDLE)lua_touserdata(L, 1);
-
- INT_PTR res = ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- lua_pushinteger(L, res);
-
- if (!res)
- TBButtons.remove(hTTButton);
-
- return 1;
-}
-
-static luaL_Reg toptoolbarApi[] =
-{
- { "AddButton", lua_AddButton },
- { "RemoveButton", lua_RemoveButton },
-
- { NULL, NULL }
-};
-
-LUAMOD_API int luaopen_m_toptoolbar(lua_State *L)
-{
- luaL_newlib(L, toptoolbarApi);
-
- return 1;
-}
|