xref: /haiku/src/apps/icon-o-matic/generic/gui/InputTextView.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 /*
2  * Copyright 2006-2009, Stephan Aßmus <superstippi@gmx.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef INPUT_TEXT_VIEW_H
6 #define INPUT_TEXT_VIEW_H
7 
8 #include <Invoker.h>
9 #include <String.h>
10 #include <TextView.h>
11 
12 class InputTextView : public BTextView,
13 					  public BInvoker {
14  public:
15 								InputTextView(BRect frame,
16 											  const char* name,
17 											  BRect textRect,
18 											  uint32 resizingMode,
19 											  uint32 flags);
20 	virtual						~InputTextView();
21 
22 	// BTextView interface
23 	virtual	void				MouseDown(BPoint where);
24 	virtual	void				MouseUp(BPoint where);
25 
26 	virtual	void				KeyDown(const char* bytes, int32 numBytes);
27 	virtual	void				MakeFocus(bool focus);
28 
29 	// BInvoker interface
30 	virtual	status_t			Invoke(BMessage* message = NULL);
31 
32 	// InputTextView
33 	virtual	void				RevertChanges() = 0;
34 	virtual	void				ApplyChanges() = 0;
35 
36 protected:
37 								// BTextView
38 	virtual	void				Select(int32 start, int32 finish);
39 
40 	virtual	void				InsertText(const char* inText,
41 										   int32 inLength,
42 										   int32 inOffset,
43 										   const text_run_array* inRuns);
44 	virtual	void				DeleteText(int32 fromOffset,
45 										   int32 toOffset);
46 
47 			void				_CheckTextRect();
48 
49 			bool				fWasFocus;
50 			BString				fTextBeforeFocus;
51 
52 };
53 
54 #endif // INPUT_TEXT_VIEW_H
55 
56 
57