diff options
author | Stijn Buys <ingar@osirion.org> | 2008-10-11 09:37:23 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-10-11 09:37:23 +0000 |
commit | 0d831968949b1119db48530a86c2d1651c6cbfc6 (patch) | |
tree | 925e02481149fa8ac227017af74818176b166a41 /src/ui/ui.cc | |
parent | 02fcd22d8cde355aa898a8c6bb4773d9434b8e9a (diff) |
zonechange events, menu previous command
Diffstat (limited to 'src/ui/ui.cc')
-rw-r--r-- | src/ui/ui.cc | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/ui/ui.cc b/src/ui/ui.cc index bba9ea6..8242381 100644 --- a/src/ui/ui.cc +++ b/src/ui/ui.cc @@ -89,9 +89,11 @@ void help_menu() con_print << "^Bmenu functions" << std::endl; con_print << " menu help show this help" << std::endl; con_print << " menu list list available menus" << std::endl; - con_print << " menu hide hide the current menu" << std::endl; - con_print << " menu close close the current menu" << std::endl; con_print << " menu [name] show a menu" << std::endl; + con_print << " menu back return to the previous menu" << std::endl; + con_print << " menu previous return to the previous menu" << std::endl; + con_print << " menu close close the current menu" << std::endl; + con_print << " menu hide hide the current menu" << std::endl; root()->list_menus(); } @@ -117,6 +119,12 @@ void func_menu(std::string const &args) } else if (command.compare("close") == 0) { root()->hide_window(); + } else if (command.compare("back") == 0) { + root()->previous_window(); + + } else if (command.compare("previous") == 0) { + root()->previous_window(); + } else if (command.compare("list") == 0) { root()->list_menus(); } else { @@ -345,8 +353,12 @@ void UI::show_window(const char *label) Window *window = find_window(label); if (window) { - if (ui_active_window) + if (ui_active_window) { ui_active_window->hide(); + window->set_previous(ui_active_window); + } else { + window->clear_previous(); + } ui_active_window = window; ui_active_window->event_resize(); ui_active_window->raise(); @@ -365,6 +377,17 @@ void UI::hide_window() } } +void UI::previous_window() +{ + if (ui_active_window) { + if (ui_active_window->previous().size()) { + show_window(ui_active_window->previous().c_str()); + } else { + hide_window(); + } + } +} + void UI::frame() { ui_focus = event_focus(mouse_cursor); |