* Initializes all the elements in the Transfer screen. * @param game Pointer to the core game. * @param baseFrom Pointer to the source base. * @param baseTo Pointer to the destination base. */
| 56 | * @param baseTo Pointer to the destination base. |
| 57 | */ |
| 58 | TransferItemsState::TransferItemsState(Game *game, Base *baseFrom, Base *baseTo) : State(game), _baseFrom(baseFrom), _baseTo(baseTo), _baseQty(), _transferQty(), _soldiers(), _crafts(), _items(), _sel(0), _itemOffset(0), _total(0), _pQty(0), _cQty(0), _aQty(0), _iQty(0.0), _hasSci(0), _hasEng(0), _distance(0.0) |
| 59 | { |
| 60 | // Create objects |
| 61 | _window = new Window(this, 320, 200, 0, 0); |
| 62 | _btnOk = new TextButton(148, 16, 8, 176); |
| 63 | _btnCancel = new TextButton(148, 16, 164, 176); |
| 64 | _txtTitle = new Text(310, 17, 5, 8); |
| 65 | _txtItem = new Text(130, 9, 10, 24); |
| 66 | _txtQuantity = new Text(50, 9, 150, 24); |
| 67 | _txtAmountTransfer = new Text(60, 17, 200, 24); |
| 68 | _txtAmountDestination = new Text(60, 17, 260, 24); |
| 69 | _lstItems = new TextList(287, 120, 8, 44); |
| 70 | |
| 71 | // Set palette |
| 72 | setPalette("PAL_BASESCAPE", 0); |
| 73 | |
| 74 | add(_window); |
| 75 | add(_btnOk); |
| 76 | add(_btnCancel); |
| 77 | add(_txtTitle); |
| 78 | add(_txtItem); |
| 79 | add(_txtQuantity); |
| 80 | add(_txtAmountTransfer); |
| 81 | add(_txtAmountDestination); |
| 82 | add(_lstItems); |
| 83 | |
| 84 | centerAllSurfaces(); |
| 85 | |
| 86 | // Set up objects |
| 87 | _window->setColor(Palette::blockOffset(13)+10); |
| 88 | _window->setBackground(_game->getResourcePack()->getSurface("BACK13.SCR")); |
| 89 | |
| 90 | _btnOk->setColor(Palette::blockOffset(15)+6); |
| 91 | _btnOk->setText(tr("STR_TRANSFER")); |
| 92 | _btnOk->onMouseClick((ActionHandler)&TransferItemsState::btnOkClick); |
| 93 | _btnOk->onKeyboardPress((ActionHandler)&TransferItemsState::btnOkClick, Options::keyOk); |
| 94 | |
| 95 | _btnCancel->setColor(Palette::blockOffset(15)+6); |
| 96 | _btnCancel->setText(tr("STR_CANCEL")); |
| 97 | _btnCancel->onMouseClick((ActionHandler)&TransferItemsState::btnCancelClick); |
| 98 | _btnCancel->onKeyboardPress((ActionHandler)&TransferItemsState::btnCancelClick, Options::keyCancel); |
| 99 | |
| 100 | _txtTitle->setColor(Palette::blockOffset(13)+10); |
| 101 | _txtTitle->setBig(); |
| 102 | _txtTitle->setAlign(ALIGN_CENTER); |
| 103 | _txtTitle->setText(tr("STR_TRANSFER")); |
| 104 | |
| 105 | _txtItem->setColor(Palette::blockOffset(13)+10); |
| 106 | _txtItem->setText(tr("STR_ITEM")); |
| 107 | |
| 108 | _txtQuantity->setColor(Palette::blockOffset(13)+10); |
| 109 | _txtQuantity->setText(tr("STR_QUANTITY_UC")); |
| 110 | |
| 111 | _txtAmountTransfer->setColor(Palette::blockOffset(13)+10); |
| 112 | _txtAmountTransfer->setText(tr("STR_AMOUNT_TO_TRANSFER")); |
| 113 | _txtAmountTransfer->setWordWrap(true); |
| 114 | |
| 115 | _txtAmountDestination->setColor(Palette::blockOffset(13)+10); |
nothing calls this directly
no test coverage detected