Planeshift
pawsstoragewindow.h
Go to the documentation of this file.
1 /*
2  * pawsstoragewindow.cpp - Stefano Angeleri <weltall2@gmail.com>
3  *
4  * Copyright (C) 2010 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 #ifndef PAWS_STORAGE_WINDOW
20 #define PAWS_STORAGE_WINDOW
21 
22 #include <csutil/csstring.h>
23 
24 #include "net/cmdbase.h"
25 #include "paws/pawswidget.h"
26 #include "paws/pawslistbox.h"
28 
29 class pawsListBox;
30 
34 {
35 public:
37  virtual ~pawsStorageWindow();
38  bool PostSetup();
39 
40  void HandleMessage( MsgEntry* me );
41  void OnListAction( pawsListBox* listbox, int status );
42 
43  bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
44  void Close();
45 
46  void DoTrade(int count,const char* itemName,const char* itemID);
47 
48  void OnNumberEntered(const char *name,int param,int value);
49 
50 protected:
51  // Handle messages from the server.
52  void HandleStorage( const char* data );
53  void HandleCategories( const char* data );
54  void HandleItems( const char* data );
55  void HandleMoney( const char* data );
56  void UpdateMoney( const char* moneyName, const char* imageName, int value );
57 
58  void SetTradeMode( bool buy );
59 
68  void TradeSelectedItem( bool all = false, bool single = false );
69 
70  csString GetColumnText(pawsListBoxRow* row, int colNum);
71  void SetColumnText(pawsListBoxRow* row, int colNum, const csString & text);
72 
73 
77 
81 
83 };
84 
85 
86 //--------------------------------------------------------------------------
88 
89 
90 #endif
void HandleItems(const char *data)
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
virtual ~pawsStorageWindow()
void SetColumnText(pawsListBoxRow *row, int colNum, const csString &text)
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
pawsTextBox * trias
pawsListBox * categoryBox
index of item, selected in the itemsBox
void HandleCategories(const char *data)
void TradeSelectedItem(bool all=false, bool single=false)
Handles the command of trading the item by interacting with the player.
void HandleStorage(const char *data)
A simple list box widget.
Definition: pawslistbox.h:202
pawsListBox * itemsBox
void DoTrade(int count, const char *itemName, const char *itemID)
The window that deals with interacting with a NPC storage.
CREATE_PAWS_FACTORY(pawsStorageWindow)
void HandleMoney(const char *data)
void OnNumberEntered(const char *name, int param, int value)
bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
void HandleMessage(MsgEntry *me)
A List Box Row.
Definition: pawslistbox.h:85
csString GetColumnText(pawsListBoxRow *row, int colNum)
void SetTradeMode(bool buy)
void Close()
Simply calls Hide() unless overidden.
A basic text box widget.
Definition: pawstextbox.h:42
void UpdateMoney(const char *moneyName, const char *imageName, int value)
bool OnButtonPressed(int mouseButton, int keyModifier, pawsWidget *widget)
Called whenever a button is pressed.
void OnListAction(pawsListBox *listbox, int status)
Called whenever an item in a child list box is selected.