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_OPTIONSVIDEOSTATE_H
20 #define OPENXCOM_OPTIONSVIDEOSTATE_H
21 
22 #include "../Engine/State.h"
23 #include "OptionsBaseState.h"
24 #include <SDL.h>
25 
26 namespace OpenXcom
27 {
28 
29 class TextButton;
30 class ToggleTextButton;
31 class Text;
32 class TextEdit;
33 class ArrowButton;
34 class ComboBox;
35 class InteractiveSurface;
36 
37 /**
38  * Screen that lets the user configure various
39  * Video options.
40  */
41 class OptionsVideoState : public OptionsBaseState
42 {
43 private:
44 	static const std::string GL_EXT, GL_FOLDER, GL_STRING;
45 
46 	InteractiveSurface *_displaySurface;
47 	Text *_txtDisplayResolution, *_txtDisplayX;
48 	TextEdit *_txtDisplayWidth, *_txtDisplayHeight;
49 	ArrowButton *_btnDisplayResolutionUp, *_btnDisplayResolutionDown;
50 
51 	Text *_txtLanguage, *_txtFilter, *_txtGeoScale, *_txtBattleScale;
52 	ComboBox *_cbxLanguage, *_cbxFilter, *_cbxDisplayMode, *_cbxGeoScale, *_cbxBattleScale;
53 	Text *_txtMode;
54 	Text *_txtOptions;
55 	ToggleTextButton *_btnLetterbox, *_btnLockMouse;
56 
57 	SDL_Rect** _res;
58 	int _resAmount, _resCurrent;
59 	std::vector<std::string> _langs, _filters;
60 
61 	void updateDisplayResolution();
62 public:
63 	/// Creates the Options state.
64 	OptionsVideoState(Game *game, OptionsOrigin origin);
65 	/// Cleans up the Options state.
66 	~OptionsVideoState();
67 	/// Handler for clicking the Next Resolution button.
68 	void btnDisplayResolutionUpClick(Action *action);
69 	/// Handler for clicking the Previous Resolution button.
70 	void btnDisplayResolutionDownClick(Action *action);
71 	/// Handler for changing the Display Width text.
72 	void txtDisplayWidthChange(Action *action);
73 	/// Handler for changing the Display Height text.
74 	void txtDisplayHeightChange(Action *action);
75 	/// Handler for changing the Language combobox.
76 	void cbxLanguageChange(Action *action);
77     /// Handler for changing the Filter combobox.
78     void cbxFilterChange(Action *action);
79 	/// Handler for clicking the Display Mode combobox.
80 	void updateDisplayMode(Action *action);
81 	/// Handler for clicking the Letterboxed button.
82 	void btnLetterboxClick(Action *action);
83 	/// Handler for clicking the Lock Mouse button.
84 	void btnLockMouseClick(Action *action);
85 	/// Handler for updating the selected battlescape scale.
86 	void updateBattlescapeScale(Action *action);
87 	/// Handler for updating the selected geoscape scale.
88 	void updateGeoscapeScale(Action *action);
89 	/// Update the resolution settings, we just resized the window.
90 	void resize(int &, int &);
91 	/// Handles keypresses.
92 	void handle(Action *action);
93 };
94 
95 }
96 
97 #endif
98