Planeshift

inventorywindow.h

Go to the documentation of this file.
00001 /*
00002  * inventory.h - Author: Andrew Craig
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation (version 2 of the License)
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017  *
00018  */
00019 
00020 #ifndef PAWS_INVENTORY_WINDOW
00021 #define PAWS_INVENTORY_WINDOW
00022 
00023 // CS INCLUDES
00024 #include <csutil/array.h>
00025 #include <csutil/leakguard.h>
00026 #include <imap/loader.h>
00027 
00028 #include "psslotmgr.h"
00029 #include "rpgrules/psmoney.h"
00030 
00031 #include "paws/pawsmanager.h"
00032 #include "paws/pawswidget.h"
00033 #include "paws/pawsbutton.h"
00034 #include "paws/pawstextbox.h"
00035 #include "paws/pawsnumberpromptwindow.h"
00036 #include "gui/pawscontrolwindow.h"
00037 #include "net/cmdbase.h"
00038 #include "../psinventorycache.h"
00039 
00040 
00041 struct iEngine;
00042 class pawsMoney;
00043 class pawsSlot;
00044 class pawsInventoryDollView;
00045 class psCharAppearance;
00046 
00047 //---------------------------------------------------------------------------
00048 
00053 class pawsInventoryWindow  : public pawsControlledWindow
00054 {
00055 public:
00056     pawsInventoryWindow();
00057     ~pawsInventoryWindow();
00058         
00061     bool PostSetup();
00062     void Show();
00063     void Refresh();
00064     virtual bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
00065     virtual bool OnMouseDown( int button, int keyModifier, int x, int y );    
00066     virtual void Close();
00067 
00069     pawsSlot* GetFreeSlot();
00070 
00079     bool Equip( const char* itemName, int stackCount, int toSlotID = -1 );
00080     
00081     
00088     void Dequip(const char* itemName);
00089     
00095     void Write( const char* itemName);
00096 
00097     
00098 protected:
00099 
00100     bool SetupDoll();
00101 
00103     bool SetupSlot( const char* slot );
00104     
00106     pawsInventoryDollView* view;
00107     
00108     void UpdateMoney( const char* moneyName, const char* imageName, int value );
00109     
00110     csRef<iThreadedLoader> loader;
00111 
00113     int maxDropCount;
00114 
00115     pawsTextBox* trias;
00116     pawsTextBox* weight;
00117 
00118     pawsMoney * money;
00119    
00120     csArray<pawsSlot*> bulkSlots;
00121     csArray<pawsSlot*> equipmentSlots;
00122 
00123 private:
00124     psInventoryCache* inventoryCache;
00125     psCharAppearance* charApp;
00126       
00127 };
00128 
00129 CREATE_PAWS_FACTORY( pawsInventoryWindow );
00130 
00131 //--------------------------------------------------------------------------
00132 
00133 
00134 
00135 #endif 
00136