forked from OpenXcom/OpenXcom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewPossibleManufactureState.cpp
More file actions
103 lines (92 loc) · 3.45 KB
/
Copy pathNewPossibleManufactureState.cpp
File metadata and controls
103 lines (92 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
* Copyright 2010-2016 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#include "NewPossibleManufactureState.h"
#include "../Engine/Game.h"
#include "../Engine/LocalizedText.h"
#include "../Mod/Mod.h"
#include "../Interface/TextButton.h"
#include "../Interface/Window.h"
#include "../Interface/Text.h"
#include "../Interface/TextList.h"
#include "../Mod/RuleManufacture.h"
#include "../Basescape/ManufactureState.h"
#include "../Engine/Options.h"
namespace OpenXcom
{
/**
* Initializes all the elements in the EndManufacture screen.
* @param game Pointer to the core game.
* @param base Pointer to the base to get info from.
* @param possibilities List of newly possible ManufactureProject
*/
NewPossibleManufactureState::NewPossibleManufactureState(Base * base, const std::vector<RuleManufacture *> & possibilities) : _base(base)
{
_screen = false;
// Create objects
_window = new Window(this, 288, 180, 16, 10);
_btnOk = new TextButton(160, 14, 80, 149);
_btnManufacture = new TextButton(160, 14, 80, 165);
_txtTitle = new Text(288, 40, 16, 20);
_lstPossibilities = new TextList(250, 80, 35, 50);
// Set palette
setInterface("geoManufacture");
add(_window, "window", "geoManufacture");
add(_btnOk, "button", "geoManufacture");
add(_btnManufacture, "button", "geoManufacture");
add(_txtTitle, "text1", "geoManufacture");
add(_lstPossibilities, "text2", "geoManufacture");
centerAllSurfaces();
// Set up objects
_window->setBackground(_game->getMod()->getSurface("BACK17.SCR"));
_btnOk->setText(tr("STR_OK"));
_btnOk->onMouseClick((ActionHandler)&NewPossibleManufactureState::btnOkClick);
_btnOk->onKeyboardPress((ActionHandler)&NewPossibleManufactureState::btnOkClick, Options::keyCancel);
_btnManufacture->setText(tr("STR_ALLOCATE_MANUFACTURE"));
_btnManufacture->onMouseClick((ActionHandler)&NewPossibleManufactureState::btnManufactureClick);
_btnManufacture->onKeyboardPress((ActionHandler)&NewPossibleManufactureState::btnManufactureClick, Options::keyOk);
_txtTitle->setBig();
_txtTitle->setAlign(ALIGN_CENTER);
_txtTitle->setText(tr("STR_WE_CAN_NOW_PRODUCE"));
_lstPossibilities->setColumns(1, 250);
_lstPossibilities->setBig();
_lstPossibilities->setAlign(ALIGN_CENTER);
_lstPossibilities->setScrolling(true, 0);
for (std::vector<RuleManufacture *>::const_iterator iter = possibilities.begin(); iter != possibilities.end(); ++iter)
{
_lstPossibilities->addRow (1, tr((*iter)->getName()).c_str());
}
}
/**
* return to the previous screen
* @param action Pointer to an action.
*/
void NewPossibleManufactureState::btnOkClick(Action *)
{
_game->popState();
}
/**
* Open the ManufactureState so the player can dispatch available scientist.
* @param action Pointer to an action.
*/
void NewPossibleManufactureState::btnManufactureClick(Action *)
{
_game->popState();
_game->pushState (new ManufactureState(_base));
}
}