* Initializes all the elements in the Confirm Transfer window. * @param game Pointer to the core game. * @param base Pointer to the destination base. * @param state Pointer to the Transfer state. */
| 38 | * @param state Pointer to the Transfer state. |
| 39 | */ |
| 40 | TransferConfirmState::TransferConfirmState(Game *game, Base *base, TransferItemsState *state) : State(game), _base(base), _state(state) |
| 41 | { |
| 42 | _screen = false; |
| 43 | |
| 44 | // Create objects |
| 45 | _window = new Window(this, 320, 80, 0, 60); |
| 46 | _btnCancel = new TextButton(128, 16, 176, 115); |
| 47 | _btnOk = new TextButton(128, 16, 16, 115); |
| 48 | _txtTitle = new Text(310, 17, 5, 75); |
| 49 | _txtCost = new Text(60, 17, 110, 95); |
| 50 | _txtTotal = new Text(100, 17, 170, 95); |
| 51 | |
| 52 | // Set palette |
| 53 | setPalette("PAL_BASESCAPE", 6); |
| 54 | |
| 55 | add(_window); |
| 56 | add(_btnCancel); |
| 57 | add(_btnOk); |
| 58 | add(_txtTitle); |
| 59 | add(_txtCost); |
| 60 | add(_txtTotal); |
| 61 | |
| 62 | centerAllSurfaces(); |
| 63 | |
| 64 | // Set up objects |
| 65 | _window->setColor(Palette::blockOffset(13)+5); |
| 66 | _window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR")); |
| 67 | |
| 68 | _btnCancel->setColor(Palette::blockOffset(15)+6); |
| 69 | _btnCancel->setText(tr("STR_CANCEL_UC")); |
| 70 | _btnCancel->onMouseClick((ActionHandler)&TransferConfirmState::btnCancelClick); |
| 71 | _btnCancel->onKeyboardPress((ActionHandler)&TransferConfirmState::btnCancelClick, Options::keyCancel); |
| 72 | |
| 73 | _btnOk->setColor(Palette::blockOffset(15)+6); |
| 74 | _btnOk->setText(tr("STR_OK")); |
| 75 | _btnOk->onMouseClick((ActionHandler)&TransferConfirmState::btnOkClick); |
| 76 | _btnOk->onKeyboardPress((ActionHandler)&TransferConfirmState::btnOkClick, Options::keyOk); |
| 77 | |
| 78 | _txtTitle->setColor(Palette::blockOffset(13)+10); |
| 79 | _txtTitle->setBig(); |
| 80 | _txtTitle->setAlign(ALIGN_CENTER); |
| 81 | _txtTitle->setText(tr("STR_TRANSFER_ITEMS_TO").arg(_base->getName())); |
| 82 | |
| 83 | _txtCost->setColor(Palette::blockOffset(13)+10); |
| 84 | _txtCost->setBig(); |
| 85 | _txtCost->setText(tr("STR_COST")); |
| 86 | |
| 87 | _txtTotal->setColor(Palette::blockOffset(15)+1); |
| 88 | _txtTotal->setBig(); |
| 89 | _txtTotal->setText(Text::formatFunding(_state->getTotal())); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * |
nothing calls this directly
no test coverage detected