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

Method BaseNameState

src/Geoscape/BaseNameState.cpp:43–87  ·  view source on GitHub ↗

* Initializes all the elements in a Base Name window. * @param game Pointer to the core game. * @param base Pointer to the base to name. * @param globe Pointer to the Geoscape globe. * @param first Is this the first base in the game? */

Source from the content-addressed store, hash-verified

41 * @param first Is this the first base in the game?
42 */
43BaseNameState::BaseNameState(Game *game, Base *base, Globe *globe, bool first) : State(game), _base(base), _globe(globe), _first(first)
44{
45 _globe->onMouseOver(0);
46
47 _screen = false;
48
49 // Create objects
50 _window = new Window(this, 192, 80, 32, 60, POPUP_BOTH);
51 _btnOk = new TextButton(162, 12, 47, 118);
52 _txtTitle = new Text(182, 17, 37, 70);
53 _edtName = new TextEdit(this, 127, 16, 59, 94);
54
55 // Set palette
56 setPalette("PAL_GEOSCAPE", 0);
57
58 add(_window);
59 add(_btnOk);
60 add(_txtTitle);
61 add(_edtName);
62
63 centerAllSurfaces();
64
65 // Set up objects
66 _window->setColor(Palette::blockOffset(8)+5);
67 _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));
68
69 _btnOk->setColor(Palette::blockOffset(8)+5);
70 _btnOk->setText(tr("STR_OK"));
71 _btnOk->onMouseClick((ActionHandler)&BaseNameState::btnOkClick);
72 //_btnOk->onKeyboardPress((ActionHandler)&BaseNameState::btnOkClick, Options::keyOk);
73 _btnOk->onKeyboardPress((ActionHandler)&BaseNameState::btnOkClick, Options::keyCancel);
74
75 //something must be in the name before it is acceptable
76 _btnOk->setVisible(false);
77
78 _txtTitle->setColor(Palette::blockOffset(8)+5);
79 _txtTitle->setAlign(ALIGN_CENTER);
80 _txtTitle->setBig();
81 _txtTitle->setText(tr("STR_BASE_NAME"));
82
83 _edtName->setColor(Palette::blockOffset(8)+5);
84 _edtName->setBig();
85 _edtName->setFocus(true, false);
86 _edtName->onChange((ActionHandler)&BaseNameState::edtNameChange);
87}
88
89/**
90 *

Callers

nothing calls this directly

Calls 13

onMouseOverMethod · 0.80
onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45
getResourcePackMethod · 0.45
setTextMethod · 0.45
setVisibleMethod · 0.45
setAlignMethod · 0.45
setBigMethod · 0.45
setFocusMethod · 0.45

Tested by

no test coverage detected