Adjust some layouts to take better advantage of keyboard navigation

pull/303/head
scrawl 7 years ago
parent 1ad14b232f
commit c203a0774a

@ -139,8 +139,6 @@ namespace MWDialogue
// If the dialogue window was already open, keep the existing history
bool resetHistory = (!MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Dialogue));
win->startDialogue(actor, actor.getClass().getName (actor), resetHistory);
//greeting
const MWWorld::Store<ESM::Dialogue> &dialogs =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
@ -156,6 +154,7 @@ namespace MWDialogue
{
//initialise the GUI
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
win->startDialogue(actor, actor.getClass().getName (actor), resetHistory);
creatureStats.talkedToPlayer();

@ -3,6 +3,9 @@
#include <MyGUI_Button.h>
#include <MyGUI_EditBox.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
namespace MWGui
{
ConfirmationDialog::ConfirmationDialog() :
@ -38,6 +41,8 @@ namespace MWGui
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24);
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mOkButton);
center();
}

@ -259,9 +259,8 @@ namespace MWGui
getWidget(mTopicsList, "TopicsList");
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
MyGUI::Button* byeButton;
getWidget(byeButton, "ByeButton");
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
getWidget(mGoodbyeButton, "ByeButton");
mGoodbyeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
getWidget(mDispositionBar, "Disposition");
getWidget(mDispositionText,"DispositionText");
@ -360,6 +359,8 @@ namespace MWGui
void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory)
{
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mGoodbyeButton);
mGoodbye = false;
mEnabled = true;
bool sameActor = (mPtr == actor);
@ -528,10 +529,8 @@ namespace MWGui
onScrollbarMoved(mScrollBar, 0);
}
MyGUI::Button* byeButton;
getWidget(byeButton, "ByeButton");
bool goodbyeEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() || mGoodbye;
byeButton->setEnabled(goodbyeEnabled);
mGoodbyeButton->setEnabled(goodbyeEnabled);
bool topicsEnabled = !MWBase::Environment::get().getDialogueManager()->isInChoice() && !mGoodbye;
mTopicsList->setEnabled(topicsEnabled);

@ -169,6 +169,7 @@ namespace MWGui
MyGUI::ScrollBar* mScrollBar;
MyGUI::ProgressBar* mDispositionBar;
MyGUI::TextBox* mDispositionText;
MyGUI::Button* mGoodbyeButton;
PersuasionDialog mPersuasionDialog;

@ -56,9 +56,24 @@ namespace MWGui
if (visible)
updateMenu();
showBackground(
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame);
bool isMainMenu =
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame;
showBackground(isMainMenu);
if (visible)
{
if (isMainMenu)
{
if (mButtons["loadgame"]->getVisible())
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["loadgame"]);
else
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["newgame"]);
}
else
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mButtons["return"]);
}
Layout::setVisible (visible);
}
@ -231,7 +246,8 @@ namespace MWGui
buttons.push_back("exitgame");
// Create new buttons if needed
for (std::vector<std::string>::iterator it = buttons.begin(); it != buttons.end(); ++it)
std::vector<std::string> allButtons { "return", "newgame", "savegame", "loadgame", "options", "credits", "exitgame"};
for (std::vector<std::string>::iterator it = allButtons.begin(); it != allButtons.end(); ++it)
{
if (mButtons.find(*it) == mButtons.end())
{

@ -10,6 +10,7 @@
<Property key="Static" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="NeedKey" value="false"/>
</Widget>
<Widget type="VBox" position="0 89 352 24" align="Center Bottom">

@ -9,6 +9,7 @@
<Property key="WordWrap" value="true"/>
<Property key="MultiLine" value="1"/>
<Property key="VisibleVScroll" value="1"/>
<Property key="NeedKey" value="false"/>
</Widget>
<Widget type="Widget" skin="" position="0 0 500 400" align="Stretch" name="buttons">
</Widget>

@ -46,6 +46,7 @@
<Property key="Static" value="true"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
<Property key="NeedKey" value="false"/>
</Widget>

@ -48,6 +48,10 @@
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="0 60 60 24" name="MaxSaleButton" align="Left Top">
<Property key="Caption" value="#{sMaxSale}"/>
</Widget>
<Widget type="HBox" position="0 60 566 24" align="Right Bottom">
<Widget type="Widget">
<UserString key="HStretch" value="true"/>
@ -60,9 +64,6 @@
</Widget>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="0 60 60 24" name="MaxSaleButton" align="Left Top">
<Property key="Caption" value="#{sMaxSale}"/>
</Widget>
</Widget>
</Widget>

Loading…
Cancel
Save