summaryrefslogtreecommitdiff
path: root/src/gui/worldselectdialog.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/worldselectdialog.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/worldselectdialog.cpp')
-rw-r--r--src/gui/worldselectdialog.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index aef98078..0a616f25 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -26,6 +26,8 @@
#include "gui/widgets/listbox.h"
#include "gui/widgets/scrollarea.h"
+#include "gui/sdlinput.h"
+
#include "net/logindata.h"
#include "net/loginhandler.h"
#include "net/net.h"
@@ -92,6 +94,8 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds):
// Select first server
mWorldList->setSelected(0);
+ addKeyListener(this);
+
center();
setVisible(true);
mChooseWorld->requestFocus();
@@ -119,3 +123,17 @@ void WorldSelectDialog::action(const gcn::ActionEvent &event)
state = STATE_LOGIN;
}
}
+
+void WorldSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ action(gcn::ActionEvent(NULL, mChangeLoginButton->getActionEventId()));
+ }
+ else if (key.getValue() == Key::ENTER)
+ {
+ action(gcn::ActionEvent(NULL, mChooseWorld->getActionEventId()));
+ }
+}