OpenXcom  1.0
Open-source clone of the original X-Com
ManageAlienContainmentState.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_MANAGEALIENCONTAINMENTSTATE_H
20 #define OPENXCOM_MANAGEALIENCONTAINMENTSTATE_H
21 
22 #include "../Engine/State.h"
23 #include "../Menu/OptionsBaseState.h"
24 #include <vector>
25 #include <string>
26 
27 namespace OpenXcom
28 {
29 
30 class TextButton;
31 class Window;
32 class Text;
33 class TextList;
34 class Timer;
35 class Base;
36 
42 {
43 private:
44  Base *_base;
45  OptionsOrigin _origin;
46  TextButton *_btnOk, *_btnCancel;
47  Window *_window;
48  Text *_txtTitle, *_txtUsed, *_txtAvailable, *_txtItem, *_txtLiveAliens, *_txtDeadAliens;
49  TextList *_lstAliens;
50  Timer *_timerInc, *_timerDec;
51  std::vector<int> _qtys;
52  std::vector<std::string> _aliens;
53  size_t _sel;
54  int _aliensSold, _researchedAliens;
55  bool _overCrowded;
56  Uint8 _color, _color2;
58  int getQuantity();
59 public:
61  ManageAlienContainmentState(Game *game, Base *base, OptionsOrigin origin);
65  void think();
67  void btnOkClick(Action *action);
69  void btnCancelClick(Action *action);
71  void lstItemsLeftArrowPress(Action *action);
73  void lstItemsLeftArrowRelease(Action *action);
75  void lstItemsLeftArrowClick(Action *action);
77  void lstItemsRightArrowPress(Action *action);
79  void lstItemsRightArrowRelease(Action *action);
81  void lstItemsRightArrowClick(Action *action);
83  void lstItemsMousePress(Action *action);
85  void increase();
87  void increaseByValue(int change);
89  void decrease();
91  void decreaseByValue(int change);
93  void updateStrings();
94 };
95 
96 }
97 
98 #endif
OpenXcom
COPYING:
Definition: BaseInfoState.cpp:41
OpenXcom::ManageAlienContainmentState::lstItemsLeftArrowRelease
void lstItemsLeftArrowRelease(Action *action)
Handler for releasing an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:310
OpenXcom::ManageAlienContainmentState::think
void think()
Runs the timers.
Definition: ManageAlienContainmentState.cpp:199
OpenXcom::ManageAlienContainmentState::~ManageAlienContainmentState
~ManageAlienContainmentState()
Cleans up the ManageAlienContainment state.
Definition: ManageAlienContainmentState.cpp:190
OpenXcom::TextButton
Coloured button with a text label.
Definition: TextButton.h:41
OpenXcom::ManageAlienContainmentState::ManageAlienContainmentState
ManageAlienContainmentState(Game *game, Base *base, OptionsOrigin origin)
Creates the ManageAlienContainment state.
Definition: ManageAlienContainmentState.cpp:54
OpenXcom::ManageAlienContainmentState::btnCancelClick
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: ManageAlienContainmentState.cpp:253
OpenXcom::Base
Represents a player base on the globe.
Definition: Base.h:48
OpenXcom::TextList
List of Text's split into columns.
Definition: TextList.h:43
OpenXcom::Action
Container for all the information associated with a given user action, like mouse clicks,...
Definition: Action.h:35
OpenXcom::ManageAlienContainmentState
ManageAlienContainment screen that lets the player manage alien numbers in a particular base.
Definition: ManageAlienContainmentState.h:42
OpenXcom::ManageAlienContainmentState::decrease
void decrease()
Decreases the quantity of an alien by one.
Definition: ManageAlienContainmentState.cpp:400
OpenXcom::ManageAlienContainmentState::btnOkClick
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: ManageAlienContainmentState.cpp:211
OpenXcom::ManageAlienContainmentState::increaseByValue
void increaseByValue(int change)
Increases the quantity of an alien by the given value.
Definition: ManageAlienContainmentState.cpp:386
OpenXcom::ManageAlienContainmentState::lstItemsRightArrowPress
void lstItemsRightArrowPress(Action *action)
Handler for pressing a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:262
OpenXcom::ManageAlienContainmentState::lstItemsLeftArrowPress
void lstItemsLeftArrowPress(Action *action)
Handler for pressing an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:300
OpenXcom::Text
Text string displayed on screen.
Definition: Text.h:42
OpenXcom::ManageAlienContainmentState::lstItemsMousePress
void lstItemsMousePress(Action *action)
Handler for pressing-down a mouse-button in the list.
Definition: ManageAlienContainmentState.cpp:338
OpenXcom::ManageAlienContainmentState::lstItemsLeftArrowClick
void lstItemsLeftArrowClick(Action *action)
Handler for clicking an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:323
OpenXcom::ManageAlienContainmentState::decreaseByValue
void decreaseByValue(int change)
Decreases the quantity of an alien by the given value.
Definition: ManageAlienContainmentState.cpp:411
OpenXcom::ManageAlienContainmentState::lstItemsRightArrowClick
void lstItemsRightArrowClick(Action *action)
Handler for clicking a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:285
OpenXcom::State
A game state that receives user input and reacts accordingly.
Definition: State.h:45
OpenXcom::Window
Box with a coloured border and custom background.
Definition: Window.h:43
OpenXcom::Timer
Timer used to run code in fixed intervals.
Definition: Timer.h:38
OpenXcom::Game
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:45
OpenXcom::ManageAlienContainmentState::updateStrings
void updateStrings()
Updates the quantity-strings of the selected alien.
Definition: ManageAlienContainmentState.cpp:423
OpenXcom::ManageAlienContainmentState::increase
void increase()
Increases the quantity of an alien by one.
Definition: ManageAlienContainmentState.cpp:375
OpenXcom::ManageAlienContainmentState::lstItemsRightArrowRelease
void lstItemsRightArrowRelease(Action *action)
Handler for releasing a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:272