xref: /haiku/src/apps/drivesetup/MainWindow.h (revision e7c8829c5d8e5d34a2a1e111f1c06aceff256013)
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 
48 			void				_AdaptToSelectedPartition();
49 			void				_SetToDiskAndPartition(partition_id diskID,
50 									partition_id partitionID,
51 									partition_id parentID);
52 			void				_UpdateMenus(BDiskDevice* disk,
53 									partition_id selectedPartition,
54 									partition_id parentID);
55 
56 			void				_DisplayPartitionError(BString message,
57 									const BPartition* partition = NULL,
58 									status_t error = B_OK) const;
59 
60 			void				_Mount(BDiskDevice* disk,
61 									partition_id selectedPartition);
62 			void				_Unmount(BDiskDevice* disk,
63 									partition_id selectedPartition);
64 			void				_MountAll();
65 
66 			void				_Initialize(BDiskDevice* disk,
67 									partition_id selectedPartition,
68 									const BString& diskSystemName);
69 			void				_Create(BDiskDevice* disk,
70 									partition_id selectedPartition,
71 									const BString& partitionType);
72 
73 
74 			BDiskDeviceRoster	fDDRoster;
75 			BDiskDevice*		fCurrentDisk;
76 			partition_id		fCurrentPartitionID;
77 
78 			PartitionListView*	fListView;
79 			DiskView*			fDiskView;
80 
81 			SpaceIDMap			fSpaceIDMap;
82 
83 			BMenu*				fDiskMenu;
84 			BMenu*				fPartitionMenu;
85 			BMenu*				fInitMenu;
86 			BMenu*				fCreateMenu;
87 
88 			BMenuItem*			fFormatMI;
89 			BMenuItem*			fEjectMI;
90 			BMenuItem*			fSurfaceTestMI;
91 			BMenuItem*			fRescanMI;
92 
93 			BMenuItem*			fDeleteMI;
94 			BMenuItem*			fMountMI;
95 			BMenuItem*			fUnmountMI;
96 			BMenuItem*			fMountAllMI;
97 };
98 
99 
100 #endif // MAIN_WINDOW_H
101