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_BUILDNEWBASESTATE_H
20 #define OPENXCOM_BUILDNEWBASESTATE_H
21 
22 #include "../Engine/State.h"
23 
24 namespace OpenXcom
25 {
26 
27 class Base;
28 class Globe;
29 class InteractiveSurface;
30 class Timer;
31 class Window;
32 class Text;
33 class TextButton;
34 
35 /**
36  * Screen that allows the player
37  * to place a new base on the globe.
38  */
39 class BuildNewBaseState : public State
40 {
41 private:
42 	Base *_base;
43 	Globe *_globe;
44 	InteractiveSurface *_btnRotateLeft, *_btnRotateRight, *_btnRotateUp, *_btnRotateDown, *_btnZoomIn, *_btnZoomOut;
45 	Window *_window;
46 	Text *_txtTitle;
47 	TextButton *_btnCancel;
48 	Timer *_hoverTimer;
49 	bool _first;
50 	bool _oldshowradar;
51 	double _oldlat,_oldlon;
52 	int _mousex, _mousey;
53 public:
54 	/// Creates the Build New Base state.
55 	BuildNewBaseState(Game *game, Base *base, Globe *globe, bool first);
56 	/// Cleans up the Build New Base state.
57 	~BuildNewBaseState();
58 	/// Resets globe.
59 	void init();
60 	/// Runs the timer.
61 	void think();
62 	/// Handles actions.
63 	void handle(Action *action);
64 	/// Handler for clicking the globe.
65 	void globeClick(Action *action);
66 	/// Handler for mouse hovering the globe.
67 	void globeHover(Action *action);
68 	/// Handler for redrawing hover (delayed)
69 	void hoverRedraw(void);
70 	/// Handler for pressing the Rotate Left arrow.
71 	void btnRotateLeftPress(Action *action);
72 	/// Handler for releasing the Rotate Left arrow.
73 	void btnRotateLeftRelease(Action *action);
74 	/// Handler for pressing the Rotate Right arrow.
75 	void btnRotateRightPress(Action *action);
76 	/// Handler for releasing the Rotate Right arrow.
77 	void btnRotateRightRelease(Action *action);
78 	/// Handler for pressing the Rotate Up arrow.
79 	void btnRotateUpPress(Action *action);
80 	/// Handler for releasing the Rotate Up arrow.
81 	void btnRotateUpRelease(Action *action);
82 	/// Handler for pressing the Rotate Down arrow.
83 	void btnRotateDownPress(Action *action);
84 	/// Handler for releasing the Rotate Down arrow.
85 	void btnRotateDownRelease(Action *action);
86 	/// Handler for left-clicking the Zoom In icon.
87 	void btnZoomInLeftClick(Action *action);
88 	/// Handler for right-clicking the Zoom In icon.
89 	void btnZoomInRightClick(Action *action);
90 	/// Handler for left-clicking the Zoom Out icon.
91 	void btnZoomOutLeftClick(Action *action);
92 	/// Handler for right-clicking the Zoom Out icon.
93 	void btnZoomOutRightClick(Action *action);
94 	/// Handler for clicking the Cancel button.
95 	void btnCancelClick(Action *action);
96 	/// Let the state know the window has been resized.
97 	void resize(int &dX, int &dY);
98 };
99 
100 }
101 
102 #endif
103