OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
PurchaseTabbedState.h
1 /*
2  * Copyright 2010-2013 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom 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  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_PURCHASESTATE_H
20 #define OPENXCOM_PURCHASESTATE_H
21 
22 #include "../Engine/State.h"
23 #include <vector>
24 #include <string>
25 
26 namespace OpenXcom
27 {
28 
29 class TextButton;
30 class Window;
31 class Text;
32 class TextList;
33 class Timer;
34 class Base;
35 
40 class PurchaseState : public State
41 {
42 private:
43  Base *_base;
44 
45  TextButton *_btnOk, *_btnCancel;
46  TextButton *_btnPurchaseTab, *_btnPersonnel, *_btnCraft, *_btnItems;
47  eSelectedTab _selTab;
48  Window *_window;
49  Text *_txtTitle, *_txtFunds, *_txtPurchases, *_txtItem, *_txtCost, *_txtQuantity, *_txtInStorage;
50  TextList *_lstPersonnel, *_lstCraft, *_lstItems;
51  std::vector<std::string> _crafts, _items, _craftItems;
52  std::vector<int> _qtys, _qtysPersonnel, _qtysCraft;
53  unsigned int _sel;
54  int _total, _pQty, _cQty;
55  float _iQty;
56  Timer *_timerInc, *_timerDec;
57  int _changeValueByMouseWheel;
58  bool _allowChangeListValuesByMouseWheel;
60  int getPrice();
61 public:
63  PurchaseState(Game *game, Base *base);
67  void think();
69  void btnOkClick(Action *action);
71  void btnCancelClick(Action *action);
72 
74  void btnPersonnelClick(Action *action);
76  void btnCraftClick(Action *action);
78  void btnItemsClick(Action *action);
79 
81  void lstItemsLeftArrowPress(Action *action);
83  void lstItemsLeftArrowRelease(Action *action);
85  void lstItemsLeftArrowClick(Action *action);
87  void lstItemsRightArrowPress(Action *action);
89  void lstItemsRightArrowRelease(Action *action);
91  void lstItemsRightArrowClick(Action *action);
93  void lstItemsMousePress(Action *action);
95  void increase();
97  void increaseByValue(int change);
99  void decrease();
101  void decreaseByValue(int change);
103  void updateItemStrings();
104 };
105 
106 }
107 
108 #endif
void lstItemsMousePress(Action *action)
Handler for pressing-down a mouse-button in the list.
Definition: PurchaseState.cpp:398
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: PurchaseState.cpp:252
void lstItemsRightArrowPress(Action *action)
Handler for pressing a Decrease arrow in the list.
Definition: PurchaseState.cpp:360
void updateItemStrings()
Updates the quantity-strings of the selected item.
Definition: PurchaseState.cpp:575
void decreaseByValue(int change)
Decreases the quantity of an item by the given value.
Definition: PurchaseState.cpp:547
void lstItemsLeftArrowPress(Action *action)
Handler for pressing an Increase arrow in the list.
Definition: PurchaseState.cpp:322
void think()
Runs the timers.
Definition: PurchaseState.cpp:223
void decrease()
Decreases the quantity of an item by one.
Definition: PurchaseState.cpp:536
void lstItemsRightArrowRelease(Action *action)
Handler for releasing a Decrease arrow in the list.
Definition: PurchaseState.cpp:370
void increaseByValue(int change)
Increases the quantity of an item by the given value.
Definition: PurchaseState.cpp:470
void btnItemsClick(Action *action)
Handler for clicking the Items tab.
Definition: PurchaseTabbedState.cpp:392
void increase()
Increases the quantity of an item by one.
Definition: PurchaseState.cpp:459
PurchaseState(Game *game, Base *base)
Creates the Purchase state.
Definition: PurchaseState.cpp:57
void lstItemsLeftArrowRelease(Action *action)
Handler for releasing an Increase arrow in the list.
Definition: PurchaseState.cpp:332
~PurchaseState()
Cleans up the Purchase state.
Definition: PurchaseState.cpp:214
void btnPersonnelClick(Action *action)
Handler for clicking the Personnel tab.
Definition: PurchaseTabbedState.cpp:364
void lstItemsRightArrowClick(Action *action)
Handler for clicking a Decrease arrow in the list.
Definition: PurchaseState.cpp:383
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: PurchaseState.cpp:313
void btnCraftClick(Action *action)
Handler for clicking the Craft tab.
Definition: PurchaseTabbedState.cpp:378
void lstItemsLeftArrowClick(Action *action)
Handler for clicking an Increase arrow in the list.
Definition: PurchaseState.cpp:345