Planeshift
pawsexchangewindow.h
Go to the documentation of this file.
1 /*
2  * pawsexchangewindow.h"
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *exi
6  * Credits : Andrew Craig <acraig@paqrat.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation (version 2
11  * of the License).
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  *
21  */
22 #ifndef PAWS_EXCHANGE_WINDOW
23 #define PAWS_EXCHANGE_WINDOW
24 
25 #include <csutil/csstring.h>
26 
27 #include "net/subscriber.h"
28 #include "paws/pawswidget.h"
29 #include "util/psconst.h"
30 #include "gui/inventorywindow.h"
31 
32 class pawsMoney;
33 
34 #define EXCHANGE_VISIBLE 4
35 #define EXCHANGE_VISIBLE_INVENTORY 16
36 
38 {
39  exchangePC2PC, /* exchange between our player and another player */
40  exchangePC2NPC /* exchange between our player and a non-player character
41  - in this case items are transfered only from our character to the NPC
42  - used for quests */
43 };
44 
52 {
53 public:
55  virtual ~pawsExchangeWindow();
56 
57  //from pawsWidget:
58  bool PostSetup();
59  bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
60  void Close();
61 
62  //from iNetSubscriber:
63  void HandleMessage( MsgEntry* me );
64 
66  void SendAccept();
67 
69  void SendEnd();
70 
71 protected:
72 
74  void HandleMoney( MsgEntry* me );
75 
77  void Clear();
78 
85  void StartExchange( csString& player, bool withPlayer );
86 
89 
92 
94 
97 
100 
102 
103  //Text that shows the total amount of trias
105 
108 
111 };
112 
113 
115 
116 
117 
118 #endif
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
pawsSlot * offeringSlots[EXCHANGE_SLOT_COUNT]
List of slots for items that have been offered.
pawsTextBox * totalTriasReceived
pawsTextBox * totalTriasOffered
CREATE_PAWS_FACTORY(pawsExchangeWindow)
A slot which may contain one item, with icon, and stack count.
Definition: pawsslot.h:22
bool wasSmallInventoryOpen
retain the state of the inventory window before opening the exchange
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
pawsWidget * receivingBG
The background for the receiving panel.
psExchangeType
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
void SendAccept()
Sends psExchangeAcceptMsg message to the server.
pawsWidget * offeringBG
The background for the offering panel.
pawsMoney is widget that holds four items slots - for each coin.
Definition: pawsmoney.h:36
pawsMoney * receivingMoneyWidget
pawsSlot * receivingSlots[EXCHANGE_SLOT_COUNT]
List of slots for items that will be receiving.
pawsMoney * offeringMoneyWidget
#define EXCHANGE_SLOT_COUNT
Definition: psconst.h:69
void HandleMoney(MsgEntry *me)
Handles incomming messages that deal with exchange money.
The trade window in PlaneShift.
void HandleMessage(MsgEntry *me)
void Clear()
Clear out the exchange window and reset the backgrounds.
void SendEnd()
Sends a psExchangeEndMsg message to the server.
void Close()
Simply calls Hide() unless overidden.
int originalWidth
stores width of exchange window
void StartExchange(csString &player, bool withPlayer)
Start a new exchange with a player.
bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
virtual ~pawsExchangeWindow()
A basic text box widget.
Definition: pawstextbox.h:42