libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / charactermap / CharacterView.h
blobfc5e618695aec0846d65881c60b599ea2b88e9b8
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
9 #include <Messenger.h>
10 #include <View.h>
13 class CharacterView : public BView {
14 public:
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,
39 size_t textSize);
40 static void UnicodeToUTF8Hex(uint32 c, char* text,
41 size_t textSize);
43 protected:
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();
61 private:
62 int32 _BlockAt(BPoint point) const;
63 bool _GetCharacterAt(BPoint point, uint32& character,
64 BRect* _frame = NULL) const;
65 void _UpdateFontSize();
66 void _UpdateSize();
67 bool _GetTopmostCharacter(uint32& character,
68 int32& offset) const;
69 BRect _FrameFor(uint32 character) const;
70 void _CopyToClipboard(const char* text);
72 private:
73 BMessenger fTarget;
74 uint32 fTargetCommand;
75 BPoint fClickPoint;
76 bool fHasCharacter;
77 uint32 fCurrentCharacter;
78 BRect fCurrentCharacterFrame;
79 bool fHasTopCharacter;
80 uint32 fTopCharacter;
81 int32 fTopOffset;
83 bool fShowPrivateBlocks;
84 bool fShowContainedBlocksOnly;
86 BRect fDataRect;
87 BFont fCharacterFont;
88 int32 fCharactersPerLine;
89 int32 fCharacterWidth;
90 int32 fCharacterHeight;
91 int32 fCharacterBase;
92 int32 fTitleHeight;
93 int32 fTitleBase;
94 int32 fGap;
95 int32 fTitleGap;
96 int32* fTitleTops;
99 #endif // CHARACTER_VIEW_H