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_RESEARCHINFOSTATE 20 #define OPENXCOM_RESEARCHINFOSTATE 21 22 #include "../Engine/State.h" 23 24 namespace OpenXcom 25 { 26 27 class TextButton; 28 class Window; 29 class Text; 30 class Base; 31 class RuleResearch; 32 class ResearchProject; 33 class ArrowButton; 34 class Timer; 35 class InteractiveSurface; 36 37 /** 38 * Window which allows changing of the number of assigned scientist to a project. 39 */ 40 class ResearchInfoState : public State 41 { 42 private: 43 Base *_base; 44 TextButton *_btnOk; 45 TextButton *_btnCancel; 46 ArrowButton * _btnMore, *_btnLess; 47 Window *_window; 48 Text *_txtTitle, *_txtAvailableScientist, *_txtAvailableSpace, *_txtAllocatedScientist, *_txtMore, *_txtLess; 49 void setAssignedScientist(); 50 ResearchProject * _project; 51 RuleResearch * _rule; 52 void buildUi (); 53 Timer *_timerMore, *_timerLess; 54 InteractiveSurface *_surfaceScientists; 55 public: 56 /// Creates the ResearchProject state. 57 ResearchInfoState(Game *game, Base *base, RuleResearch * rule); 58 ResearchInfoState(Game *game, Base *base, ResearchProject * project); 59 /// Handler for clicking the OK button. 60 void btnOkClick(Action *action); 61 /// Handler for clicking the Cancel button. 62 void btnCancelClick(Action *action); 63 /// Function called every time the _timerMore timer is triggered. 64 void more(); 65 /// Add given number of scientists to the project if possible 66 void moreByValue(int change); 67 /// Function called every time the _timerLess timer is triggered. 68 void less(); 69 /// Remove the given number of scientists from the project if possible 70 void lessByValue(int change); 71 /// Handler for using the mouse wheel. 72 void handleWheel(Action *action); 73 /// Handler for pressing the More button. 74 void morePress(Action *action); 75 /// Handler for releasing the More button. 76 void moreRelease(Action *action); 77 /// Handler for clicking the More button. 78 void moreClick(Action *action); 79 /// Handler for pressing the Less button. 80 void lessPress(Action *action); 81 /// Handler for releasing the Less button. 82 void lessRelease(Action *action); 83 /// Handler for clicking the Less button. 84 void lessClick(Action *action); 85 /// Runs state functionality every cycle(used to update the timer). 86 void think(); 87 }; 88 } 89 90 #endif 91