xref: /haiku/src/apps/drivesetup/MainWindow.h (revision f75a7bf508f3156d63a14f8fd77c5e0ca4d08c42)
1 /*
2  * Copyright 2002-2008 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT license.
4  *
5  * Authors:
6  *		Ithamar R. Adema <ithamar@unet.nl>
7  *		Stephan Aßmus <superstippi@gmx.de>
8  */
9 #ifndef MAIN_WINDOW_H
10 #define MAIN_WINDOW_H
11 
12 
13 #include <DiskDeviceRoster.h>
14 #include <Window.h>
15 
16 #include "Support.h"
17 
18 
19 class BDiskDevice;
20 class BPartition;
21 class BMenu;
22 class BMenuItem;
23 class DiskView;
24 class PartitionListView;
25 
26 
27 enum {
28 	MSG_SELECTED_PARTITION_ID	= 'spid'
29 };
30 
31 
32 class MainWindow : public BWindow {
33 public:
34 								MainWindow(BRect frame);
35 	virtual						~MainWindow();
36 
37 	// BWindow interface
38 	virtual	bool				QuitRequested();
39 	virtual	void				MessageReceived(BMessage* message);
40 
41 	// MainWindow
42 			status_t			StoreSettings(BMessage* archive) const;
43 			status_t			RestoreSettings(BMessage* archive);
44 
45 private:
46 			void				_ScanDrives();
47 			void				_ScanFileSystems();
48 
49 			void				_AdaptToSelectedPartition();
50 			void				_SetToDiskAndPartition(partition_id diskID,
51 									partition_id partitionID,
52 									partition_id parentID);
53 			void				_EnabledDisableMenuItems(BDiskDevice* disk,
54 									partition_id selectedPartition,
55 									partition_id parentID);
56 
57 			void				_DisplayPartitionError(BString message,
58 									const BPartition* partition = NULL,
59 									status_t error = B_OK) const;
60 
61 			void				_Mount(BDiskDevice* disk,
62 									partition_id selectedPartition);
63 			void				_Unmount(BDiskDevice* disk,
64 									partition_id selectedPartition);
65 			void				_MountAll();
66 
67 			void				_Initialize(BDiskDevice* disk,
68 									partition_id selectedPartition,
69 									const BString& diskSystemName);
70 
71 
72 			BDiskDeviceRoster	fDDRoster;
73 			BDiskDevice*		fCurrentDisk;
74 			partition_id		fCurrentPartitionID;
75 
76 			PartitionListView*	fListView;
77 			DiskView*			fDiskView;
78 
79 			SpaceIDMap			fSpaceIDMap;
80 
81 			BMenu*				fDiskMenu;
82 			BMenu*				fPartitionMenu;
83 			BMenu*				fInitMenu;
84 			BMenu*				fCreateMenu;
85 
86 			BMenuItem*			fFormatMI;
87 			BMenuItem*			fEjectMI;
88 			BMenuItem*			fSurfaceTestMI;
89 			BMenuItem*			fRescanMI;
90 
91 			BMenuItem*			fDeleteMI;
92 			BMenuItem*			fMountMI;
93 			BMenuItem*			fUnmountMI;
94 			BMenuItem*			fMountAllMI;
95 };
96 
97 
98 #endif // MAIN_WINDOW_H
99