xref: /haiku/src/apps/webpositive/autocompletion/TextViewCompleter.h (revision 312655fb6f521a6a769e3d7dd4cb908708848f29)
1 /*
2  * Copyright 2002-2006, project beam (http://sourceforge.net/projects/beam).
3  * All rights reserved. Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Oliver Tappe <beam@hirschkaefer.de>
7  */
8 #ifndef TEXT_CONTROL_COMPLETER_H
9 #define TEXT_CONTROL_COMPLETER_H
10 
11 #include <MessageFilter.h>
12 
13 #include "AutoCompleter.h"
14 
15 
16 class BTextView;
17 
18 class TextViewCompleter : protected BAutoCompleter, public BMessageFilter {
19 public:
20 								TextViewCompleter(BTextView* textView,
21 									ChoiceModel* choiceModel = NULL,
22 									PatternSelector* patternSelector = NULL);
23 	virtual						~TextViewCompleter();
24 
25 private:
26 	virtual	filter_result		Filter(BMessage* message, BHandler** target);
27 
28 	class TextViewWrapper : public EditView {
29 	public:
30 								TextViewWrapper(BTextView* textView);
31 		virtual	BRect			GetAdjustmentFrame();
32 		virtual	void			GetEditViewState(BString& text,
33 									int32* caretPos);
34 		virtual	void			SetEditViewState(const BString& text,
35 									int32 caretPos, int32 selectionLength = 0);
36 	private:
37 				BTextView*		fTextView;
38 	};
39 private:
40 			BTextView*			fTextView;
41 };
42 
43 #endif // TEXT_CONTROL_COMPLETER_H
44