CharSpells::CharSpells(CharGenChoices &choices, Console *console) : CharGenBase(console) { _choices = &choices; load("cg_spells"); _currentSpellLevel = SIZE_MAX; _abilityLimit = 0; _spellHelp = new CharHelp("cg_spellinfo", console); // TODO: Recommend button in the spell selection for the character generator. getWidget("RecommendButton", true)->setDisabled(true); // TODO: Reset button in the spell selection for the character generator. getWidget("ResetButton", true)->setDisabled(true); _availListBox = getListBox("AvailBox", true); _availListBox->setMode(WidgetListBox::kModeSelectable); _knownListBox = getListBox("KnownBox", true); _knownListBox->setMode(WidgetListBox::kModeSelectable); for (uint32 lvl = 0; lvl < 10; ++lvl) { WidgetButton *spellLvlButton = getButton("SpellLevel" + Common::composeString<uint32>(lvl), true); spellLvlButton->setTooltip(TalkMan.getString(68674 + lvl)); spellLvlButton->setTooltipPosition(20.f, -40.f, -100.f); // TODO: The button should be render properly when pressed. spellLvlButton->setMode(WidgetButton::kModeUnchanged); spellLvlButton->setPressed(false); } makeSpellsList(); }
void SaveLoadMenu::callbackKeyInput(const Events::Key &key, const Events::EventType &type) { if (type == Events::kEventKeyDown) { switch (key) { case Events::kKeyUp: getListBox("LB_GAMES")->selectPreviousItem(); break; case Events::kKeyDown: getListBox("LB_GAMES")->selectNextItem(); break; default: break; } } }
SaveLoadMenu::SaveLoadMenu(Module &module, ::Engines::Console *console, uint8 type, bool frontBackground) : GUI(console), _module(&module), _type(type) { load("saveload"); addBackground(kBackgroundTypeMenu, frontBackground); WidgetListBox *lbGames = getListBox("LB_GAMES"); lbGames->setPermanentHighlightEnabled(true); const std::vector<KotORWidget *> &itemWidgets = lbGames->createItemWidgets(); for (std::vector<KotORWidget *>::const_iterator it = itemWidgets.begin(); it != itemWidgets.end(); ++it) { addWidget(*it); } if (_type == kSaveLoadMenuTypeLoad) { getLabel("LBL_PANELNAME")->setText(TalkMan.getString(1585)); // Load Game getLabel("LBL_PLANETNAME")->setText(""); getLabel("LBL_AREANAME")->setText(""); getButton("BTN_SAVELOAD")->setText(TalkMan.getString(1589)); // Load } else lbGames->addItem(TalkMan.getString(1590)); addSavedGameItems(lbGames); lbGames->refreshItemWidgets(); }
void CharInfoVoice::initVoicesList() { WidgetListBox *voicesListBox = getListBox("SoundSetEdit", true); voicesListBox->lock(); voicesListBox->clear(); voicesListBox->setMode(WidgetListBox::kModeSelectable); const Aurora::TwoDAFile &twodaSoundSet = TwoDAReg.get2DA("soundset"); for (size_t it = 0; it < twodaSoundSet.getRowCount(); ++it) { const Aurora::TwoDARow &row = twodaSoundSet.getRow(it); // Take only sound set for players. if (row.getInt("TYPE") != 0) continue; // Filter by gender. if (static_cast<Gender>(row.getInt("GENDER")) != _choices->getCharacter().getGender()) continue; const Common::UString voiceName = TalkMan.getString(row.getInt("STRREF")); const Common::UString resRef = row.getString("RESREF"); WidgetListItemVoice *item = new WidgetListItemVoice(*this, voiceName, resRef, (uint16) it); voicesListBox->add(item); } voicesListBox->unlock(); voicesListBox->select(0); }
void CChangeOrderDlg::OnSelchangeEditlist() { CListBox *lb = getListBox(); int i = lb->GetCurSel(); if(i == lb->GetCount()-1) { // never select the last empty String lb->SetSel(lb->GetCount() - 1, false); } }
void CChangeOrderDlg::removeSelected(const CompactIntArray &selected) { CListBox *lb = getListBox(); for(intptr_t i = selected.size() - 1; i >= 0; i--) { m_editList.removeIndex(selected[i]); lb->DeleteString(selected[i]); } }
void CharInfoVoice::show() { CharGenBase::show(); WidgetListItemVoice *firstItem = dynamic_cast<WidgetListItemVoice *>(getListBox("SoundSetEdit", true)->getSelectedItem()); if (firstItem) playSound(firstItem->_soundSet->getSoundFile(0), Sound::kSoundTypeSFX); }
void CChangeOrderDlg::OnEditRandom() { m_editList.shuffle(); CListBox *lb = getListBox(); lb->ResetContent(); for(size_t i = 0; i < m_editList.size(); i++) { insertMediaFileIntoListBox(i,m_editList[i]); } lb->InsertString((int)m_mediaQueue.size(),EMPTYSTRING); }
void CChangeOrderDlg::insertMediaFileIntoListBox(size_t pos, const MediaFile &f) { CListBox *lb = getListBox(); String tmp = format(_T("%-38.38s%-36.36s%-36.36s") ,f.getTitle() ,f.getArtist() ,f.getAlbum() ); int ret = lb->InsertString((int)pos, tmp.cstr()); }
CharPackage::CharPackage(CharGenChoices &choices, ::Engines::Console *console) : CharGenBase(console) { _choices = &choices; load("cg_package"); //TODO Implement package recommendation. getButton("RecommendButton", true)->setDisabled(true); //TODO Implement package configuration. getButton("ConfigurePckg", true)->setDisabled(true); _packageListBox = getListBox("ClassListBox", true); }
void SaveLoadMenu::callbackActive(Widget &widget) { const Common::UString &tag = widget.getTag(); if (tag.beginsWith("LB_GAMES_ITEM")) getListBox("LB_GAMES")->onClickItemWidget(tag); else if (tag == "BTN_SAVELOAD") { int selectedIndex = getListBox("LB_GAMES")->getSelectedIndex(); if (selectedIndex == -1) return; switch (_type) { case kSaveLoadMenuTypeLoad: tryLoadGame(_saveDirs[selectedIndex]); break; case kSaveLoadMenuTypeSave: trySaveGame(selectedIndex > 0 ? _saveDirs[selectedIndex - 1] : getNewSaveDirectory()); break; default: break; } } else if (tag == "BTN_BACK") _returnCode = 1; }
ConfirmDialog::ConfirmDialog(Console *console) : KotORBase::GUI(console), _accepted(false) { load("confirm"); Odyssey::WidgetPanel *guiPanel = getPanel("TGuiPanel"); guiPanel->setPosition(-guiPanel->getWidth()/2, -guiPanel->getHeight()/2, 0); Odyssey::WidgetListBox *lbMessage = getListBox("LB_MESSAGE"); lbMessage->createItemWidgets(1); }
void CChangeOrderDlg::OnEditPaste() { CListBox *lb = getListBox(); int pos = lb->GetCurSel(); for(size_t i = 0; i < m_buffer.size(); i++) { insertMediaFile(pos,m_buffer[i]); } for(int i = 0; i < lb->GetCount(); i++) { lb->SetSel(i,false); } if(m_buffer.size() > 0) { lb->SetSel(pos); } Invalidate(); }
void CChangeOrderDlg::getSelected(CompactIntArray &selected) { CListBox *lb = getListBox(); int count = lb->GetSelCount(); int *items = new int[count]; lb->GetSelItems(count,items); selected.clear(); for(int i = 0; i < count; i++) { if(items[i] == lb->GetCount() - 1) { continue; // never select the last empty String } selected.add(items[i]); } delete[] items; }
CharDomain::CharDomain(CharGenChoices &choices, Console *console) : CharGenBase(console) { _choices = &choices; load("cg_domain"); _chosenDomains.clear(); // TODO: Recommend button in CharDomain. getButton("RecommendButton")->setDisabled(true); getButton("OkButton")->setDisabled(true); _domainListBox = getListBox("DomainListBox", true); createDomainList(); }
void OptionsGameMenu::updateDifficulty(int difficulty) { WidgetLabel &diffLabel = *getLabel("DifficultyLabel", true); WidgetListBox &diffDesc = *getListBox("DiffEdit", true); diffDesc.setText("fnt_galahad14", TalkMan.getString(67578 + difficulty), 1.0); if (difficulty == 0) diffLabel.setText(TalkMan.getString(66786)); else if (difficulty == 1) diffLabel.setText(TalkMan.getString(66788)); else if (difficulty == 2) diffLabel.setText(TalkMan.getString(66790)); else if (difficulty == 3) diffLabel.setText(TalkMan.getString(66792)); }
BOOL CChangeOrderDlg::OnInitDialog() { m_accelTable = LoadAccelerators(theApp.m_hInstance,MAKEINTRESOURCE(IDR_CHANGEORDER_ACCELERATOR)); for(size_t i = 0; i < m_mediaQueue.size(); i++) { insertMediaFile(i,m_mediaQueue[i]); } CListBox *lb = getListBox(); lb->InsertString((int)m_mediaQueue.size(),EMPTYSTRING); __super::OnInitDialog(); gotoToListBox(); if(!m_mediaQueue.isEmpty()) { lb->SetSel(0); } return false; }
void CChangeOrderDlg::OnEditCut() { CListBox *lb = getListBox(); int pos = lb->GetCurSel(); CompactIntArray selected; getSelected(selected); m_buffer.clear(); for(size_t i = 0; i < selected.size(); i++) { m_buffer.add(m_editList[selected[i]]); } removeSelected(selected); if(pos < lb->GetCount()) { lb->SetSel(pos); } else { lb->SetSel(lb->GetCount()-1); } Invalidate(); }
OptionsMenu::OptionsMenu(Console *console) : GUI(console) { load("options"); // Move this label behind the buttons. float x, y, z; getWidget("Lopt")->getPosition(x, y, z); getWidget("Lopt")->setPosition(x, y, z + 10); Engines::KotOR::WidgetListBox *optionsListBox = getListBox("OptionsListBox"); addWidget(optionsListBox->createItem("AUDIO_SETTINGS"), true); addWidget(optionsListBox->createItem("GRAPHIC_SETTINGS"), true); addWidget(optionsListBox->createItem("DIFFICULTY"), true); addWidget(optionsListBox->createItem("GAME_INFO"), true); addWidget(optionsListBox->createItem("CONTROLS"), true); addWidget(optionsListBox->createItem("CREDITS"), true); _audioOptionsButton = getButton("AUDIO_SETTINGS"); _videoOptionsButton = getButton("GRAPHIC_SETTINGS"); _difficultyOptionsButton = getButton("DIFFICULTY"); _gameInfoOptionsButton = getButton("GAME_INFO"); _controlOptionsButton = getButton("CONTROLS"); _creditsButton = getButton("CREDITS"); _backButton = getButton("ButtonBack"); _currentButton = 0; _optionsDescription = getLabel("OptionsDescLabel"); _audioOptionsDescription = TalkMan.getString(129); _videoOptionsDescription = TalkMan.getString(130); _difficultyOptionsDescription = TalkMan.getString(152); _gameInfoOptionsDescription = TalkMan.getString(153); _controlOptionsDescription = TalkMan.getString(154); _creditsDescription = TalkMan.getString(33212); _backButtonDescription = TalkMan.getString(130088); _audioOptionsButton->setText(TalkMan.getString(132)); _videoOptionsButton->setText(TalkMan.getString(133)); _difficultyOptionsButton->setText(TalkMan.getString(149)); _gameInfoOptionsButton->setText(TalkMan.getString(150)); _controlOptionsButton->setText(TalkMan.getString(151)); _creditsButton->setText(TalkMan.getString(15709)); _optionsDescription->setText(""); }
void CharInfoVoice::callbackActive(Widget& widget) { if (widget.getTag() == "OkButton") { WidgetListItemVoice *item = dynamic_cast<WidgetListItemVoice *>(getListBox("SoundSetEdit", true)->getSelectedItem()); if (!item) return; _choices->setSoundSet(item->_soundSetID); _returnCode = 2; return; } if (widget.getTag() == "CancelButton") { _returnCode = 1; return; } }
MainMenu::MainMenu(Module &module, ::Engines::Console *console) : ::Engines::KotOR::GUI(console), _module(&module), _background(0) { load("maingame"); /* * The list box is initially empty, so we need to create the buttons * for the main menu */ getListBox("ListBoxButtons")->setFill(""); addWidget(getListBox("ListBoxButtons")->createItem("NEW_GAME"), true); addWidget(getListBox("ListBoxButtons")->createItem("LOAD_GAME"), true); addWidget(getListBox("ListBoxButtons")->createItem("MINIGAMES"), true); addWidget(getListBox("ListBoxButtons")->createItem("OPTIONS"), true); addWidget(getListBox("ListBoxButtons")->createItem("CREDITS"), true); addWidget(getListBox("ListBoxButtons")->createItem("EXIT"), true); getButton("NEW_GAME")->setText(TalkMan.getString(111)); getButton("LOAD_GAME")->setText(TalkMan.getString(112)); getButton("MINIGAMES")->setText(TalkMan.getString(114)); getButton("OPTIONS")->setText(TalkMan.getString(116)); getButton("CREDITS")->setText(TalkMan.getString(15709)); getButton("EXIT")->setText(TalkMan.getString(112745)); /* * The Jade Empire Logo is placed in the middle of the screen * and needs to be moved above the menu buttons */ getLabel("TitleLabel")->setWidth(256); getLabel("TitleLabel")->setHeight(65); float tX, tY, tZ; getLabel("TitleLabel")->getPosition(tX, tY, tZ); getLabel("TitleLabel")->setPosition(tX-80, tY+52, tZ); addBackground(); }
void CChangeOrderDlg::gotoToListBox() { getListBox()->SetFocus(); }
void ConfirmDialog::setText(const Common::UString &text) { Odyssey::WidgetListBox *lbMessage = getListBox("LB_MESSAGE"); lbMessage->removeAllItems(); lbMessage->addItem(text); lbMessage->refreshItemWidgets(); }