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_CRAFTINFOSTATE_H
20 #define OPENXCOM_CRAFTINFOSTATE_H
21 
22 #include "../Engine/State.h"
23 
24 namespace OpenXcom
25 {
26 
27 class Base;
28 class TextButton;
29 class Window;
30 class Text;
31 class TextEdit;
32 class Surface;
33 class Craft;
34 
35 /**
36  * Craft Info screen that shows all the
37  * info of a specific craft.
38  */
39 class CraftInfoState : public State
40 {
41 private:
42 	Base *_base;
43 	size_t _craftId;
44 	Craft *_craft;
45 	std::wstring _defaultName;
46 
47 	TextButton *_btnOk, *_btnW1, *_btnW2, *_btnCrew, *_btnEquip, *_btnArmor;
48 	Window *_window;
49 	TextEdit *_edtCraft;
50 	Text *_txtDamage, *_txtFuel;
51 	Text *_txtW1Name, *_txtW1Ammo, *_txtW2Name, *_txtW2Ammo;
52 	Surface *_sprite, *_weapon1, *_weapon2, *_crew, *_equip;
53 	/// Formats an amount of time.
54 	std::wstring formatTime(int time);
55 public:
56 	/// Creates the Craft Info state.
57 	CraftInfoState(Game *game, Base *base, size_t craftId);
58 	/// Cleans up the Craft Info state.
59 	~CraftInfoState();
60 	/// Updates the craft info.
61 	void init();
62 	/// Handler for clicking the OK button.
63 	void btnOkClick(Action *action);
64 	/// Handler for clicking the 1 button.
65 	void btnW1Click(Action *action);
66 	/// Handler for clicking the 2 button.
67 	void btnW2Click(Action *action);
68 	/// Handler for clicking the Crew button.
69 	void btnCrewClick(Action *action);
70 	/// Handler for clicking the Equipment button.
71 	void btnEquipClick(Action *action);
72 	/// Handler for clicking the Armor button.
73 	void btnArmorClick(Action *action);
74 	/// Handler for changing the text on the Name edit.
75 	void edtCraftChange(Action *action);
76 };
77 
78 }
79 
80 #endif
81