Planeshift
psslotmgr.h
Go to the documentation of this file.
1 /*
2  * psslotmgr.h
3  *
4  * Copyright (C) 2005 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation (version 2
9  * of the License).
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  *
19  */
20 
21 #ifndef PS_SLOT_MANAGER
22 #define PS_SLOT_MANAGER
23 
24 #include <csutil/array.h>
25 
27 
28 //=============================================================================
29 // Forward Declarations
30 //=============================================================================
31 class pawsSlot;
32 class pawsDnDButton;
33 class MsgHandler;
34 struct iMeshWrapper;
35 
36 //=============================================================================
37 // Classes
38 //=============================================================================
39 
44 {
45 public:
46  psSlotManager();
47  virtual ~psSlotManager();
48 
49  bool HandleEvent( iEvent& ev );
50 
51  void Handle( pawsSlot* slot, bool grabOne = false, bool grabAll = false );
52  void Handle( pawsDnDButton* target );
53 
54  void SetDragDetails(pawsSlot* slot, int count);
55  void SetDragDetails(pawsDnDButton *target );
56 
57  bool IsDragging() { return isDragging; }
58  bool IsPlacing() { return isPlacing; }
59 
61  void SetDragFlag( bool flag ) { isDragging = flag; }
62 
63  int HoldingContainerID() { return draggingSlot.containerID; }
64  int HoldingSlotID() { return draggingSlot.slotID; }
65 
66  void CancelDrag();
67 
68  void OnNumberEntered(const char *name,int param,int value);
69 
70 
71 private:
72  struct DraggingSlot
73  {
74  int containerID;
75  int slotID;
76  int stackCount;
77  pawsWidget* slot;
78  csString meshFactName;
79  csString materialName;
80  csString toolTip;
81  csString Action;
82  int parentID;
83  bool split;
84  } draggingSlot;
85 
86  void PlaceItem();
87  void UpdateItem();
88  void DropItem(bool guard);
89 
90 
91  bool isDragging;
92  bool isPlacing;
93  bool isRotating;
94  bool hadInventory;
95 
96  psPoint basePoint;
97 
98  csArray<pawsSlot*> slotsInUse;
99  int last_count;
100 
101  csEventID MouseMove;
102  csEventID MouseDown;
103  csEventID MouseUp;
104  csEventID KeyDown;
105  csEventID KeyUp;
106 
107  csString draggedMesh;
108  iMeshWrapper* outline;
109 };
110 #endif
bool HandleEvent(iEvent &ev)
void OnNumberEntered(const char *name, int param, int value)
void CancelDrag()
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
void Handle(pawsSlot *slot, bool grabOne=false, bool grabAll=false)
void SetDragDetails(pawsSlot *slot, int count)
A slot which may contain one item, with icon, and stack count.
Definition: pawsslot.h:22
int HoldingContainerID()
Definition: psslotmgr.h:63
virtual ~psSlotManager()
A Drag-and-Drop capable button widget with timer.
Definition: pawsdndbutton.h:45
void SetDragFlag(bool flag)
Set the state of the drag flag.
Definition: psslotmgr.h:61
bool IsDragging()
Definition: psslotmgr.h:57
Manages dragging items from one inventory slot to another and dropping them into the world...
Definition: psslotmgr.h:43
This class is the client&#39;s and server&#39;s main interface for either sending network messages out or get...
Definition: msghandler.h:106
int HoldingSlotID()
Definition: psslotmgr.h:64
bool IsPlacing()
Definition: psslotmgr.h:58