summaryrefslogtreecommitdiff
path: root/src/gui/charselectdialog.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-12-06 13:01:16 -0700
committerJared Adams <jaxad0127@gmail.com>2009-12-06 13:01:16 -0700
commitfc48c24c6d366e165cbcfbd022d9421790089890 (patch)
treeed264bca67ac2380f787765980ba1897ab43a93a /src/gui/charselectdialog.cpp
parentc0e6ef1dd4941d689ea723542c4218179d688c7f (diff)
downloadmana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.gz
mana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.bz2
mana-fc48c24c6d366e165cbcfbd022d9421790089890.tar.xz
mana-fc48c24c6d366e165cbcfbd022d9421790089890.zip
Improve keyboard accessibility of login sequence
Enter and Escape now move forward and backwards for all dialogs except ServerSelectDialog (Escape quits) and CharSelectDialog (Enter doesn't do anything special).
Diffstat (limited to 'src/gui/charselectdialog.cpp')
-rw-r--r--src/gui/charselectdialog.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 43537ca3..4f3619ae 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -34,6 +34,7 @@
#include "gui/confirmdialog.h"
#include "gui/okdialog.h"
#include "gui/playerbox.h"
+#include "gui/sdlinput.h"
#include "gui/unregisterdialog.h"
#include "game.h"
@@ -162,6 +163,8 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo,
reflowLayout();
+ addKeyListener(this);
+
center();
mCharEntries[0]->requestFocus();
setVisible(true);
@@ -217,6 +220,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
}
}
+void CharSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ action(gcn::ActionEvent(NULL, mSwitchLoginButton->getActionEventId()));
+ }
+}
+
void CharSelectDialog::attemptCharDelete()
{
mCharHandler->deleteCharacter(mCharInfo->getPos(), mCharInfo->getEntry());