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_MANUFACTUREINFOSTATE_H
20 #define OPENXCOM_MANUFACTUREINFOSTATE_H
21 
22 #include "../Engine/State.h"
23 
24 namespace OpenXcom
25 {
26 class Base;
27 class Window;
28 class Text;
29 class ArrowButton;
30 class TextButton;
31 class ToggleTextButton;
32 class RuleManufacture;
33 class Production;
34 class Timer;
35 class InteractiveSurface;
36 
37 /**
38  * Screen that allows changing of Production settings (assigned engineer, units to build).
39 */
40 class ManufactureInfoState : public State
41 {
42 private:
43 	Base * _base;
44 	RuleManufacture * _item;
45 	Production * _production;
46 	Window * _window;
47 	ArrowButton * _btnUnitUp, * _btnUnitDown, * _btnEngineerUp, * _btnEngineerDown;
48 	TextButton * _btnStop, * _btnOk;
49 	Text * _txtTitle, * _txtAvailableEngineer, * _txtAvailableSpace, * _txtAllocatedEngineer, * _txtUnitToProduce, * _txtUnitUp, * _txtUnitDown, * _txtEngineerUp, * _txtEngineerDown, * _txtAllocated, * _txtTodo;
50 	ToggleTextButton *_btnSell;
51 	Timer * _timerMoreEngineer, * _timerMoreUnit, * _timerLessEngineer, * _timerLessUnit;
52 	InteractiveSurface *_surfaceEngineers, *_surfaceUnits;
53 	/// Handler for the Stop button.
54 	void btnStopClick (Action * action);
55 	/// Handler for the OK button.
56 	void btnOkClick (Action * action);
57 	/// Adds given number of engineers to the project if possible.
58 	void moreEngineer(int change);
59 	/// Handler for pressing the more engineer button.
60 	void moreEngineerPress(Action * action);
61 	/// Handler for releasing the more engineer button.
62 	void moreEngineerRelease(Action * action);
63 	/// Handler for clicking the more engineer button.
64 	void moreEngineerClick(Action * action);
65 	/// Adds given number of units to produce to the project if possible.
66 	void moreUnit(int change);
67 	/// Handler for pressing the more unit button.
68 	void moreUnitPress(Action * action);
69 	/// Handler for releasing the more unit button.
70 	void moreUnitRelease(Action * action);
71 	/// Handler for clicking the more unit button.
72 	void moreUnitClick(Action * action);
73 	/// Removes the given number of engineers from the project if possible.
74 	void lessEngineer(int change);
75 	/// Handler for pressing the less engineer button.
76 	void lessEngineerPress(Action * action);
77 	/// Handler for releasing the less engineer button.
78 	void lessEngineerRelease(Action * action);
79 	/// Handler for clicking the less engineer button.
80 	void lessEngineerClick(Action * action);
81 	/// Removes the given number of units to produce from the project if possible.
82 	void lessUnit(int change);
83 	/// Handler for pressing the less unit button.
84 	void lessUnitPress(Action * action);
85 	/// Handler for releasing the less unit button.
86 	void lessUnitRelease(Action * action);
87 	/// Handler for clicking the less unit button.
88 	void lessUnitClick(Action * action);
89 	/// Adds one engineer to the production (if possible).
90 	void onMoreEngineer();
91 	/// Removes one engineer from the production (if possible).
92 	void onLessEngineer();
93 	/// Handler for using the mouse wheel on the Engineer-part of the screen.
94 	void handleWheelEngineer(Action *action);
95 	/// Increases count of number of units to make.
96 	void onMoreUnit();
97 	/// Decreases count of number of units to make (if possible).
98 	void onLessUnit();
99 	/// Handler for using the mouse wheel on the Unit-part of the screen.
100 	void handleWheelUnit(Action *action);
101 	/// Updates display of assigned/available engineers and workshop space.
102 	void setAssignedEngineer();
103 	/// Runs state functionality every cycle.
104 	void think();
105 	/// Builds the User Interface.
106 	void buildUi();
107 	/// Helper to exit the State.
108 	void exitState();
109 public:
110 	/// Creates the State (new production).
111 	ManufactureInfoState (Game * game, Base * base, RuleManufacture * _item);
112 	/// Creates the State (modify production).
113 	ManufactureInfoState (Game * game, Base * base, Production * production);
114 };
115 }
116 #endif
117