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 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(); 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 void _ChangeParameters(BDiskDevice* disk, 75 partition_id selectedPartition); 76 77 private: 78 BDiskDeviceRoster fDiskDeviceRoster; 79 BDiskDevice* fCurrentDisk; 80 partition_id fCurrentPartitionID; 81 82 PartitionListView* fListView; 83 DiskView* fDiskView; 84 85 SpaceIDMap fSpaceIDMap; 86 87 BMenu* fDiskMenu; 88 BMenu* fDiskInitMenu; 89 90 BMenu* fPartitionMenu; 91 BMenu* fFormatMenu; 92 93 BMenuItem* fWipeMenuItem; 94 BMenuItem* fEjectMenuItem; 95 BMenuItem* fSurfaceTestMenuItem; 96 BMenuItem* fRescanMenuItem; 97 98 BMenuItem* fCreateMenuItem; 99 BMenuItem* fChangeMenuItem; 100 BMenuItem* fDeleteMenuItem; 101 BMenuItem* fMountMenuItem; 102 BMenuItem* fUnmountMenuItem; 103 BMenuItem* fMountAllMenuItem; 104 }; 105 106 107 #endif // MAIN_WINDOW_H 108