xref: /haiku/src/apps/charactermap/UnicodeBlockView.h (revision 1b80286772b529a3d6de3bbeb0720c62e6a32fed)
1 /*
2  * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef UNICODE_BLOCK_VIEW_H
6 #define UNICODE_BLOCK_VIEW_H
7 
8 
9 #include <ListView.h>
10 #include <ObjectList.h>
11 #include <String.h>
12 
13 
14 class BlockListItem : public BStringItem {
15 public:
16 							BlockListItem(const char* label, uint32 blockIndex);
17 
18 			uint32			BlockIndex() const { return fBlockIndex; }
19 
20 private:
21 			uint32			fBlockIndex;
22 };
23 
24 
25 class UnicodeBlockView : public BListView {
26 public:
27 							UnicodeBlockView(const char* name);
28 	virtual					~UnicodeBlockView();
29 
30 			void			SetFilter(const char* filter);
31 			const char*		Filter() const
32 								{ return fFilter.String(); }
33 
34 			void			ShowPrivateBlocks(bool show);
35 			bool			IsShowingPrivateBlocks() const
36 								{ return fShowPrivateBlocks; }
37 
38 			void			ShowContainedBlocksOnly(bool show);
39 			bool			IsShowingContainedBlocksOnly() const
40 								{ return fShowContainedBlocksOnly; }
41 
42 			bool			IsShowingBlock(int32 blockIndex) const;
43 
44 private:
45 			void			_UpdateBlocks();
46 			void			_CreateBlocks();
47 
48 private:
49 			BObjectList<BlockListItem> fBlocks;
50 			BString			fFilter;
51 			bool			fShowPrivateBlocks;
52 			bool			fShowContainedBlocksOnly;
53 };
54 
55 #endif	// UNICODE_BLOCK_VIEW_H
56