summaryrefslogtreecommitdiffstats
path: root/source/cWindow.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
commit386d58b5862d8b76925c6523721594887606e82a (patch)
treeef073e7a843f4b75a4008d4b7383f7cdf08ceee5 /source/cWindow.h
parentVisual Studio 2010 solution and project files (diff)
downloadcuberite-386d58b5862d8b76925c6523721594887606e82a.tar
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.gz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.bz2
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.lz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.xz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.zst
cuberite-386d58b5862d8b76925c6523721594887606e82a.zip
Diffstat (limited to 'source/cWindow.h')
-rw-r--r--source/cWindow.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/source/cWindow.h b/source/cWindow.h
new file mode 100644
index 000000000..888a11b98
--- /dev/null
+++ b/source/cWindow.h
@@ -0,0 +1,67 @@
+#pragma once
+
+#include "MemoryLeak.h"
+#include <list>
+#include <string>
+
+class cPacket_WindowClick;
+class cPlayer;
+class cItem;
+class cWindowOwner;
+class cClientHandle;
+class cWindow
+{
+public:
+ cWindow( cWindowOwner* a_Owner, bool a_bInventoryVisible );
+ ~cWindow();
+
+ int GetWindowID() { return m_WindowID; }
+ void SetWindowID( int a_WindowID ) { m_WindowID = a_WindowID; }
+
+ int GetWindowType() { return m_WindowType; }
+ void SetWindowType( int a_WindowType ) { m_WindowType = a_WindowType; }
+
+ cItem* GetSlots() { return m_Slots; }
+ int GetNumSlots() { return m_NumSlots; }
+
+ cItem* GetSlot( int a_Slot );
+
+ cItem* GetDraggingItem( cPlayer * a_Player = 0 );
+
+ // a_Slots is an array of slots of size a_NumSlots
+ void SetSlots(cItem* a_Slots, int a_NumSlots) { m_Slots = a_Slots; m_NumSlots = a_NumSlots; }
+
+ bool IsInventoryVisible() { return m_bInventoryVisible; }
+ void SetInventoryVisible( bool a_bVisible ) { m_bInventoryVisible = a_bVisible; }
+
+ virtual void Clicked( cPacket_WindowClick* a_ClickPacket, cPlayer & a_Player );
+
+ virtual void Open( cPlayer & a_Player );
+ virtual void Close( cPlayer & a_Player );
+
+ cWindowOwner* GetOwner() { return m_Owner; }
+ void SetOwner( cWindowOwner* a_Owner ) { m_Owner = a_Owner; }
+
+ void SendWholeWindow( cClientHandle* a_Client );
+
+ const std::string & GetWindowTitle() const { return m_WindowTitle; }
+ void SetWindowTitle( const std::string & a_WindowTitle ) { m_WindowTitle = a_WindowTitle; }
+
+ const std::list<cPlayer*> & GetOpenedBy() const { return m_OpenedBy; }
+
+ void OwnerDestroyed();
+private:
+ void Destroy();
+
+ int m_WindowID;
+ int m_WindowType;
+ std::string m_WindowTitle;
+
+ cWindowOwner* m_Owner;
+
+ std::list<cPlayer*> m_OpenedBy;
+ bool m_bInventoryVisible;
+ int m_NumSlots;
+ cItem* m_Slots;
+ cItem* m_DraggingItem;
+}; \ No newline at end of file