xref: /haiku/src/kits/interface/TextInput.h (revision 13581b3d2a71545960b98fefebc5225b5bf29072)
1 /*
2  * Copyright 2001-2020 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 
15 #include <TextView.h>
16 
17 
18 class BTextControl;
19 
20 namespace BPrivate {
21 
22 class _BTextInput_ : public BTextView {
23 public:
24 						_BTextInput_(BRect frame, BRect textRect,
25 							uint32 resizeMask,
26 							uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
27 						_BTextInput_(BMessage *data);
28 virtual					~_BTextInput_();
29 
30 static	BArchivable*	Instantiate(BMessage *data);
31 virtual	status_t		Archive(BMessage *data, bool deep = true) const;
32 
33 virtual	void			MouseDown(BPoint where);
34 virtual	void			FrameResized(float width, float height);
35 virtual	void			KeyDown(const char *bytes, int32 numBytes);
36 virtual	void			MakeFocus(bool focusState = true);
37 
38 virtual	BSize			MinSize();
39 
40 		void			SetInitialText();
41 
42 virtual	void			Paste(BClipboard *clipboard);
43 
44 protected:
45 
46 virtual	void			InsertText(const char *inText, int32 inLength,
47 								   int32 inOffset, const text_run_array *inRuns);
48 virtual	void			DeleteText(int32 fromOffset, int32 toOffset);
49 
50 private:
51 
52 		BTextControl	*TextControl();
53 
54 		char			*fPreviousText;
55 		bool			fInMouseDown;
56 };
57 
58 }	// namespace BPrivate
59 
60 using namespace BPrivate;
61 
62 
63 #endif	// _TEXT_CONTROLI_H
64 
65