From 0d831968949b1119db48530a86c2d1651c6cbfc6 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 11 Oct 2008 09:37:23 +0000 Subject: zonechange events, menu previous command --- src/ui/ui.cc | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/ui/ui.cc') 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); -- cgit v1.2.3