* Initializes all the elements in the Confirmation screen. * @param game Pointer to the core game. * @param origin Game section that originated this state. * @param save Name of the save file to delete. */
| 40 | * @param save Name of the save file to delete. |
| 41 | */ |
| 42 | DeleteGameState::DeleteGameState(Game *game, OptionsOrigin origin, const std::string &save) : State(game), _origin(origin) |
| 43 | { |
| 44 | _filename = Options::getUserFolder() + save; |
| 45 | _screen = false; |
| 46 | |
| 47 | // Create objects |
| 48 | _window = new Window(this, 256, 100, 32, 50, POPUP_BOTH); |
| 49 | _btnYes = new TextButton(60, 18, 60, 122); |
| 50 | _btnNo = new TextButton(60, 18, 200, 122); |
| 51 | _txtMessage = new Text(246, 32, 37, 70); |
| 52 | |
| 53 | // Set palette |
| 54 | if (_origin == OPT_BATTLESCAPE) |
| 55 | { |
| 56 | setPalette("PAL_BATTLESCAPE"); |
| 57 | } |
| 58 | else |
| 59 | { |
| 60 | setPalette("PAL_GEOSCAPE", 6); |
| 61 | } |
| 62 | |
| 63 | add(_window); |
| 64 | add(_btnYes); |
| 65 | add(_btnNo); |
| 66 | add(_txtMessage); |
| 67 | |
| 68 | centerAllSurfaces(); |
| 69 | |
| 70 | // Set up objects |
| 71 | _window->setColor(Palette::blockOffset(8)+10); |
| 72 | _window->setBackground(game->getResourcePack()->getSurface("BACK01.SCR")); |
| 73 | |
| 74 | _btnYes->setColor(Palette::blockOffset(8)+10); |
| 75 | _btnYes->setText(tr("STR_YES")); |
| 76 | _btnYes->onMouseClick((ActionHandler)&DeleteGameState::btnYesClick); |
| 77 | _btnYes->onKeyboardPress((ActionHandler)&DeleteGameState::btnYesClick, Options::keyOk); |
| 78 | |
| 79 | _btnNo->setColor(Palette::blockOffset(8)+10); |
| 80 | _btnNo->setText(tr("STR_NO")); |
| 81 | _btnNo->onMouseClick((ActionHandler)&DeleteGameState::btnNoClick); |
| 82 | _btnNo->onKeyboardPress((ActionHandler)&DeleteGameState::btnNoClick, Options::keyCancel); |
| 83 | |
| 84 | _txtMessage->setColor(Palette::blockOffset(8)+10); |
| 85 | _txtMessage->setAlign(ALIGN_CENTER); |
| 86 | _txtMessage->setBig(); |
| 87 | _txtMessage->setWordWrap(true); |
| 88 | _txtMessage->setText(tr("STR_IS_IT_OK_TO_DELETE_THE_SAVED_GAME")); |
| 89 | |
| 90 | if (_origin == OPT_BATTLESCAPE) |
| 91 | { |
| 92 | applyBattlescapeTheme(); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * |
nothing calls this directly
no test coverage detected