xref: /haiku/src/apps/drivesetup/Support.h (revision 97901ec593ec4dd50ac115c1c35a6d72f6e489a5)
1 /*
2  * Copyright 2002-2007 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 enum {
25 	GO_CANCELED	= 0,
26 	GO_SUCCESS
27 };
28 
29 
30 static const uint32 kMegaByte = 0x100000;
31 
32 class SpaceIDMap : public HashMap<HashString, partition_id> {
33 public:
34 								SpaceIDMap();
35 	virtual						~SpaceIDMap();
36 
37 			partition_id		SpaceIDFor(partition_id parentID,
38 									off_t spaceOffset);
39 
40 private:
41 			partition_id		fNextSpaceID;
42 };
43 
44 class SizeSlider : public BSlider {
45 public:
46 								SizeSlider(const char* name, const char* label,
47         							BMessage* message, int32 minValue,
48         							int32 maxValue);
49 	virtual						~SizeSlider();
50 
51 	virtual const char*			UpdateText() const;
52 			int32				Size();
53 			int32				Offset();
54 
55 private:
56 			off_t				fStartOffset;
57 			off_t				fEndOffset;
58 	mutable	char				fStatusLabel[64];
59 };
60 
61 #endif // SUPPORT_H
62