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
14class BlockListItem : public BStringItem {
15public:
16							BlockListItem(const char* label, uint32 blockIndex);
17
18			uint32			BlockIndex() const { return fBlockIndex; }
19
20private:
21			uint32			fBlockIndex;
22};
23
24
25class UnicodeBlockView : public BListView {
26public:
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			void			SelectBlockForCharacter(uint32 character);
44
45private:
46			void			_UpdateBlocks();
47			void			_CreateBlocks();
48
49private:
50			BObjectList<BlockListItem> fBlocks;
51			BString			fFilter;
52			bool			fShowPrivateBlocks;
53			bool			fShowContainedBlocksOnly;
54};
55
56#endif	// UNICODE_BLOCK_VIEW_H
57