Planeshift
pawsslot.h
Go to the documentation of this file.
1 #ifndef PAWS_SLOT_HEADER
2 #define PAWS_SLOT_HEADER
3 
4 
5 #include "paws/pawswidget.h"
6 
7 //=============================================================================
8 // Forward Declarations
9 //=============================================================================
10 class psSlotManager;
11 class pawsTextBox;
12 
13 
14 //=============================================================================
15 // Classes
16 //=============================================================================
17 
22 class pawsSlot : public pawsWidget
23 {
24 public:
25  pawsSlot();
26  ~pawsSlot();
27 
28  void SetDrag( bool isDragDrop ) { dragDrop = isDragDrop; }
29  void SetEmptyOnZeroCount( bool emptyOnZeroCount ) { this->emptyOnZeroCount = emptyOnZeroCount; }
30  bool Setup( iDocumentNode* node );
31  void SetContainer( int id ) { containerID = id; }
32 
33  bool OnMouseDown( int button, int modifiers, int x, int y );
34  void Draw();
35  void SetToolTip( const char* text );
36 
37  int StackCount() { return stackCount; }
38  void StackCount( int newCount );
39 
40  int GetPurifyStatus();
41  void SetPurifyStatus(int status);
42 
43  void PlaceItem( const char* imageName, const char* meshFactName,
44  const char* matName = NULL, int count = 0 );
45  iPawsImage* Image() { return image; }
46  const char *ImageName();
47 
48  const char *GetMeshFactName()
49  {
50  return meshfactName;
51  }
52 
53  const char *GetMaterialName()
54  {
55  return materialName;
56  }
57 
58  const csString & SlotName() const { return slotName; }
59  void SetSlotName(const csString & name) { slotName = name; }
60 
61  int ContainerID() { return containerID; };
62  int ID() { return slotID; }
63  void SetSlotID( int id ) { slotID = id; }
64 
65  virtual void Clear();
66  bool IsEmpty() { if(!reserved) return empty; else return false; }
67 
68  void Reserve() { reserved = true; }
69 
73  void DrawStackCount(bool value);
74 
79 
80  bool SelfPopulate( iDocumentNode *node);
81 
82  void OnUpdateData(const char *dataname,PAWSData& value);
83 
84  void ScalePurifyStatus();
85 
86  bool IsBartender() { return isBartender; }
87  void SetBartender( bool t) { isBartender = t; }
88 
89  void SetBartenderAction(csString& act) { action = act; }
90  csString &GetAction() { return action; }
91  void clearBartenderAction() { action.Empty(); }
92 
93  bool GetLock() { return locked; }
94  void SetLock( bool state ) { locked = state; }
95 protected:
97  csString meshfactName;
98  csString materialName;
99  csString slotName;
101  int slotID;
104  bool empty;
105  bool dragDrop;
107  bool reserved;
108  bool locked;
109 
110  csRef<iPawsImage> image;
115 
116  bool isBartender;
117  csString action;
118 };
119 
121 
122 #endif
123 
int id
The id of the widget.
Definition: pawswidget.h:127
void SetBartenderAction(csString &act)
Definition: pawsslot.h:89
bool reserved
implemented to fix dequip behaviour. Cleared on PlaceItem and Clear
Definition: pawsslot.h:107
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
bool emptyOnZeroCount
should the slot clear itself when the stackcount hits 0 ?
Definition: pawsslot.h:114
void SetEmptyOnZeroCount(bool emptyOnZeroCount)
Definition: pawsslot.h:29
csString action
This is the action to do if this a bartender button.
Definition: pawsslot.h:117
int GetPurifyStatus()
void SetPurifyStatus(int status)
csRef< iPawsImage > image
Definition: pawsslot.h:110
A slot which may contain one item, with icon, and stack count.
Definition: pawsslot.h:22
bool drawStackCount
Definition: pawsslot.h:106
bool locked
Definition: pawsslot.h:108
iPawsImage * Image()
Definition: pawsslot.h:45
csString name
The name of this widget.
Definition: pawswidget.h:217
void Reserve()
Definition: pawsslot.h:68
bool IsDrawingStackCount()
Tells if this widget is currently drawing the stack count.
Definition: pawsslot.h:78
const char * GetMeshFactName()
Definition: pawsslot.h:48
bool empty
Definition: pawsslot.h:104
void PlaceItem(const char *imageName, const char *meshFactName, const char *matName=NULL, int count=0)
csString slotName
Definition: pawsslot.h:99
psSlotManager * mgr
Definition: pawsslot.h:96
bool handleMouseClicks
Definition: pawsslot.h:113
void clearBartenderAction()
Definition: pawsslot.h:91
pawsTextBox * stackCountLabel
Definition: pawsslot.h:112
bool IsEmpty()
Definition: pawsslot.h:66
int slotID
Definition: pawsslot.h:101
virtual void Clear()
const char * GetMaterialName()
Definition: pawsslot.h:53
void ScalePurifyStatus()
bool Setup(iDocumentNode *node)
Setup this widget.
bool OnMouseDown(int button, int modifiers, int x, int y)
Manage mouse down event to test for and apply window changes.
int containerID
Definition: pawsslot.h:100
void SetSlotName(const csString &name)
Definition: pawsslot.h:59
Manages dragging items from one inventory slot to another and dropping them into the world...
Definition: psslotmgr.h:43
void DrawStackCount(bool value)
Sets if this widget has to draw the stack count.
bool SelfPopulate(iDocumentNode *node)
This function allows a widget to fill in its own contents from an xml node supplied and calls the sam...
void OnUpdateData(const char *dataname, PAWSData &value)
bool dragDrop
Definition: pawsslot.h:105
void SetContainer(int id)
Definition: pawsslot.h:31
const char * ImageName()
void SetDrag(bool isDragDrop)
Definition: pawsslot.h:28
bool GetLock()
Definition: pawsslot.h:93
int stackCount
Definition: pawsslot.h:102
void Draw()
Draws the widget and all of it&#39;s children.
csString meshfactName
Definition: pawsslot.h:97
void SetSlotID(int id)
Definition: pawsslot.h:63
int ContainerID()
Definition: pawsslot.h:61
void SetToolTip(const char *text)
const csString & SlotName() const
Definition: pawsslot.h:58
pawsWidget * purifySign
Definition: pawsslot.h:111
int purifyStatus
Definition: pawsslot.h:103
bool IsBartender()
Definition: pawsslot.h:86
int ID()
Definition: pawsslot.h:62
int StackCount()
Definition: pawsslot.h:37
csString & GetAction()
Definition: pawsslot.h:90
CREATE_PAWS_FACTORY(pawsSlot)
bool isBartender
Flag on if this a special bartender slot.
Definition: pawsslot.h:116
csString materialName
Definition: pawsslot.h:98
void SetBartender(bool t)
Definition: pawsslot.h:87
A basic text box widget.
Definition: pawstextbox.h:42
void SetLock(bool state)
Definition: pawsslot.h:94