1 /*
2  * Copyright 2010-2014 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_CRAFTEQUIPMENTSTATE_H
20 #define OPENXCOM_CRAFTEQUIPMENTSTATE_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 
36 /**
37  * Equipment screen that lets the player
38  * pick the equipment to carry on a craft.
39  */
40 class CraftEquipmentState : public State
41 {
42 private:
43 	TextButton *_btnOk, *_btnClear, *_btnInventory;
44 	Window *_window;
45 	Text *_txtTitle, *_txtItem, *_txtStores, *_txtAvailable, *_txtUsed, *_txtCrew;
46 	TextList *_lstEquipment;
47 	Timer *_timerLeft, *_timerRight;
48 	size_t _sel, _craft;
49 	Base *_base;
50 	std::vector<std::string> _items;
51 	/// Updates quantities of item.
52 	void updateQuantity();
53 public:
54 	/// Creates the Craft Equipment state.
55 	CraftEquipmentState(Game *game, Base *base, size_t craft);
56 	/// Cleans up the Craft Equipment state.
57 	~CraftEquipmentState();
58 	/// Resets state.
59 	void init();
60 	/// Runs the timers.
61 	void think();
62 	/// Handler for clicking the OK button.
63 	void btnOkClick(Action *action);
64 	/// Handler for pressing a Move Left arrow in the list.
65 	void lstEquipmentLeftArrowPress(Action *action);
66 	/// Handler for releasing a Move Left arrow in the list.
67 	void lstEquipmentLeftArrowRelease(Action *action);
68 	/// Handler for clicking a Move Left arrow in the list.
69 	void lstEquipmentLeftArrowClick(Action *action);
70 	/// Handler for pressing a Move Right arrow in the list.
71 	void lstEquipmentRightArrowPress(Action *action);
72 	/// Handler for releasing a Move Right arrow in the list.
73 	void lstEquipmentRightArrowRelease(Action *action);
74 	/// Handler for clicking a Move Right arrow in the list.
75 	void lstEquipmentRightArrowClick(Action *action);
76 	/// Handler for pressing-down a mouse-button in the list.
77 	void lstEquipmentMousePress(Action *action);
78 	/// Moves an item to the base.
79 	void moveLeft();
80 	/// Moves the given number of items to the base.
81 	void moveLeftByValue(int change);
82 	/// Moves an item to the craft.
83 	void moveRight();
84 	/// Moves the given number of items to the craft.
85 	void moveRightByValue(int change);
86 	/// Empties the contents of the craft, moving all of the items back to the base.
87 	void btnClearClick(Action *action);
88 	/// Handler for clicking the Inventory button.
89 	void btnInventoryClick(Action *action);
90 };
91 
92 }
93 
94 #endif
95