Planeshift

pawsexchangewindow.h

Go to the documentation of this file.
00001 /*
00002  * pawsexchangewindow.h"
00003  *
00004  * Copyright (C) 2003 Atomic Blue ([email protected], http://www.atomicblue.org)
00005  *exi
00006  * Credits :    Andrew Craig <[email protected]> 
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
00011  * of the License).
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  *
00020  *
00021  */
00022 #ifndef PAWS_EXCHANGE_WINDOW
00023 #define PAWS_EXCHANGE_WINDOW
00024 
00025 #include <csutil/csstring.h>
00026 
00027 #include "net/subscriber.h"
00028 #include "paws/pawswidget.h"
00029 #include "util/psconst.h"
00030 #include "gui/inventorywindow.h"
00031 
00032 class pawsMoney;
00033 
00034 #define EXCHANGE_VISIBLE            4
00035 #define EXCHANGE_VISIBLE_INVENTORY 16
00036 
00037 enum psExchangeType
00038 {
00039     exchangePC2PC,        /* exchange between our player and another player */
00040     exchangePC2NPC        /* exchange between our player and a non-player character
00041                                 - in this case items are transfered only from our character to the NPC
00042                                 - used for quests */
00043 };
00044 
00051 class pawsExchangeWindow : public pawsWidget, public psClientNetSubscriber
00052 {
00053 public:
00054     pawsExchangeWindow();
00055     virtual ~pawsExchangeWindow();
00056 
00057     //from pawsWidget:
00058     bool PostSetup();
00059     bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
00060     void Close();
00061     
00062     //from iNetSubscriber:
00063     void HandleMessage( MsgEntry* me );
00064     
00066     void SendAccept();
00067 
00069     void SendEnd();
00070 
00071 protected:
00072 
00074     void HandleMoney( MsgEntry* me );
00075     
00077     void Clear();
00078 
00085     void StartExchange( csString& player, bool withPlayer );
00086 
00088     bool wasSmallInventoryOpen;
00089 
00091     int originalWidth;
00092     
00093     psExchangeType type;
00094     
00096     pawsWidget* offeringBG;
00097     
00099     pawsWidget* receivingBG;
00100     
00101     pawsMoney * offeringMoneyWidget, * receivingMoneyWidget;
00102 
00103     //Text that shows the total amount of trias
00104     pawsTextBox * totalTriasOffered, *totalTriasReceived;
00105 
00107     pawsSlot* offeringSlots[EXCHANGE_SLOT_COUNT];
00108     
00110     pawsSlot* receivingSlots[EXCHANGE_SLOT_COUNT];
00111 }; 
00112 
00113 
00114 CREATE_PAWS_FACTORY( pawsExchangeWindow );
00115 
00116 
00117 
00118 #endif