xref: /haiku/src/apps/charactermap/UnicodeBlockView.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
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			SetCharacterFont(const BFont& font);
35 			const BFont&	CharacterFont() { return fCharacterFont; }
36 
37 			void			ShowPrivateBlocks(bool show);
38 			bool			IsShowingPrivateBlocks() const
39 								{ return fShowPrivateBlocks; }
40 
41 			void			ShowContainedBlocksOnly(bool show);
42 			bool			IsShowingContainedBlocksOnly() const
43 								{ return fShowContainedBlocksOnly; }
44 
45 			bool			IsShowingBlock(int32 blockIndex) const;
46 			void			SelectBlockForCharacter(uint32 character);
47 
48 private:
49 			void			_UpdateBlocks();
50 			void			_CreateBlocks();
51 
52 private:
53 			BObjectList<BlockListItem> fBlocks;
54 			BString			fFilter;
55 			bool			fShowPrivateBlocks;
56 			bool			fShowContainedBlocksOnly;
57 			BFont			fCharacterFont;
58 			unicode_block	fUnicodeBlocks;
59 };
60 
61 #endif	// UNICODE_BLOCK_VIEW_H
62