xref: /haiku/src/apps/drivesetup/MainWindow.h (revision c9ad965c81b08802fed0827fd1dd16f45297928a)
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 			void				ApplyDefaultSettings();
45 
46 private:
47 			void				_ScanDrives();
48 
49 			void				_AdaptToSelectedPartition();
50 			void				_SetToDiskAndPartition(partition_id diskID,
51 									partition_id partitionID,
52 									partition_id parentID);
53 			void				_UpdateMenus(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 			void				_Create(BDiskDevice* disk,
71 									partition_id selectedPartition);
72 			void				_Delete(BDiskDevice* disk,
73 									partition_id selectedPartition);
74 
75 
76 			BDiskDeviceRoster	fDDRoster;
77 			BDiskDevice*		fCurrentDisk;
78 			partition_id		fCurrentPartitionID;
79 
80 			PartitionListView*	fListView;
81 			DiskView*			fDiskView;
82 
83 			SpaceIDMap			fSpaceIDMap;
84 
85 			BMenu*				fDiskMenu;
86 			BMenu*				fPartitionMenu;
87 			BMenu*				fInitMenu;
88 
89 			BMenuItem*			fFormatMI;
90 			BMenuItem*			fEjectMI;
91 			BMenuItem*			fSurfaceTestMI;
92 			BMenuItem*			fRescanMI;
93 
94 			BMenuItem*			fCreateMI;
95 			BMenuItem*			fDeleteMI;
96 			BMenuItem*			fMountMI;
97 			BMenuItem*			fUnmountMI;
98 			BMenuItem*			fMountAllMI;
99 };
100 
101 
102 #endif // MAIN_WINDOW_H
103