MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / ConfirmDestinationState

Method ConfirmDestinationState

src/Geoscape/ConfirmDestinationState.cpp:45–100  ·  view source on GitHub ↗

* Initializes all the elements in the Confirm Destination window. * @param game Pointer to the core game. * @param craft Pointer to the craft to retarget. * @param target Pointer to the selected target (NULL if it's just a point on the globe). */

Source from the content-addressed store, hash-verified

43 * @param target Pointer to the selected target (NULL if it's just a point on the globe).
44 */
45ConfirmDestinationState::ConfirmDestinationState(Game *game, Craft *craft, Target *target) : State(game), _craft(craft), _target(target)
46{
47 Waypoint *w = dynamic_cast<Waypoint*>(_target);
48 _screen = false;
49
50 // Create objects
51 _window = new Window(this, 224, 72, 16, 64);
52 _btnOk = new TextButton(50, 12, 68, 104);
53 _btnCancel = new TextButton(50, 12, 138, 104);
54 _txtTarget = new Text(212, 32, 22, 72);
55
56 // Set palette
57 if (w != 0 && w->getId() == 0)
58 {
59 setPalette("PAL_GEOSCAPE", 6);
60 }
61 else
62 {
63 setPalette("PAL_GEOSCAPE", 4);
64 }
65
66 add(_window);
67 add(_btnOk);
68 add(_btnCancel);
69 add(_txtTarget);
70
71 centerAllSurfaces();
72
73 // Set up objects
74 _window->setColor(Palette::blockOffset(15)-1);
75 _window->setBackground(_game->getResourcePack()->getSurface("BACK12.SCR"));
76
77 _btnOk->setColor(Palette::blockOffset(8)+5);
78 _btnOk->setText(tr("STR_OK"));
79 _btnOk->onMouseClick((ActionHandler)&ConfirmDestinationState::btnOkClick);
80 _btnOk->onKeyboardPress((ActionHandler)&ConfirmDestinationState::btnOkClick, Options::keyOk);
81
82 _btnCancel->setColor(Palette::blockOffset(8)+5);
83 _btnCancel->setText(tr("STR_CANCEL_UC"));
84 _btnCancel->onMouseClick((ActionHandler)&ConfirmDestinationState::btnCancelClick);
85 _btnCancel->onKeyboardPress((ActionHandler)&ConfirmDestinationState::btnCancelClick, Options::keyCancel);
86
87 _txtTarget->setColor(Palette::blockOffset(15)-1);
88 _txtTarget->setBig();
89 _txtTarget->setAlign(ALIGN_CENTER);
90 _txtTarget->setVerticalAlign(ALIGN_MIDDLE);
91 _txtTarget->setWordWrap(true);
92 if (w != 0 && w->getId() == 0)
93 {
94 _txtTarget->setText(tr("STR_TARGET").arg(tr("STR_WAY_POINT")));
95 }
96 else
97 {
98 _txtTarget->setText(tr("STR_TARGET").arg(_target->getName(_game->getLanguage())));
99 }
100}
101
102/**

Callers

nothing calls this directly

Calls 15

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
getLanguageMethod · 0.80
argMethod · 0.60
getIdMethod · 0.45
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setBigMethod · 0.45
setAlignMethod · 0.45

Tested by

no test coverage detected