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_GRAPHSSTATE_H 20 #define OPENXCOM_GRAPHSSTATE_H 21 22 #include "../Engine/State.h" 23 #include <string> 24 25 namespace OpenXcom 26 { 27 28 class Surface; 29 class InteractiveSurface; 30 class Text; 31 class TextButton; 32 class ToggleTextButton; 33 class TextList; 34 class Region; 35 struct GraphButInfo; 36 37 /** 38 * Graphs screen for displaying graphs of various 39 * monthly game data like activity and funding. 40 */ 41 class GraphsState : public State 42 { 43 private: 44 InteractiveSurface *_bg; 45 InteractiveSurface *_btnGeoscape; 46 InteractiveSurface *_btnXcomCountry, *_btnUfoCountry; 47 InteractiveSurface *_btnXcomRegion, *_btnUfoRegion; 48 InteractiveSurface *_btnIncome, *_btnFinance; 49 Text *_txtTitle, *_txtFactor; 50 TextList *_txtMonths, *_txtYears; 51 std::vector<Text *> _txtScale; 52 std::vector<ToggleTextButton *> _btnRegions, _btnCountries, _btnFinances; 53 std::vector<GraphButInfo *> _regionToggles, _countryToggles; 54 std::vector<bool> _financeToggles; 55 ToggleTextButton *_btnRegionTotal, *_btnCountryTotal; 56 std::vector<Surface *> _alienRegionLines, _alienCountryLines; 57 std::vector<Surface *> _xcomRegionLines, _xcomCountryLines; 58 std::vector<Surface *> _financeLines, _incomeLines; 59 bool _alien, _income, _country, _finance; 60 static const size_t GRAPH_MAX_BUTTONS=16; 61 //will be only between 0 and size() 62 size_t _butRegionsOffset, _butCountriesOffset; 63 //scroll and repaint buttons functions 64 void scrollButtons(std::vector<GraphButInfo *> &toggles, std::vector<ToggleTextButton *> &buttons, size_t &offset, int step); 65 void updateButton(GraphButInfo *from,ToggleTextButton *to); 66 public: 67 /// Creates the Graphs state. 68 GraphsState(Game *game); 69 /// Cleans up the Graphs state. 70 ~GraphsState(); 71 /// Handler for clicking the Geoscape icon. 72 void btnGeoscapeClick(Action *action); 73 /// Handler for clicking the ufo region icon. 74 void btnUfoRegionClick(Action *action); 75 /// Handler for clicking the ufo country icon. 76 void btnUfoCountryClick(Action *action); 77 /// Handler for clicking the xcom region icon. 78 void btnXcomRegionClick(Action *action); 79 /// Handler for clicking the xcom country icon. 80 void btnXcomCountryClick(Action *action); 81 /// Handler for clicking the income icon. 82 void btnIncomeClick(Action *action); 83 /// Handler for clicking the finance icon. 84 void btnFinanceClick(Action *action); 85 /// Handler for clicking on a region button. 86 void btnRegionListClick(Action *action); 87 /// Handler for clicking on a country button. 88 void btnCountryListClick(Action *action); 89 /// Handler for clicking on a finances button. 90 void btnFinanceListClick(Action *action); 91 /// Mouse wheel handler for shifting up/down the buttons 92 void shiftButtons(Action *action); 93 /// Reset all the elements on screen. 94 void resetScreen(); 95 /// Update the scale 96 void updateScale(double lowerLimit, double upperLimit); 97 /// Decide which lines to draw 98 void drawLines(); 99 /// Draw Region Lines. 100 void drawRegionLines(); 101 /// Draw Country Lines. 102 void drawCountryLines(); 103 /// Draw Finances Lines. 104 void drawFinanceLines(); 105 /// Scroll button lists 106 }; 107 108 } 109 110 #endif 111