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

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

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

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

@ -56,9 +56,24 @@ namespace MWGui
if (visible) if (visible)
updateMenu(); updateMenu();
showBackground( bool isMainMenu =
MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) && MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu) &&
MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame); 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); Layout::setVisible (visible);
} }
@ -231,7 +246,8 @@ namespace MWGui
buttons.push_back("exitgame"); buttons.push_back("exitgame");
// Create new buttons if needed // 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()) if (mButtons.find(*it) == mButtons.end())
{ {

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

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

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

@ -48,6 +48,10 @@
<Property key="TextAlign" value="Center"/> <Property key="TextAlign" value="Center"/>
</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 type="HBox" position="0 60 566 24" align="Right Bottom"> <Widget type="HBox" position="0 60 566 24" align="Right Bottom">
<Widget type="Widget"> <Widget type="Widget">
<UserString key="HStretch" value="true"/> <UserString key="HStretch" value="true"/>
@ -60,9 +64,6 @@
</Widget> </Widget>
</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>
</Widget> </Widget>

Loading…
Cancel
Save