* Initializes all the elements in the Advanced Options window. * @param game Pointer to the core game. * @param origin Game section that originated this state. */
| 39 | * @param origin Game section that originated this state. |
| 40 | */ |
| 41 | OptionsAdvancedState::OptionsAdvancedState(Game *game, OptionsOrigin origin) : OptionsBaseState(game, origin) |
| 42 | { |
| 43 | setCategory(_btnAdvanced); |
| 44 | |
| 45 | // Create objects |
| 46 | _lstOptions = new TextList(200, 136, 94, 8); |
| 47 | |
| 48 | add(_lstOptions); |
| 49 | |
| 50 | centerAllSurfaces(); |
| 51 | |
| 52 | // how much room do we need for YES/NO |
| 53 | Text text = Text(100, 9, 0, 0); |
| 54 | text.initText(_game->getResourcePack()->getFont("FONT_BIG"), _game->getResourcePack()->getFont("FONT_SMALL"), _game->getLanguage()); |
| 55 | text.setText(tr("STR_YES")); |
| 56 | int yes = text.getTextWidth(); |
| 57 | text.setText(tr("STR_NO")); |
| 58 | int no = text.getTextWidth(); |
| 59 | |
| 60 | int rightcol = std::max(yes, no) + 2; |
| 61 | int leftcol = _lstOptions->getWidth() - rightcol; |
| 62 | |
| 63 | // Set up objects |
| 64 | _lstOptions->setAlign(ALIGN_RIGHT, 1); |
| 65 | _lstOptions->setColumns(2, leftcol, rightcol); |
| 66 | _lstOptions->setColor(Palette::blockOffset(8)+10); |
| 67 | _lstOptions->setArrowColor(Palette::blockOffset(8)+5); |
| 68 | _lstOptions->setWordWrap(true); |
| 69 | _lstOptions->setSelectable(true); |
| 70 | _lstOptions->setBackground(_window); |
| 71 | _lstOptions->onMouseClick((ActionHandler)&OptionsAdvancedState::lstOptionsClick, 0); |
| 72 | _lstOptions->onMouseOver((ActionHandler)&OptionsAdvancedState::lstOptionsMouseOver); |
| 73 | _lstOptions->onMouseOut((ActionHandler)&OptionsAdvancedState::lstOptionsMouseOut); |
| 74 | |
| 75 | if (origin != OPT_BATTLESCAPE) |
| 76 | { |
| 77 | _colorGroup = Palette::blockOffset(15) - 1; |
| 78 | } |
| 79 | else |
| 80 | { |
| 81 | _colorGroup = Palette::blockOffset(1) - 1; |
| 82 | } |
| 83 | |
| 84 | const std::vector<OptionInfo> &options = Options::getOptionInfo(); |
| 85 | for (std::vector<OptionInfo>::const_iterator i = options.begin(); i != options.end(); ++i) |
| 86 | { |
| 87 | if (i->type() != OPTION_KEY && !i->description().empty()) |
| 88 | { |
| 89 | if (i->category() == "STR_GENERAL") |
| 90 | { |
| 91 | _settingsGeneral.push_back(*i); |
| 92 | } |
| 93 | else if (i->category() == "STR_GEOSCAPE") |
| 94 | { |
| 95 | _settingsGeo.push_back(*i); |
| 96 | } |
| 97 | else if (i->category() == "STR_BATTLESCAPE") |
| 98 | { |
nothing calls this directly
no test coverage detected