OpenXcom  1.0
Open-source clone of the original X-Com
GraphsState.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "../Engine/State.h"
21 
22 namespace OpenXcom
23 {
24 
25 class Surface;
26 class InteractiveSurface;
27 class Text;
28 class TextButton;
29 class ToggleTextButton;
30 class TextList;
31 class Region;
32 struct GraphButInfo;
33 
38 class GraphsState : public State
39 {
40 private:
41  InteractiveSurface *_bg;
42  InteractiveSurface *_btnGeoscape;
43  InteractiveSurface *_btnXcomCountry, *_btnUfoCountry;
44  InteractiveSurface *_btnXcomRegion, *_btnUfoRegion;
45  InteractiveSurface *_btnIncome, *_btnFinance;
46  Text *_txtTitle, *_txtFactor;
47  TextList *_txtMonths, *_txtYears;
48  std::vector<Text *> _txtScale;
49  std::vector<ToggleTextButton *> _btnRegions, _btnCountries, _btnFinances;
50  std::vector<GraphButInfo *> _regionToggles, _countryToggles;
51  std::vector<bool> _financeToggles;
52  ToggleTextButton *_btnRegionTotal, *_btnCountryTotal;
53  std::vector<Surface *> _alienRegionLines, _alienCountryLines;
54  std::vector<Surface *> _xcomRegionLines, _xcomCountryLines;
55  std::vector<Surface *> _financeLines, _incomeLines;
56  bool _alien, _income, _country, _finance;
57  static const size_t GRAPH_MAX_BUTTONS=16;
58  //will be only between 0 and size()
59  size_t _butRegionsOffset, _butCountriesOffset;
60  //scroll and repaint buttons functions
61  void scrollButtons(std::vector<GraphButInfo *> &toggles, std::vector<ToggleTextButton *> &buttons, size_t &offset, int step);
62  void updateButton(GraphButInfo *from,ToggleTextButton *to);
63 public:
65  GraphsState();
67  ~GraphsState();
69  void btnGeoscapeClick(Action *action);
71  void btnUfoRegionClick(Action *action);
73  void btnUfoCountryClick(Action *action);
75  void btnXcomRegionClick(Action *action);
77  void btnXcomCountryClick(Action *action);
79  void btnIncomeClick(Action *action);
81  void btnFinanceClick(Action *action);
83  void btnRegionListClick(Action *action);
85  void btnCountryListClick(Action *action);
87  void btnFinanceListClick(Action *action);
89  void shiftButtons(Action *action);
91  void resetScreen();
93  void updateScale(double lowerLimit, double upperLimit);
95  void drawLines();
97  void drawRegionLines();
99  void drawCountryLines();
101  void drawFinanceLines();
103 };
104 
105 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void btnCountryListClick(Action *action)
Handler for clicking on a country button.
Definition: GraphsState.cpp:506
void btnRegionListClick(Action *action)
Handler for clicking on a region button.
Definition: GraphsState.cpp:476
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:390
GraphsState()
Creates the Graphs state.
Definition: GraphsState.cpp:56
void drawCountryLines()
Draw Country Lines.
Definition: GraphsState.cpp:648
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
~GraphsState()
Cleans up the Graphs state.
Definition: GraphsState.cpp:311
List of Text&#39;s split into columns.
Definition: TextList.h:40
Definition: ToggleTextButton.h:27
void btnUfoRegionClick(Action *action)
Handler for clicking the ufo region icon.
Definition: GraphsState.cpp:348
Text string displayed on screen.
Definition: Text.h:40
void btnFinanceListClick(Action *action)
Handler for clicking on a finances button.
Definition: GraphsState.cpp:536
void btnGeoscapeClick(Action *action)
Handler for clicking the Geoscape icon.
Definition: GraphsState.cpp:339
void btnUfoCountryClick(Action *action)
Handler for clicking the ufo country icon.
Definition: GraphsState.cpp:369
void btnXcomCountryClick(Action *action)
Handler for clicking the xcom country icon.
Definition: GraphsState.cpp:411
void btnFinanceClick(Action *action)
Handler for clicking the finance icon.
Definition: GraphsState.cpp:454
void drawFinanceLines()
Draw Finances Lines.
Definition: GraphsState.cpp:974
void updateScale(double lowerLimit, double upperLimit)
Update the scale.
Definition: GraphsState.cpp:610
void shiftButtons(Action *action)
Mouse wheel handler for shifting up/down the buttons.
Definition: GraphsState.cpp:1119
void btnIncomeClick(Action *action)
Handler for clicking the income icon.
Definition: GraphsState.cpp:432
void drawRegionLines()
Draw Region Lines.
Definition: GraphsState.cpp:825
void resetScreen()
Reset all the elements on screen.
Definition: GraphsState.cpp:559
void drawLines()
Decide which lines to draw.
Definition: GraphsState.cpp:628
Definition: BaseInfoState.cpp:40
Definition: GraphsState.cpp:45
Graphs screen for displaying graphs of various monthly game data like activity and funding...
Definition: GraphsState.h:38