Planeshift
pawsmoney.h
Go to the documentation of this file.
1 /*
2  * pawsmoney.h - Author: Ondrej Hurt
3  *
4  * Copyright (C) 2003 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 
20 
21 #ifndef PAWS_MONEY_HEADER
22 #define PAWS_MONEY_HEADER
23 
24 #include <csutil/list.h>
25 #include <iutil/document.h>
26 #include "paws/pawswidget.h"
27 #include "net/subscriber.h"
28 #include "gui/inventorywindow.h"
29 #include "pawsslot.h"
30 
36 class pawsMoney : public pawsWidget
37 {
38 public:
39  pawsMoney();
40 
41  //from pawsWidget:
42  virtual bool Setup(iDocumentNode * node);
43  virtual bool PostSetup();
44 
46  void Set(int circles, int octas, int hexas, int trias);
47  void Set(int coinType, int count);
48  void Set(const psMoney & money);
49  void Get(int & circles, int & octas, int & hexas, int & trias);
50  int Get(int coinType);
51 
53  int GetAmount() { return amount; }
54 
55  psMoney Get();
56 
58  bool IsNoAmount();
59 
60  void SetContainer( int containerID );
61  void Drag( bool dragOn );
62 
63  void Draw();
64  void OnUpdateData(const char *dataname,PAWSData& value);
65 
66 protected:
68  bool CreateGUI();
69 
70  bool border;
71  int spacing;
72 
73  int amount;
74 
79 
81  void RecalculateAmount();
82 };
83 
85 
86 #endif
87 
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
void Drag(bool dragOn)
pawsSlot * circles
Definition: pawsmoney.h:75
int amount
The total amount of money in trias.
Definition: pawsmoney.h:73
A slot which may contain one item, with icon, and stack count.
Definition: pawsslot.h:22
void SetContainer(int containerID)
int spacing
distance between slots
Definition: pawsmoney.h:71
bool CreateGUI()
Loads pawsMoney widget content from file.
virtual bool PostSetup()
This is called after the widget and all of it&#39;s children have been created.
CREATE_PAWS_FACTORY(pawsMoney)
void RecalculateAmount()
Called when amount of a coin (hexa, octa ... ) is changed.
void Draw()
Draws the widget and all of it&#39;s children.
pawsMoney is widget that holds four items slots - for each coin.
Definition: pawsmoney.h:36
bool IsNoAmount()
Tells if the amount of money is Zero (null)
pawsSlot * octas
Definition: pawsmoney.h:76
void OnUpdateData(const char *dataname, PAWSData &value)
psMoney Get()
pawsSlot * trias
Definition: pawsmoney.h:78
void Set(int circles, int octas, int hexas, int trias)
Get and set amounts of different coins.
virtual bool Setup(iDocumentNode *node)
Setup this widget.
int GetAmount()
Returns the amount of money in trias.
Definition: pawsmoney.h:53
bool border
should the slot widgets have border ?
Definition: pawsmoney.h:70
pawsSlot * hexas
Definition: pawsmoney.h:77