* Initializes all the elements in the Target Info window. * @param game Pointer to the core game. * @param target Pointer to the target to show info from. * @param globe Pointer to the Geoscape globe. */
| 38 | * @param globe Pointer to the Geoscape globe. |
| 39 | */ |
| 40 | TargetInfoState::TargetInfoState(Game *game, Target *target, Globe *globe) : State(game), _target(target), _globe(globe) |
| 41 | { |
| 42 | _screen = false; |
| 43 | |
| 44 | // Create objects |
| 45 | _window = new Window(this, 192, 120, 32, 40, POPUP_BOTH); |
| 46 | _btnIntercept = new TextButton(160, 12, 48, 124); |
| 47 | _btnOk = new TextButton(160, 12, 48, 140); |
| 48 | _txtTitle = new Text(182, 32, 37, 46); |
| 49 | _txtTargetted = new Text(182, 9, 37, 78); |
| 50 | _txtFollowers = new Text(182, 40, 37, 88); |
| 51 | |
| 52 | // Set palette |
| 53 | setPalette("PAL_GEOSCAPE", 0); |
| 54 | |
| 55 | add(_window); |
| 56 | add(_btnIntercept); |
| 57 | add(_btnOk); |
| 58 | add(_txtTitle); |
| 59 | add(_txtTargetted); |
| 60 | add(_txtFollowers); |
| 61 | |
| 62 | centerAllSurfaces(); |
| 63 | |
| 64 | // Set up objects |
| 65 | _window->setColor(Palette::blockOffset(8)+10); |
| 66 | _window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR")); |
| 67 | |
| 68 | _btnIntercept->setColor(Palette::blockOffset(8)+5); |
| 69 | _btnIntercept->setText(tr("STR_INTERCEPT")); |
| 70 | _btnIntercept->onMouseClick((ActionHandler)&TargetInfoState::btnInterceptClick); |
| 71 | |
| 72 | _btnOk->setColor(Palette::blockOffset(8)+5); |
| 73 | _btnOk->setText(tr("STR_OK")); |
| 74 | _btnOk->onMouseClick((ActionHandler)&TargetInfoState::btnOkClick); |
| 75 | _btnOk->onKeyboardPress((ActionHandler)&TargetInfoState::btnOkClick, Options::keyCancel); |
| 76 | |
| 77 | _txtTitle->setColor(Palette::blockOffset(8)+10); |
| 78 | _txtTitle->setBig(); |
| 79 | _txtTitle->setAlign(ALIGN_CENTER); |
| 80 | _txtTitle->setVerticalAlign(ALIGN_MIDDLE); |
| 81 | _txtTitle->setWordWrap(true); |
| 82 | _txtTitle->setText(_target->getName(_game->getLanguage())); |
| 83 | |
| 84 | _txtTargetted->setColor(Palette::blockOffset(15)-1); |
| 85 | _txtTargetted->setAlign(ALIGN_CENTER); |
| 86 | _txtTargetted->setText(tr("STR_TARGETTED_BY")); |
| 87 | |
| 88 | _txtFollowers->setColor(Palette::blockOffset(15)-1); |
| 89 | _txtFollowers->setAlign(ALIGN_CENTER); |
| 90 | std::wostringstream ss; |
| 91 | for (std::vector<Target*>::iterator i = _target->getFollowers()->begin(); i != _target->getFollowers()->end(); ++i) |
| 92 | { |
| 93 | ss << (*i)->getName(_game->getLanguage()) << L'\n'; |
| 94 | } |
| 95 | _txtFollowers->setText(ss.str()); |
| 96 | } |
| 97 |
nothing calls this directly
no test coverage detected