1/*
2 * Copyright 2002-2013 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
19class BDiskDevice;
20class BPartition;
21class BMenu;
22class BMenuItem;
23class DiskView;
24class PartitionListView;
25
26
27enum {
28	MSG_SELECTED_PARTITION_ID	= 'spid'
29};
30
31
32class MainWindow : public BWindow {
33public:
34								MainWindow();
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
46private:
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*				fDiskInitMenu;
87
88			BMenu*				fPartitionMenu;
89			BMenu*				fFormatMenu;
90
91			BMenuItem*			fWipeMenuItem;
92			BMenuItem*			fEjectMenuItem;
93			BMenuItem*			fSurfaceTestMenuItem;
94			BMenuItem*			fRescanMenuItem;
95
96			BMenuItem*			fCreateMenuItem;
97			BMenuItem*			fDeleteMenuItem;
98			BMenuItem*			fMountMenuItem;
99			BMenuItem*			fUnmountMenuItem;
100			BMenuItem*			fMountAllMenuItem;
101};
102
103
104#endif // MAIN_WINDOW_H
105