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

Method ListGamesState

src/Menu/ListGamesState.cpp:87–171  ·  view source on GitHub ↗

* Initializes all the elements in the Saved Game screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. * @param firstValidRow First row containing saves. * @param autoquick Show auto/quick saved games? */

Source from the content-addressed store, hash-verified

85 * @param autoquick Show auto/quick saved games?
86 */
87ListGamesState::ListGamesState(Game *game, OptionsOrigin origin, int firstValidRow, bool autoquick) : State(game), _origin(origin), _showMsg(true), _noUI(false), _firstValidRow(firstValidRow), _autoquick(autoquick), _sortable(true)
88{
89 _screen = false;
90
91 // Create objects
92 _window = new Window(this, 320, 200, 0, 0, POPUP_BOTH);
93 _btnCancel = new TextButton(80, 16, 120, 172);
94 _txtTitle = new Text(310, 17, 5, 7);
95 _txtDelete = new Text(310, 9, 5, 23);
96 _txtName = new Text(150, 9, 16, 32);
97 _txtDate = new Text(110, 9, 204, 32);
98 _lstSaves = new TextList(288, 112, 8, 42);
99 _txtDetails = new Text(288, 16, 16, 156);
100 _sortName = new ArrowButton(ARROW_NONE, 11, 8, 16, 32);
101 _sortDate = new ArrowButton(ARROW_NONE, 11, 8, 204, 32);
102
103 // Set palette
104 if (_origin == OPT_BATTLESCAPE)
105 {
106 setPalette("PAL_BATTLESCAPE");
107 }
108 else
109 {
110 setPalette("PAL_GEOSCAPE", 6);
111 }
112
113 add(_window);
114 add(_btnCancel);
115 add(_txtTitle);
116 add(_txtDelete);
117 add(_txtName);
118 add(_txtDate);
119 add(_lstSaves);
120 add(_txtDetails);
121 add(_sortName);
122 add(_sortDate);
123
124 // Set up objects
125 _window->setColor(Palette::blockOffset(8)+5);
126 _window->setBackground(game->getResourcePack()->getSurface("BACK01.SCR"));
127
128 _btnCancel->setColor(Palette::blockOffset(8)+5);
129 _btnCancel->setText(tr("STR_CANCEL_UC"));
130 _btnCancel->onMouseClick((ActionHandler)&ListGamesState::btnCancelClick);
131 _btnCancel->onKeyboardPress((ActionHandler)&ListGamesState::btnCancelClick, Options::keyCancel);
132
133 _txtTitle->setColor(Palette::blockOffset(15)-1);
134 _txtTitle->setBig();
135 _txtTitle->setAlign(ALIGN_CENTER);
136
137 _txtDelete->setColor(Palette::blockOffset(15)-1);
138 _txtDelete->setAlign(ALIGN_CENTER);
139 _txtDelete->setText(tr("STR_RIGHT_CLICK_TO_DELETE"));
140
141 _txtName->setColor(Palette::blockOffset(15)-1);
142 _txtName->setText(tr("STR_NAME"));
143
144 _txtDate->setColor(Palette::blockOffset(15)-1);

Callers

nothing calls this directly

Calls 15

onMouseClickMethod · 0.80
onKeyboardPressMethod · 0.80
setColumnsMethod · 0.80
setMarginMethod · 0.80
onMouseOverMethod · 0.80
onMouseOutMethod · 0.80
onMousePressMethod · 0.80
getTextWidthMethod · 0.80
argMethod · 0.60
setColorMethod · 0.45
setBackgroundMethod · 0.45
getSurfaceMethod · 0.45

Tested by

no test coverage detected