the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 78 lines 2.8 kB view raw
1#pragma once 2using namespace std; 3 4class Slot; 5class ItemInstance; 6 7#include "XUI_CustomMessages.h" 8 9class SlotControlUserDataContainer 10{ 11public: 12 SlotControlUserDataContainer() : slot( NULL ), hProgressBar( NULL ), m_iPad( -1 ), m_fAlpha(1.0f) {}; 13 Slot* slot; 14 HXUIOBJ hProgressBar; 15 float m_fAlpha; 16 int m_iPad; 17}; 18 19// The base class for all controls with the "ItemButton" visual 20// This could be a list item or just a button. 21// We need this class to be able to easily access all the parts of the visual 22 23class CXuiCtrlSlotItemCtrlBase 24{ 25private: 26 // 4J WESTY : Pointer Prototype : Added to support prototype only. 27 BOOL m_bSkipDefaultNavigation; 28 29public: 30 // We define a lot of functions as virtual. These should be implemented to call the protected version by 31 // passing in the HXUIOBJ of the control as the first parameter. We do not have access to that normally 32 // due to the inheritance structure 33 virtual HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) = 0; 34 35 virtual HRESULT OnDestroy() = 0; 36 37 virtual HRESULT OnCustomMessage_GetSlotItem(CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled) = 0; 38 39 // 4J WESTY : Pointer Prototype : Added to support prototype only. 40 virtual HRESULT OnControlNavigate(XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled) = 0; 41 42 virtual HRESULT OnKeyDown(XUIMessageInput *pInputData, BOOL& bHandled) = 0; 43 44 void SetSlot( HXUIOBJ hObj, Slot* slot ); 45 void SetAlpha( HXUIOBJ hObj, float fAlpha ); 46 void SetUserIndex( HXUIOBJ hObj, int iPad ); 47 48 bool isEmpty( HXUIOBJ hObj ); 49 50 wstring GetItemDescription( HXUIOBJ hObj, vector<wstring> &unformattedStrings ); 51 52 shared_ptr<ItemInstance> getItemInstance( HXUIOBJ hObj ); 53 Slot *getSlot( HXUIOBJ hObj ); 54 55 // 4J WESTY : Pointer Prototype : Added to support prototype only. 56 int GetObjectCount( HXUIOBJ hObj ); 57 58 // 4J WESTY : Pointer Prototype : Added to support prototype only. 59 void SetSkipsDefaultNavigation( BOOL bSkipDefaultNavigation ) { m_bSkipDefaultNavigation = bSkipDefaultNavigation; } 60 61 // 4J WESTY : Pointer Prototype : Added to support prototype only. 62 int GetEmptyStackSpace( HXUIOBJ hObj ); // Returns number of items that can still be stacked into this slot. 63 64 // 4J WESTY : Pointer Prototype : Added to support prototype only. 65 bool IsSameItemAs( HXUIOBJ hThisObj, HXUIOBJ hOtherObj ); 66 67protected: 68 HRESULT OnInit( HXUIOBJ hObj, XUIMessageInit* pInitData, BOOL& bHandled ); 69 70 HRESULT OnDestroy( HXUIOBJ hObj ); 71 72 HRESULT OnCustomMessage_GetSlotItem(HXUIOBJ hObj, CustomMessage_GetSlotItem_Struct *pData, BOOL& bHandled); 73 74 // 4J WESTY : Pointer Prototype : Added to support prototype only. 75 HRESULT OnControlNavigate(HXUIOBJ hObj, XUIMessageControlNavigate *pControlNavigateData, BOOL& bHandled); 76 77 HRESULT OnKeyDown(HXUIOBJ hObj, XUIMessageInput *pInputData, BOOL& bHandled); 78};