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 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 48private: 49 void _UpdateBlocks(); 50 void _CreateBlocks(); 51 52private: 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