xref: /haiku/src/apps/charactermap/CharacterView.h (revision b045287228b38d7892745c773bd74b7a2d122907)
1 /*
2  * Copyright 2009, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef CHARACTER_VIEW_H
6 #define CHARACTER_VIEW_H
7 
8 
9 #include <View.h>
10 
11 
12 class CharacterView : public BView {
13 public:
14 							CharacterView(const char* name);
15 	virtual					~CharacterView();
16 
17 			void			SetCharacterFont(const BFont& font);
18 			const BFont&	CharacterFont() { return fCharacterFont; }
19 
20 			void			ShowPrivateBlocks(bool show);
21 			bool			IsShowingPrivateBlocks() const
22 								{ return fShowPrivateBlocks; }
23 
24 			void			ShowContainedBlocksOnly(bool show);
25 			bool			IsShowingContainedBlocksOnly() const
26 								{ return fShowContainedBlocksOnly; }
27 
28 			bool			IsShowingBlock(int32 blockIndex) const;
29 
30 			void			ScrollTo(int32 blockIndex);
31 
32 protected:
33 	virtual	void			AttachedToWindow();
34 	virtual	void			DetachedFromWindow();
35 
36 	virtual	BSize			MinSize();
37 
38 	virtual void			FrameResized(float width, float height);
39 	virtual void			MouseDown(BPoint where);
40 	virtual void			MouseUp(BPoint where);
41 	virtual void			MouseMoved(BPoint where, uint32 transit,
42 								const BMessage* dragMessage);
43 
44 	virtual void			MessageReceived(BMessage* message);
45 
46 	virtual void			Draw(BRect updateRect);
47 
48 	virtual void			DoLayout();
49 
50 private:
51 			bool			_IncludeBlock(int32 index);
52 			void			_UpdateSize();
53 
54 private:
55 			bool			fShowPrivateBlocks;
56 			bool			fShowContainedBlocksOnly;
57 
58 			BRect			fDataRect;
59 			BFont			fCharacterFont;
60 			int32			fCharacterWidth;
61 			int32			fCharacterHeight;
62 			int32			fCharacterBase;
63 			int32			fTitleHeight;
64 			int32			fTitleBase;
65 			int32			fGap;
66 			int32			fTitleGap;
67 			int32*			fTitleTops;
68 };
69 
70 #endif	// CHARACTER_VIEW_H
71