xref: /haiku/src/system/boot/platform/openfirmware/menu.cpp (revision a5061ecec55353a5f394759473f1fd6df04890da)
1 /*
2  * Copyright 2004, Axel Dörfler, axeld@pinc-software.de.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <boot/platform.h>
8 #include <boot/menu.h>
9 #include <boot/platform/generic/text_menu.h>
10 #include <platform/openfirmware/openfirmware.h>
11 
12 
13 static bool
14 of_exit_hook(Menu *menu, MenuItem *item)
15 {
16 	of_exit();
17 	return true;
18 }
19 
20 
21 void
22 platform_add_menus(Menu *menu)
23 {
24 	MenuItem* item;
25 
26 	switch (menu->Type()) {
27 		case MAIN_MENU:
28 			item = new(std::nothrow) MenuItem("Exit to OpenFirmware");
29 			if (item != NULL) {
30 				menu->AddItem(item);
31 				item->SetTarget(of_exit_hook);
32 				item->SetShortcut('q');
33 			}
34 			break;
35 		case SAFE_MODE_MENU:
36 			break;
37 		default:
38 			break;
39 	}
40 }
41 
42 
43 void
44 platform_update_menu_item(Menu *menu, MenuItem *item)
45 {
46 	platform_generic_update_text_menu_item(menu, item);
47 }
48 
49 
50 void
51 platform_run_menu(Menu *menu)
52 {
53 	platform_generic_run_text_menu(menu);
54 }
55 
56 
57 size_t
58 platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
59 	size_t bufferSize)
60 {
61 	return platform_generic_get_user_input_text(menu, item, buffer,
62 		bufferSize);
63 }
64