Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-15 20:33:15 +0000
committerStijn Buys <ingar@osirion.org>2008-10-15 20:33:15 +0000
commit1e0df536c2fae85c317ce9c3cc17603d5f98c911 (patch)
tree3ab262d51451cda3e926e9581b294f08d39031d9 /src/ui/ui.cc
parent97fca172fd51270cebd5b722f861a6c753bd4d2a (diff)
moved client console into a Widget
Diffstat (limited to 'src/ui/ui.cc')
-rw-r--r--src/ui/ui.cc37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index 2cadd8b..baedd38 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -381,13 +381,12 @@ void UI::show_menu(const char *label)
} else {
menu->clear_previous();
}
- ui_active_menu = menu;
- ui_active_menu->event_resize();
- ui_active_menu->raise();
- ui_active_menu->show();
- ui_active_menu->set_focus();
ui_mouse_focus = this;
ui_input_focus = this;
+
+ ui_active_menu = menu;
+ ui_active_menu->event_resize();
+ ui_active_menu->show();
} else {
con_warn << "Unknown window '" << label << "'" << std::endl;
}
@@ -436,20 +435,22 @@ void UI::input_mouse(const float x, const float y)
ui_mouse_focus = f;
}
-void UI::input_key(const bool pressed, const int key, const unsigned int modifier)
+bool UI::input_key(const bool pressed, const int key, const unsigned int modifier)
{
+ bool handled = false;
if (key < 512) {
// keyboard keys
Widget *f = find_input_focus();
if (f) {
- f->event_key(pressed, key, modifier);
+ handled = f->event_key(pressed, key, modifier);
}
ui_input_focus = f;
} else {
// mosue buttons
if (ui_mouse_focus)
- ui_mouse_focus->event_key(pressed, key, modifier);
+ handled = ui_mouse_focus->event_key(pressed, key, modifier);
}
+ return handled;
}
/* -- event handlers ----------------------------------------------- */
@@ -459,12 +460,28 @@ void UI::input_key(const bool pressed, const int key, const unsigned int modifie
*/
bool UI::on_keypress(const int key, const unsigned int modifier)
{
- return true;
+ switch( key ) {
+
+ case SDLK_ESCAPE:
+ if (active()) {
+ previous_menu();
+ } else {
+ if (core::application()->connected()) {
+ show_menu("game");
+ }
+ }
+ return true;
+ break;
+ default:
+ break;
+ }
+
+ return false;
}
bool UI::on_keyrelease(const int key, const unsigned int modifier)
{
- return true;
+ return false;
}
}