Planeshift
pawsmerchantwindow.h
Go to the documentation of this file.
1 /*
2  * pawsmerchantwindow.cpp - Anders Reggestad <andersr@pvv.org>
3  * - PAWS version Andrew Craig <acraig@paqrat.com>
4  *
5  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
6  *
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 of the License)
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20 #ifndef PAWS_MERCHANT_WINDOW
21 #define PAWS_MERCHANT_WINDOW
22 
23 #include <csutil/csstring.h>
24 
25 #include "net/cmdbase.h"
26 #include "paws/pawswidget.h"
27 #include "paws/pawslistbox.h"
29 
30 class pawsListBox;
31 
35 {
36 public:
38  virtual ~pawsMerchantWindow();
39  bool PostSetup();
40 
41  void HandleMessage( MsgEntry* me );
42  void OnListAction( pawsListBox* listbox, int status );
43 
44  bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
45  void Close();
46 
47  void DoTrade(int count,const char* itemName,const char* itemID);
48 
49  void OnNumberEntered(const char *name,int param,int value);
50 
51 protected:
52  // Handle messages from the server.
53  void HandleMerchant( const char* data );
54  void HandleCategories( const char* data );
55  void HandleItems( const char* data );
56  void HandleMoney( const char* data );
57  void UpdateMoney( const char* moneyName, const char* imageName, int value );
58 
59  void SetTradeMode( bool buy );
60 
69  void TradeSelectedItem( bool all = false, bool single = false );
70 
74 
78 
80 };
81 
82 
83 //--------------------------------------------------------------------------
85 
86 
87 #endif
void HandleCategories(const char *data)
pawsListBox * itemsBox
void UpdateMoney(const char *moneyName, const char *imageName, int value)
The window that deals with interacting with a NPC merchant.
void TradeSelectedItem(bool all=false, bool single=false)
Handles the command of trading the item by interacting with the player.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
void SetTradeMode(bool buy)
csString name
The name of this widget.
Definition: pawswidget.h:217
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
CREATE_PAWS_FACTORY(pawsMerchantWindow)
pawsListBox * categoryBox
index of item, selected in the itemsBox
void HandleMoney(const char *data)
A simple list box widget.
Definition: pawslistbox.h:202
void DoTrade(int count, const char *itemName, const char *itemID)
void OnListAction(pawsListBox *listbox, int status)
Called whenever an item in a child list box is selected.
void Close()
Simply calls Hide() unless overidden.
void OnNumberEntered(const char *name, int param, int value)
virtual ~pawsMerchantWindow()
void HandleMerchant(const char *data)
void HandleMessage(MsgEntry *me)
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
A basic text box widget.
Definition: pawstextbox.h:42
void HandleItems(const char *data)