Planeshift

pawsmerchantwindow.h

Go to the documentation of this file.
00001 /*
00002  * pawsmerchantwindow.cpp -  Anders Reggestad <[email protected]>
00003  *                        -  PAWS version Andrew Craig <[email protected]>
00004  *
00005  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00006  *
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License
00010  * as published by the Free Software Foundation (version 2 of the License)
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  */
00020 #ifndef PAWS_MERCHANT_WINDOW
00021 #define PAWS_MERCHANT_WINDOW
00022 
00023 #include <csutil/csstring.h>
00024 
00025 #include "net/cmdbase.h"
00026 #include "paws/pawswidget.h"
00027 #include "paws/pawslistbox.h"
00028 #include "paws/pawsnumberpromptwindow.h"
00029 
00030 class pawsListBox;
00031 
00034 class pawsMerchantWindow : public pawsWidget, public psClientNetSubscriber,public iOnNumberEnteredAction
00035 {
00036 public:
00037     pawsMerchantWindow();
00038     virtual ~pawsMerchantWindow();
00039     bool PostSetup();
00040     
00041     void HandleMessage( MsgEntry* me );
00042     void OnListAction( pawsListBox* listbox, int status );    
00043 
00044     bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
00045     void Close();
00046 
00047     void DoTrade(int count,const char* itemName,const char* itemID);
00048 
00049     void OnNumberEntered(const char *name,int param,int value);
00050 
00051 protected:
00052     // Handle messages from the server.
00053     void HandleMerchant( const char* data );
00054     void HandleCategories( const char* data );
00055     void HandleItems( const char* data );
00056     void HandleMoney( const char* data );
00057     void UpdateMoney( const char* moneyName, const char* imageName, int value );
00058 
00059     void SetTradeMode( bool buy );
00060 
00069     void TradeSelectedItem( bool all = false, bool single = false );
00070 
00071     int merchantID;
00072     int tradeCommand;
00073     int selectedItem;   
00074 
00075     pawsListBox* categoryBox;
00076     pawsListBox* itemsBox;
00077     pawsTextBox* trias;
00078     
00079     csString currentItem,currentID;
00080 }; 
00081 
00082 
00083 //--------------------------------------------------------------------------
00084 CREATE_PAWS_FACTORY( pawsMerchantWindow );
00085 
00086 
00087 #endif