xref: /haiku/src/kits/interface/TextInput.h (revision b028e77473189065f2baefc6f5e10d451cf591e2)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, OpenBeOS
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		TextInput.h
23 //	Author:			Frans van Nispen (xlr8@tref.nl)
24 //	Description:	The BTextView derivative owned by an instance of
25 //					BTextControl.
26 //------------------------------------------------------------------------------
27 
28 #ifndef	_TEXT_CONTROLI_H
29 #define	_TEXT_CONTROLI_H
30 
31 // Standard Includes -----------------------------------------------------------
32 
33 // System Includes -------------------------------------------------------------
34 #include <TextView.h>
35 
36 // Project Includes ------------------------------------------------------------
37 
38 // Local Includes --------------------------------------------------------------
39 
40 // Local Defines ---------------------------------------------------------------
41 
42 // Globals ---------------------------------------------------------------------
43 
44 class BTextControl;
45 
46 // _BTextInput_ class ----------------------------------------------------------
47 class _BTextInput_ : public BTextView {
48 public:
49 						_BTextInput_(BRect frame, BRect textRect,
50 							uint32 resizeMask,
51 							uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
52 						_BTextInput_(BMessage *data);
53 						~_BTextInput_();
54 
55 static	BArchivable*	Instantiate(BMessage *data);
56 virtual	status_t		Archive(BMessage *data, bool deep = true) const;
57 
58 virtual	void			FrameResized(float width, float height);
59 virtual	void			KeyDown(const char *bytes, int32 numBytes);
60 virtual	void			MakeFocus(bool focusState = true);
61 
62 		void			AlignTextRect();
63 		void			SetInitialText();
64 
65 virtual	void			Paste(BClipboard *clipboard);
66 
67 protected:
68 
69 virtual	void			InsertText(const char *inText, int32 inLength,
70 								   int32 inOffset, const text_run_array *inRuns);
71 virtual	void			DeleteText(int32 fromOffset, int32 toOffset);
72 
73 private:
74 
75 		BTextControl	*TextControl();
76 
77 		char			*fPreviousText;
78 		bool			fBool;
79 };
80 //------------------------------------------------------------------------------
81 
82 #endif	// _TEXT_CONTROLI_H
83 
84 /*
85  * $Log $
86  *
87  * $Id  $
88  *
89  */
90 
91