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

Method OptionsConfirmState

src/Menu/OptionsConfirmState.cpp:41–101  ·  view source on GitHub ↗

* Initializes all the elements in the Confirm Display Options screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. */

Source from the content-addressed store, hash-verified

39 * @param origin Game section that originated this state.
40 */
41OptionsConfirmState::OptionsConfirmState(Game *game, OptionsOrigin origin) : State(game), _origin(origin), _countdown(15)
42{
43 _screen = false;
44
45 // Create objects
46 _window = new Window(this, 216, 100, 52, 50, POPUP_BOTH);
47 _btnYes = new TextButton(50, 20, 70, 120);
48 _btnNo = new TextButton(50, 20, 200, 120);
49 _txtTitle = new Text(206, 20, 57, 70);
50 _txtTimer = new Text(206, 20, 57, 100);
51 _timer = new Timer(1000);
52
53 // Set palette
54 if (_origin == OPT_BATTLESCAPE)
55 {
56 setPalette("PAL_BATTLESCAPE");
57 }
58 else
59 {
60 setPalette("PAL_GEOSCAPE", 0);
61 }
62
63 add(_window);
64 add(_btnYes);
65 add(_btnNo);
66 add(_txtTitle);
67 add(_txtTimer);
68
69 centerAllSurfaces();
70
71 // Set up objects
72 _window->setColor(Palette::blockOffset(15)-1);
73 _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
74
75 _btnYes->setColor(Palette::blockOffset(15)-1);
76 _btnYes->setText(tr("STR_YES"));
77 _btnYes->onMouseClick((ActionHandler)&OptionsConfirmState::btnYesClick);
78
79 _btnNo->setColor(Palette::blockOffset(15)-1);
80 _btnNo->setText(tr("STR_NO"));
81 _btnNo->onMouseClick((ActionHandler)&OptionsConfirmState::btnNoClick);
82 // no keyboard shortcuts to make sure users can see the message
83
84 _txtTitle->setColor(Palette::blockOffset(15)-1);
85 _txtTitle->setAlign(ALIGN_CENTER);
86 _txtTitle->setWordWrap(true);
87 _txtTitle->setText(tr("STR_DISPLAY_OPTIONS_CONFIRM"));
88
89 _txtTimer->setColor(Palette::blockOffset(15)-1);
90 _txtTimer->setAlign(ALIGN_CENTER);
91 _txtTimer->setWordWrap(true);
92 _txtTimer->setText(tr("STR_DISPLAY_OPTIONS_REVERT").arg(_countdown));
93
94 if (_origin == OPT_BATTLESCAPE)
95 {
96 applyBattlescapeTheme();
97 }
98

Callers

nothing calls this directly

Calls 11

onMouseClickMethod · 0.80
onTimerMethod · 0.80
argMethod · 0.60
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setAlignMethod · 0.45
setWordWrapMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected