OpenXcom  1.0
Open-source clone of the original X-Com
ManageAlienContainmentState.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 #include "../Menu/OptionsBaseState.h"
22 #include <vector>
23 #include <string>
24 
25 namespace OpenXcom
26 {
27 
28 class TextButton;
29 class Window;
30 class Text;
31 class TextList;
32 class Timer;
33 class Base;
34 
40 {
41 private:
42  Base *_base;
43  OptionsOrigin _origin;
44  TextButton *_btnOk, *_btnCancel;
45  Window *_window;
46  Text *_txtTitle, *_txtUsed, *_txtAvailable, *_txtItem, *_txtLiveAliens, *_txtDeadAliens, *_txtInterrogatedAliens;
47  TextList *_lstAliens;
48  Timer *_timerInc, *_timerDec;
49  std::vector<int> _qtys;
50  std::vector<std::string> _aliens;
51  size_t _sel;
52  int _aliensSold;
54  int getQuantity();
55 public:
57  ManageAlienContainmentState(Base *base, OptionsOrigin origin);
61  void think();
63  void btnOkClick(Action *action);
65  void btnCancelClick(Action *action);
67  void lstItemsLeftArrowPress(Action *action);
69  void lstItemsLeftArrowRelease(Action *action);
71  void lstItemsLeftArrowClick(Action *action);
73  void lstItemsRightArrowPress(Action *action);
75  void lstItemsRightArrowRelease(Action *action);
77  void lstItemsRightArrowClick(Action *action);
79  void lstItemsMousePress(Action *action);
81  void increase();
83  void increaseByValue(int change);
85  void decrease();
87  void decreaseByValue(int change);
89  void updateStrings();
90 };
91 
92 }
void btnOkClick(Action *action)
Handler for clicking the OK button.
Definition: ManageAlienContainmentState.cpp:211
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
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
void increaseByValue(int change)
Increases the quantity of an alien by the given value.
Definition: ManageAlienContainmentState.cpp:386
void lstItemsLeftArrowRelease(Action *action)
Handler for releasing an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:310
List of Text&#39;s split into columns.
Definition: TextList.h:40
ManageAlienContainment screen that lets the player manage alien numbers in a particular base...
Definition: ManageAlienContainmentState.h:39
Text string displayed on screen.
Definition: Text.h:40
void updateStrings()
Updates the quantity-strings of the selected alien.
Definition: ManageAlienContainmentState.cpp:423
void lstItemsRightArrowClick(Action *action)
Handler for clicking a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:285
void think()
Runs the timers.
Definition: ManageAlienContainmentState.cpp:199
void btnCancelClick(Action *action)
Handler for clicking the Cancel button.
Definition: ManageAlienContainmentState.cpp:253
void lstItemsRightArrowRelease(Action *action)
Handler for releasing a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:272
void decrease()
Decreases the quantity of an alien by one.
Definition: ManageAlienContainmentState.cpp:400
void lstItemsLeftArrowClick(Action *action)
Handler for clicking an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:323
Represents a player base on the globe.
Definition: Base.h:45
ManageAlienContainmentState(Base *base, OptionsOrigin origin)
Creates the ManageAlienContainment state.
Definition: ManageAlienContainmentState.cpp:53
Coloured button with a text label.
Definition: TextButton.h:38
~ManageAlienContainmentState()
Cleans up the ManageAlienContainment state.
Definition: ManageAlienContainmentState.cpp:190
void lstItemsMousePress(Action *action)
Handler for pressing-down a mouse-button in the list.
Definition: ManageAlienContainmentState.cpp:338
void increase()
Increases the quantity of an alien by one.
Definition: ManageAlienContainmentState.cpp:375
void decreaseByValue(int change)
Decreases the quantity of an alien by the given value.
Definition: ManageAlienContainmentState.cpp:411
void lstItemsLeftArrowPress(Action *action)
Handler for pressing an Increase arrow in the list.
Definition: ManageAlienContainmentState.cpp:300
void lstItemsRightArrowPress(Action *action)
Handler for pressing a Decrease arrow in the list.
Definition: ManageAlienContainmentState.cpp:262
Definition: BaseInfoState.cpp:40