xref: /haiku/src/apps/bootmanager/BootMenu.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2008-2011, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer <laplace@users.sourceforge.net>
7  */
8 #ifndef BOOT_MENU_H
9 #define BOOT_MENU_H
10 
11 
12 #include <File.h>
13 #include <Message.h>
14 #include <ObjectList.h>
15 
16 
17 class BootDrive;
18 
19 
20 /*	Setting BMessage Format:
21 
22 	"partition" array of BMessage:
23 		"show" bool (flag if entry should be added to boot menu)
24 		"name" String (the name as shown in boot menu)
25 		"type" String (short name of file system: bfs, dos)
26 		"path" String (path to partition in /dev/...)
27 		"size" long (size of partition in bytes)
28 */
29 
30 
31 class BootMenu {
32 public:
33 								BootMenu() {}
34 	virtual						~BootMenu() {}
35 
36 	virtual	bool				IsInstalled(const BootDrive& drive) = 0;
37 	virtual	status_t			CanBeInstalled(const BootDrive& drive) = 0;
38 
39 	virtual	status_t			CollectPartitions(const BootDrive& drive,
40 									BMessage& settings) = 0;
41 
42 	virtual	status_t			Install(const BootDrive& drive,
43 									BMessage& settings) = 0;
44 	virtual	status_t			SaveMasterBootRecord(BMessage* settings,
45 									BFile* file) = 0;
46 	virtual	status_t			RestoreMasterBootRecord(BMessage* settings,
47 									BFile* file) = 0;
48 
49 	// Converts the specified text into a text as it will be shown
50 	// in the boot menu.
51 	virtual	status_t			GetDisplayText(const char* text,
52 									BString& displayText) = 0;
53 };
54 
55 typedef BObjectList<BootMenu> BootMenuList;
56 
57 
58 #endif	// BOOT_MENU_H
59