summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules/m_toptoolbar
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-09-12 22:02:30 +0300
committeraunsane <aunsane@gmail.com>2017-09-12 22:03:37 +0300
commit6f99f13cf590c323fd5bd5b4d6855e59f582fb0e (patch)
tree4b9a66758433be8273c7c20e06ab305901b4fdfb /plugins/MirLua/Modules/m_toptoolbar
parent6611ef6791a897d23cb79ab7b56eb48d49452b80 (diff)
MirLua: massive refactoring
- m_msg_buttonbar moved to m_srrm - version bump
Diffstat (limited to 'plugins/MirLua/Modules/m_toptoolbar')
-rw-r--r--plugins/MirLua/Modules/m_toptoolbar/src/main.cpp20
-rw-r--r--plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h2
2 files changed, 14 insertions, 8 deletions
diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp
index af73c963ce..17a8d95b00 100644
--- a/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp
+++ b/plugins/MirLua/Modules/m_toptoolbar/src/main.cpp
@@ -29,11 +29,11 @@ static TTBButton* MakeTBButton(lua_State *L)
lua_pop(L, 1);
lua_getfield(L, -1, "wParamUp");
- tbb->wParamUp = (WPARAM)lua_touserdata(L, -1);
+ tbb->wParamUp = (WPARAM)luaM_tomparam(L, -1);
lua_pop(L, 1);
lua_getfield(L, -1, "lParamUp");
- tbb->lParamUp = (LPARAM)lua_touserdata(L, -1);
+ tbb->lParamUp = (LPARAM)luaM_tomparam(L, -1);
lua_pop(L, 1);
// dn state
@@ -46,11 +46,11 @@ static TTBButton* MakeTBButton(lua_State *L)
lua_pop(L, 1);
lua_getfield(L, -1, "wParamDown");
- tbb->wParamDown = (WPARAM)lua_touserdata(L, -1);
+ tbb->wParamDown = (WPARAM)luaM_tomparam(L, -1);
lua_pop(L, 1);
lua_getfield(L, -1, "lParamDown");
- tbb->lParamDown = (LPARAM)lua_touserdata(L, -1);
+ tbb->lParamDown = (LPARAM)luaM_tomparam(L, -1);
lua_pop(L, 1);
return tbb;
@@ -64,9 +64,15 @@ static int lua_AddButton(lua_State *L)
return 1;
}
- TTBButton* tbb = MakeTBButton(L);
+ TTBButton *tbb = MakeTBButton(L);
+
+ HANDLE res = TopToolbar_AddButton(tbb);
+ if (res == (HANDLE)-1)
+ {
+ lua_pushnil(L);
+ return 1;
+ }
- HANDLE res = ::TopToolbar_AddButton(tbb);
lua_pushlightuserdata(L, res);
mir_free(tbb->name);
@@ -81,7 +87,7 @@ static int lua_RemoveButton(lua_State *L)
{
HANDLE hTTButton = (HANDLE)lua_touserdata(L, 1);
- INT_PTR res = ::CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
+ INT_PTR res = CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
lua_pushinteger(L, res);
return 1;
diff --git a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h
index d69907bf2c..45e1eea058 100644
--- a/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h
+++ b/plugins/MirLua/Modules/m_toptoolbar/src/stdafx.h
@@ -3,7 +3,7 @@
#include <windows.h>
-#include <lua.hpp>
+#include <mirlua.h>
#include <m_core.h>
#include <m_utils.h>