summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaWindow.h
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-08-17 16:27:43 +0200
committerMattes D <github@xoft.cz>2017-08-17 16:27:43 +0200
commit1ec85a2b2cb285bcc019258c8fddcddfcda84fa8 (patch)
treeb6511b8d1ecae466815dc7376322f1bd617dbc6d /src/Bindings/LuaWindow.h
parentAdd support for 1.12.1 (#3908) (diff)
downloadcuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar.gz
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar.bz2
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar.lz
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar.xz
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.tar.zst
cuberite-1ec85a2b2cb285bcc019258c8fddcddfcda84fa8.zip
Diffstat (limited to 'src/Bindings/LuaWindow.h')
-rw-r--r--src/Bindings/LuaWindow.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Bindings/LuaWindow.h b/src/Bindings/LuaWindow.h
index fb21c1c4e..8f3349d00 100644
--- a/src/Bindings/LuaWindow.h
+++ b/src/Bindings/LuaWindow.h
@@ -49,6 +49,10 @@ public:
// tolua_end
+ /** Sets the Lua callback to call when the player clicks on the window.
+ The window can stop the click from propogating. */
+ void SetOnClicked(cLuaState::cCallbackPtr && a_OnClicked);
+
/** Sets the Lua callback function to call when the window is about to close */
void SetOnClosing(cLuaState::cCallbackPtr && a_OnClosing);
@@ -63,6 +67,9 @@ protected:
/** The canon Lua state that has opened the window and owns the m_LuaRef */
cLuaState * m_LuaState;
+ /** The Lua callback to call when the player clicked on a slot */
+ cLuaState::cCallbackPtr m_OnClicked;
+
/** The Lua callback to call when the window is closing for any player */
cLuaState::cCallbackPtr m_OnClosing;
@@ -80,6 +87,11 @@ protected:
// cWindow overrides:
virtual void OpenedByPlayer(cPlayer & a_Player) override;
+ virtual void Clicked(
+ cPlayer & a_Player, int a_WindowID,
+ short a_SlotNum, eClickAction a_ClickAction,
+ const cItem & a_ClickedItem
+ ) override;
virtual bool ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) override;
virtual void Destroy(void) override;
virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override;