Planeshift

pawsstoragewindow.h

Go to the documentation of this file.
00001 /*
00002  * pawsstoragewindow.cpp -  Stefano Angeleri <[email protected]>
00003  *
00004  * Copyright (C) 2010 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 #ifndef PAWS_STORAGE_WINDOW
00020 #define PAWS_STORAGE_WINDOW
00021 
00022 #include <csutil/csstring.h>
00023 
00024 #include "net/cmdbase.h"
00025 #include "paws/pawswidget.h"
00026 #include "paws/pawslistbox.h"
00027 #include "paws/pawsnumberpromptwindow.h"
00028 
00029 class pawsListBox;
00030 
00033 class pawsStorageWindow : public pawsWidget, public psClientNetSubscriber,public iOnNumberEnteredAction
00034 {
00035 public:
00036     pawsStorageWindow();
00037     virtual ~pawsStorageWindow();
00038     bool PostSetup();
00039     
00040     void HandleMessage( MsgEntry* me );
00041     void OnListAction( pawsListBox* listbox, int status );    
00042 
00043     bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
00044     void Close();
00045 
00046     void DoTrade(int count,const char* itemName,const char* itemID);
00047 
00048     void OnNumberEntered(const char *name,int param,int value);
00049 
00050 protected:
00051     // Handle messages from the server.
00052     void HandleStorage( const char* data );
00053     void HandleCategories( const char* data );
00054     void HandleItems( const char* data );
00055     void HandleMoney( const char* data );
00056     void UpdateMoney( const char* moneyName, const char* imageName, int value );
00057 
00058     void SetTradeMode( bool buy );
00059 
00068     void TradeSelectedItem( bool all = false, bool single = false );
00069     
00070     csString GetColumnText(pawsListBoxRow* row, int colNum);
00071     void SetColumnText(pawsListBoxRow* row, int colNum, const csString & text);
00072 
00073 
00074     int merchantID;
00075     int tradeCommand;
00076     int selectedItem;   
00077 
00078     pawsListBox* categoryBox;
00079     pawsListBox* itemsBox;
00080     pawsTextBox* trias;
00081     
00082     csString currentItem,currentID;
00083 }; 
00084 
00085 
00086 //--------------------------------------------------------------------------
00087 CREATE_PAWS_FACTORY( pawsStorageWindow );
00088 
00089 
00090 #endif