Planeshift
inventorywindow.h
Go to the documentation of this file.
1 /*
2  * inventory.h - Author: Andrew Craig
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 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 #ifndef PAWS_INVENTORY_WINDOW
21 #define PAWS_INVENTORY_WINDOW
22 
23 // CS INCLUDES
24 #include <csutil/array.h>
25 #include <csutil/leakguard.h>
26 #include <imap/loader.h>
27 
28 #include "psslotmgr.h"
29 #include "rpgrules/psmoney.h"
30 
31 #include "paws/pawsmanager.h"
32 #include "paws/pawswidget.h"
33 #include "paws/pawsbutton.h"
34 #include "paws/pawstextbox.h"
36 #include "gui/pawscontrolwindow.h"
37 #include "net/cmdbase.h"
38 #include "../psinventorycache.h"
39 
40 
41 struct iEngine;
42 class pawsMoney;
43 class pawsSlot;
45 class psCharAppearance;
46 
47 //---------------------------------------------------------------------------
48 
54 {
55 public:
58 
61  bool PostSetup();
62  void Show();
63  void Refresh();
64  virtual bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
65  virtual bool OnMouseDown( int button, int keyModifier, int x, int y );
66  virtual void Close();
67 
70 
79  bool Equip( const char* itemName, int stackCount, int toSlotID = -1 );
80 
81 
88  void Dequip(const char* itemName);
89 
95  void Write( const char* itemName);
96 
97 
98 protected:
99 
100  bool SetupDoll();
101 
103  bool SetupSlot( const char* slot );
104 
107 
108  void UpdateMoney( const char* moneyName, const char* imageName, int value );
109 
110  csRef<iThreadedLoader> loader;
111 
114 
117 
119 
120  csArray<pawsSlot*> bulkSlots;
121  csArray<pawsSlot*> equipmentSlots;
122 
123 private:
124  psInventoryCache* inventoryCache;
125  psCharAppearance* charApp;
126 
127 };
128 
130 
131 //--------------------------------------------------------------------------
132 
133 
134 
135 #endif
136 
This is a window that is controlled by a button on the control bar.
CREATE_PAWS_FACTORY(pawsInventoryWindow)
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
A slot which may contain one item, with icon, and stack count.
Definition: pawsslot.h:22
csRef< iThreadedLoader > loader
pawsTextBox * weight
bool Equip(const char *itemName, int stackCount, int toSlotID=-1)
Equips an item into it&#39;s closest available slot.
void UpdateMoney(const char *moneyName, const char *imageName, int value)
pawsInventoryDollView * view
A quick pointer to the object view that is the mesh doll.
A manager class that handles all the details of a characters appearance.
Definition: charapp.h:65
The is the main Inventory window for PlaneShift.
The character 3D doll view - here we add a mouse listener so you can drag-n-drop inventory onto the a...
pawsMoney is widget that holds four items slots - for each coin.
Definition: pawsmoney.h:36
bool SetupSlot(const char *slot)
Helper function to setup the pawsSlot and container definitions.
virtual bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
int maxDropCount
Total items to drop.
virtual bool OnMouseDown(int button, int keyModifier, int x, int y)
Manage mouse down event to test for and apply window changes.
psinventorycache.h
void Show()
When the window is opened let the controller window know about it.
bool PostSetup()
From pawsWidget.
void Dequip(const char *itemName)
Dequips an item into closest available bulk slot.
void Write(const char *itemName)
Finds an item with the given name and attempts to open it as a book to write on.
csArray< pawsSlot * > equipmentSlots
virtual void Close()
Simply calls Hide() unless overidden.
A basic text box widget.
Definition: pawstextbox.h:42
csArray< pawsSlot * > bulkSlots
pawsSlot * GetFreeSlot()
Get a free slot.