xref: /haiku/src/kits/interface/TextInput.h (revision 89755088d790ff4fe36f8aa77dacb2bd15507108)
1 /*
2  * Copyright 2001-2008, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Frans van Nispen (xlr8@tref.nl)
7  */
8 
9 //! The BTextView derivative owned by an instance of BTextControl.
10 
11 #ifndef	_TEXT_CONTROLI_H
12 #define	_TEXT_CONTROLI_H
13 
14 #include <TextView.h>
15 
16 
17 class BTextControl;
18 
19 namespace BPrivate {
20 
21 class _BTextInput_ : public BTextView {
22 public:
23 						_BTextInput_(BRect frame, BRect textRect,
24 							uint32 resizeMask,
25 							uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
26 						_BTextInput_(BMessage *data);
27 virtual					~_BTextInput_();
28 
29 static	BArchivable*	Instantiate(BMessage *data);
30 virtual	status_t		Archive(BMessage *data, bool deep = true) const;
31 
32 virtual	void			MouseDown(BPoint where);
33 virtual	void			FrameResized(float width, float height);
34 virtual	void			KeyDown(const char *bytes, int32 numBytes);
35 virtual	void			MakeFocus(bool focusState = true);
36 
37 		void			AlignTextRect();
38 		void			SetInitialText();
39 
40 virtual	void			Paste(BClipboard *clipboard);
41 
42 protected:
43 
44 virtual	void			InsertText(const char *inText, int32 inLength,
45 								   int32 inOffset, const text_run_array *inRuns);
46 virtual	void			DeleteText(int32 fromOffset, int32 toOffset);
47 
48 private:
49 
50 		BTextControl	*TextControl();
51 
52 		char			*fPreviousText;
53 		bool			fBool;
54 };
55 
56 }	// namespace BPrivate
57 
58 using namespace BPrivate;
59 
60 
61 #endif	// _TEXT_CONTROLI_H
62 
63