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 <PopUpMenu.h> 15 #include <Window.h> 16 17 #include "Support.h" 18 19 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; 29 30 31 enum { 32 MSG_SELECTED_PARTITION_ID = 'spid', 33 MSG_UPDATE_ZOOM_LIMITS = 'uzls' 34 }; 35 36 37 class MainWindow : public BWindow { 38 public: 39 MainWindow(); 40 virtual ~MainWindow(); 41 42 // BWindow interface 43 virtual bool QuitRequested(); 44 virtual void MessageReceived(BMessage* message); 45 46 // MainWindow 47 status_t StoreSettings(BMessage* archive) const; 48 status_t RestoreSettings(BMessage* archive); 49 void ApplyDefaultSettings(); 50 51 private: 52 void _ScanDrives(); 53 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); 61 62 void _DisplayPartitionError(BString message, 63 const BPartition* partition = NULL, 64 status_t error = B_OK) const; 65 66 void _Mount(BDiskDevice* disk, 67 partition_id selectedPartition); 68 void _Unmount(BDiskDevice* disk, 69 partition_id selectedPartition); 70 void _MountAll(); 71 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(); 84 85 private: 86 BDiskDeviceRoster fDiskDeviceRoster; 87 BDiskDevice* fCurrentDisk; 88 partition_id fCurrentPartitionID; 89 90 PartitionListView* fListView; 91 DiskView* fDiskView; 92 93 SpaceIDMap fSpaceIDMap; 94 95 BMenu* fDiskMenu; 96 BMenu* fDiskInitMenu; 97 98 BMenu* fPartitionMenu; 99 BMenu* fFormatMenu; 100 101 BMenuBar* fMenuBar; 102 103 BMenuItem* fWipeMenuItem; 104 BMenuItem* fEjectMenuItem; 105 BMenuItem* fSurfaceTestMenuItem; 106 BMenuItem* fRescanMenuItem; 107 108 BMenuItem* fCreateMenuItem; 109 BMenuItem* fChangeMenuItem; 110 BMenuItem* fDeleteMenuItem; 111 BMenuItem* fMountMenuItem; 112 BMenuItem* fUnmountMenuItem; 113 BMenuItem* fMountAllMenuItem; 114 115 BMenu* fFormatContextMenuItem; 116 BMenuItem* fCreateContextMenuItem; 117 BMenuItem* fChangeContextMenuItem; 118 BMenuItem* fDeleteContextMenuItem; 119 BMenuItem* fMountContextMenuItem; 120 BMenuItem* fUnmountContextMenuItem; 121 BPopUpMenu* fContextMenu; 122 }; 123 124 125 #endif // MAIN_WINDOW_H 126