2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT license.
5 #ifndef HYPER_TEXT_VIEW_H
6 #define HYPER_TEXT_VIEW_H
11 // TODO: The current implementation works correctly only for insertions at the
12 // end of the text. It doesn't keep track of any other insertions or deletions.
18 class HyperTextAction
{
21 virtual ~HyperTextAction();
23 virtual void MouseOver(HyperTextView
* view
, BPoint where
,
25 virtual void Clicked(HyperTextView
* view
, BPoint where
,
30 class HyperTextView
: public BTextView
{
32 HyperTextView(const char* name
,
33 uint32 flags
= B_WILL_DRAW
35 HyperTextView(BRect frame
, const char* name
,
36 BRect textRect
, uint32 resizeMask
,
37 uint32 flags
= B_WILL_DRAW
39 virtual ~HyperTextView();
41 virtual void MouseDown(BPoint where
);
42 virtual void MouseUp(BPoint where
);
43 virtual void MouseMoved(BPoint where
, uint32 transit
,
44 const BMessage
* dragMessage
);
46 void AddHyperTextAction(int32 startOffset
,
47 int32 endOffset
, HyperTextAction
* action
);
49 void InsertHyperText(const char* inText
,
50 HyperTextAction
* action
,
51 const text_run_array
* inRuns
= NULL
);
52 void InsertHyperText(const char* inText
,
53 int32 inLength
, HyperTextAction
* action
,
54 const text_run_array
* inRuns
= NULL
);
56 HyperTextAction
* _ActionAt(const BPoint
& where
) const;
61 ActionInfoList
* fActionInfos
;
65 #endif // HYPER_TEXT_VIEW_H