OpenXcom  1.0
Open-source clone of the original X-Com
ResearchInfoState.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 TextButton;
26 class Window;
27 class Text;
28 class Base;
29 class RuleResearch;
30 class ResearchProject;
31 class ArrowButton;
32 class Timer;
33 class InteractiveSurface;
34 
38 class ResearchInfoState : public State
39 {
40 private:
41  Base *_base;
42  TextButton *_btnOk;
43  TextButton *_btnCancel;
44  ArrowButton *_btnMore, *_btnLess;
45  Window *_window;
46  Text *_txtTitle, *_txtAvailableScientist, *_txtAvailableSpace, *_txtAllocatedScientist, *_txtMore, *_txtLess;
47  void setAssignedScientist();
48  ResearchProject *_project;
49  RuleResearch *_rule;
50  void buildUi();
51  Timer *_timerMore, *_timerLess;
52  InteractiveSurface *_surfaceScientists;
53 public:
55  ResearchInfoState(Base *base, RuleResearch *rule);
56  ResearchInfoState(Base *base, ResearchProject *project);
60  void btnOkClick(Action *action);
62  void btnCancelClick(Action *action);
64  void more();
66  void moreByValue(int change);
68  void less();
70  void lessByValue(int change);
72  void handleWheel(Action *action);
74  void morePress(Action *action);
76  void moreRelease(Action *action);
78  void moreClick(Action *action);
80  void lessPress(Action *action);
82  void lessRelease(Action *action);
84  void lessClick(Action *action);
86  void think();
87 };
88 
89 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void moreRelease(Action *action)
Handler for releasing the More button.
Definition: ResearchInfoState.cpp:219
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Box with a coloured border and custom background.
Definition: Window.h:40
Timer used to run code in fixed intervals.
Definition: Timer.h:35
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
void lessClick(Action *action)
Handler for clicking the Less button.
Definition: ResearchInfoState.cpp:268
void morePress(Action *action)
Handler for pressing the More button.
Definition: ResearchInfoState.cpp:210
Text string displayed on screen.
Definition: Text.h:40
Window which allows changing of the number of assigned scientist to a project.
Definition: ResearchInfoState.h:38
Represent a ResearchProject Contain information about assigned scientist, time already spent and cost...
Definition: ResearchProject.h:32
ResearchInfoState(Base *base, RuleResearch *rule)
Creates the ResearchProject state.
Definition: ResearchInfoState.cpp:46
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: ResearchInfoState.cpp:180
void lessByValue(int change)
Remove the given number of scientists from the project if possible.
Definition: ResearchInfoState.cpp:316
void handleWheel(Action *action)
Handler for using the mouse wheel.
Definition: ResearchInfoState.cpp:200
void more()
Function called every time the _timerMore timer is triggered.
Definition: ResearchInfoState.cpp:279
void lessRelease(Action *action)
Handler for releasing the Less button.
Definition: ResearchInfoState.cpp:254
void moreByValue(int change)
Add given number of scientists to the project if possible.
Definition: ResearchInfoState.cpp:289
void moreClick(Action *action)
Handler for clicking the More button.
Definition: ResearchInfoState.cpp:233
void lessPress(Action *action)
Handler for pressing the Less button.
Definition: ResearchInfoState.cpp:245
Represents a player base on the globe.
Definition: Base.h:45
Coloured button with a text label.
Definition: TextButton.h:38
Represents one research project.
Definition: RuleResearch.h:38
Button with an arrow on it.
Definition: ArrowButton.h:35
void less()
Function called every time the _timerLess timer is triggered.
Definition: ResearchInfoState.cpp:306
void think()
Runs state functionality every cycle(used to update the timer).
Definition: ResearchInfoState.cpp:332
~ResearchInfoState()
Cleans up the ResearchInfo state.
Definition: ResearchInfoState.cpp:160
Definition: BaseInfoState.cpp:40
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: ResearchInfoState.cpp:170