1 /* 2 * Copyright 2002-2013 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 */ 5 #ifndef SUPPORT_H 6 #define SUPPORT_H 7 8 9 #include <DiskDeviceDefs.h> 10 #include <HashMap.h> 11 #include <HashString.h> 12 #include <Slider.h> 13 #include <String.h> 14 #include "StringForSize.h" 15 16 17 class BPartition; 18 19 20 void dump_partition_info(const BPartition* partition); 21 22 bool is_valid_partitionable_space(size_t size); 23 24 25 class SpaceIDMap : public HashMap<HashString, partition_id> { 26 public: 27 SpaceIDMap(); 28 virtual ~SpaceIDMap(); 29 30 partition_id SpaceIDFor(partition_id parentID, 31 off_t spaceOffset); 32 33 private: 34 partition_id fNextSpaceID; 35 }; 36 37 38 class SizeSlider : public BSlider { 39 public: 40 SizeSlider(const char* name, const char* label, 41 BMessage* message, off_t offset, 42 off_t size, uint32 minGranularity); 43 virtual ~SizeSlider(); 44 45 virtual void SetValue(int32 value); 46 virtual const char* UpdateText() const; 47 48 off_t Size() const; 49 void SetSize(off_t size); 50 51 off_t Offset() const; 52 off_t MaxPartitionSize() const; 53 54 private: 55 off_t fStartOffset; 56 off_t fEndOffset; 57 off_t fSize; 58 off_t fMaxPartitionSize; 59 uint32 fGranularity; 60 mutable char fStatusLabel[64]; 61 }; 62 63 64 #endif // SUPPORT_H 65