vfs: check userland buffers before reading them.
[haiku.git] / src / apps / drivesetup / MainWindow.h
blob6166d822e7aaa3a29a503877f9fdd7b475a17af4
1 /*
2 * Copyright 2002-2013 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
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
13 #include <DiskDeviceRoster.h>
14 #include <PopUpMenu.h>
15 #include <Window.h>
17 #include "Support.h"
20 class BColumnListView;
21 class BDiskDevice;
22 class BMenu;
23 class BMenuBar;
24 class BMenuItem;
25 class BPartition;
26 class BRow;
27 class DiskView;
28 class PartitionListView;
31 enum {
32 MSG_SELECTED_PARTITION_ID = 'spid',
33 MSG_UPDATE_ZOOM_LIMITS = 'uzls'
37 class MainWindow : public BWindow {
38 public:
39 MainWindow();
40 virtual ~MainWindow();
42 // BWindow interface
43 virtual bool QuitRequested();
44 virtual void MessageReceived(BMessage* message);
46 // MainWindow
47 status_t StoreSettings(BMessage* archive) const;
48 status_t RestoreSettings(BMessage* archive);
49 void ApplyDefaultSettings();
51 private:
52 void _ScanDrives();
54 void _AdaptToSelectedPartition();
55 void _SetToDiskAndPartition(partition_id diskID,
56 partition_id partitionID,
57 partition_id parentID);
58 void _UpdateMenus(BDiskDevice* disk,
59 partition_id selectedPartition,
60 partition_id parentID);
62 void _DisplayPartitionError(BString message,
63 const BPartition* partition = NULL,
64 status_t error = B_OK) const;
66 void _Mount(BDiskDevice* disk,
67 partition_id selectedPartition);
68 void _Unmount(BDiskDevice* disk,
69 partition_id selectedPartition);
70 void _MountAll();
72 void _Initialize(BDiskDevice* disk,
73 partition_id selectedPartition,
74 const BString& diskSystemName);
75 void _Create(BDiskDevice* disk,
76 partition_id selectedPartition);
77 void _Delete(BDiskDevice* disk,
78 partition_id selectedPartition);
79 void _ChangeParameters(BDiskDevice* disk,
80 partition_id selectedPartition);
81 float _ColumnListViewHeight(BColumnListView* list,
82 BRow* currentRow);
83 void _UpdateWindowZoomLimits();
85 private:
86 BDiskDeviceRoster fDiskDeviceRoster;
87 BDiskDevice* fCurrentDisk;
88 partition_id fCurrentPartitionID;
90 PartitionListView* fListView;
91 DiskView* fDiskView;
93 SpaceIDMap fSpaceIDMap;
95 BMenu* fDiskMenu;
96 BMenu* fDiskInitMenu;
98 BMenu* fPartitionMenu;
99 BMenu* fFormatMenu;
101 BMenuBar* fMenuBar;
103 BMenuItem* fWipeMenuItem;
104 BMenuItem* fEjectMenuItem;
105 BMenuItem* fSurfaceTestMenuItem;
106 BMenuItem* fRescanMenuItem;
108 BMenuItem* fCreateMenuItem;
109 BMenuItem* fChangeMenuItem;
110 BMenuItem* fDeleteMenuItem;
111 BMenuItem* fMountMenuItem;
112 BMenuItem* fUnmountMenuItem;
113 BMenuItem* fMountAllMenuItem;
115 BMenu* fFormatContextMenuItem;
116 BMenuItem* fCreateContextMenuItem;
117 BMenuItem* fChangeContextMenuItem;
118 BMenuItem* fDeleteContextMenuItem;
119 BMenuItem* fMountContextMenuItem;
120 BMenuItem* fUnmountContextMenuItem;
121 BPopUpMenu* fContextMenu;
125 #endif // MAIN_WINDOW_H