diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-12-06 13:01:16 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-12-06 13:01:16 -0700 |
commit | fc48c24c6d366e165cbcfbd022d9421790089890 (patch) | |
tree | ed264bca67ac2380f787765980ba1897ab43a93a /src/gui/serverdialog.cpp | |
parent | c0e6ef1dd4941d689ea723542c4218179d688c7f (diff) | |
download | mana-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/serverdialog.cpp')
-rw-r--r-- | src/gui/serverdialog.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 39c2792f..32e714c6 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -22,6 +22,7 @@ #include "gui/serverdialog.h" #include "gui/okdialog.h" +#include "gui/sdlinput.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" @@ -149,9 +150,10 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): // Make sure the list has enough height getLayout().setRowHeight(3, 80); - reflowLayout(300, 0); + addKeyListener(this); + center(); setFieldsReadOnly(true); setVisible(true); @@ -248,6 +250,20 @@ void ServerDialog::action(const gcn::ActionEvent &event) } } +void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) +{ + gcn::Key key = keyEvent.getKey(); + + if (key.getValue() == Key::ESCAPE) + { + state = STATE_EXIT; + } + else if (key.getValue() == Key::ENTER) + { + action(gcn::ActionEvent(NULL, mConnectButton->getActionEventId())); + } +} + void ServerDialog::valueChanged(const gcn::SelectionEvent &event) { const int index = mServersList->getSelected(); |