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 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 BMenu* fCreateMenu; 89 90 BMenuItem* fFormatMI; 91 BMenuItem* fEjectMI; 92 BMenuItem* fSurfaceTestMI; 93 BMenuItem* fRescanMI; 94 95 BMenuItem* fDeleteMI; 96 BMenuItem* fMountMI; 97 BMenuItem* fUnmountMI; 98 BMenuItem* fMountAllMI; 99 }; 100 101 102 #endif // MAIN_WINDOW_H 103