OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GraphsState.h
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 
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:
68  GraphsState(Game *game);
70  ~GraphsState();
72  void btnGeoscapeClick(Action *action);
74  void btnUfoRegionClick(Action *action);
76  void btnUfoCountryClick(Action *action);
78  void btnXcomRegionClick(Action *action);
80  void btnXcomCountryClick(Action *action);
82  void btnIncomeClick(Action *action);
84  void btnFinanceClick(Action *action);
86  void btnRegionListClick(Action *action);
88  void btnCountryListClick(Action *action);
90  void btnFinanceListClick(Action *action);
92  void shiftButtons(Action *action);
94  void resetScreen();
96  void updateScale(double lowerLimit, double upperLimit);
98  void drawLines();
100  void drawRegionLines();
102  void drawCountryLines();
104  void drawFinanceLines();
106 };
107 
108 }
109 
110 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void btnCountryListClick(Action *action)
Handler for clicking on a country button.
Definition: GraphsState.cpp:500
void btnRegionListClick(Action *action)
Handler for clicking on a region button.
Definition: GraphsState.cpp:477
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void btnXcomRegionClick(Action *action)
Handler for clicking the xcom region icon.
Definition: GraphsState.cpp:391
void drawCountryLines()
Draw Country Lines.
Definition: GraphsState.cpp:626
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
~GraphsState()
Cleans up the Graphs state.
Definition: GraphsState.cpp:312
List of Text's split into columns.
Definition: TextList.h:42
Definition: ToggleTextButton.h:31
void btnUfoRegionClick(Action *action)
Handler for clicking the ufo region icon.
Definition: GraphsState.cpp:349
Text string displayed on screen.
Definition: Text.h:41
void btnFinanceListClick(Action *action)
Handler for clicking on a finances button.
Definition: GraphsState.cpp:523
void btnGeoscapeClick(Action *action)
Handler for clicking the Geoscape icon.
Definition: GraphsState.cpp:340
void btnUfoCountryClick(Action *action)
Handler for clicking the ufo country icon.
Definition: GraphsState.cpp:370
void btnXcomCountryClick(Action *action)
Handler for clicking the xcom country icon.
Definition: GraphsState.cpp:412
void btnFinanceClick(Action *action)
Handler for clicking the finance icon.
Definition: GraphsState.cpp:455
void drawFinanceLines()
Draw Finances Lines.
Definition: GraphsState.cpp:955
void updateScale(double lowerLimit, double upperLimit)
Update the scale.
Definition: GraphsState.cpp:588
void shiftButtons(Action *action)
Mouse wheel handler for shifting up/down the buttons.
Definition: GraphsState.cpp:1099
void btnIncomeClick(Action *action)
Handler for clicking the income icon.
Definition: GraphsState.cpp:433
GraphsState(Game *game)
Creates the Graphs state.
Definition: GraphsState.cpp:55
void drawRegionLines()
Draw Region Lines.
Definition: GraphsState.cpp:805
void resetScreen()
Reset all the elements on screen.
Definition: GraphsState.cpp:537
void drawLines()
Decide which lines to draw.
Definition: GraphsState.cpp:606
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
Definition: GraphsState.cpp:44
Graphs screen for displaying graphs of various monthly game data like activity and funding...
Definition: GraphsState.h:41