2 * Copyright 2009, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef CHARACTER_VIEW_H
6 #define CHARACTER_VIEW_H
13 class CharacterView
: public BView
{
15 CharacterView(const char* name
);
16 virtual ~CharacterView();
18 void SetTarget(BMessenger target
, uint32 command
);
20 void SetCharacterFont(const BFont
& font
);
21 const BFont
& CharacterFont() { return fCharacterFont
; }
23 void ShowPrivateBlocks(bool show
);
24 bool IsShowingPrivateBlocks() const
25 { return fShowPrivateBlocks
; }
27 void ShowContainedBlocksOnly(bool show
);
28 bool IsShowingContainedBlocksOnly() const
29 { return fShowContainedBlocksOnly
; }
31 bool IsShowingBlock(int32 blockIndex
) const;
33 void ScrollToBlock(int32 blockIndex
);
34 void ScrollToCharacter(uint32 c
);
35 bool IsCharacterVisible(uint32 c
) const;
36 bool IsBlockVisible(int32 block
) const;
38 static void UnicodeToUTF8(uint32 c
, char* text
,
40 static void UnicodeToUTF8Hex(uint32 c
, char* text
,
44 virtual void MessageReceived(BMessage
* message
);
46 virtual void AttachedToWindow();
47 virtual void DetachedFromWindow();
49 virtual BSize
MinSize();
51 virtual void FrameResized(float width
, float height
);
52 virtual void MouseDown(BPoint where
);
53 virtual void MouseUp(BPoint where
);
54 virtual void MouseMoved(BPoint where
, uint32 transit
,
55 const BMessage
* dragMessage
);
57 virtual void Draw(BRect updateRect
);
59 virtual void DoLayout();
62 int32
_BlockAt(BPoint point
) const;
63 bool _GetCharacterAt(BPoint point
, uint32
& character
,
64 BRect
* _frame
= NULL
) const;
65 void _UpdateFontSize();
67 bool _GetTopmostCharacter(uint32
& character
,
69 BRect
_FrameFor(uint32 character
) const;
70 void _CopyToClipboard(const char* text
);
74 uint32 fTargetCommand
;
77 uint32 fCurrentCharacter
;
78 BRect fCurrentCharacterFrame
;
79 bool fHasTopCharacter
;
83 bool fShowPrivateBlocks
;
84 bool fShowContainedBlocksOnly
;
88 int32 fCharactersPerLine
;
89 int32 fCharacterWidth
;
90 int32 fCharacterHeight
;
99 #endif // CHARACTER_VIEW_H