xref: /haiku/src/apps/stylededit/StyledEditView.h (revision e53f0019b57484c9fe0b24371d9c8520b52af57d)
1 /*
2  * Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Mattias Sundblad
7  *		Andrew Bachmann
8  *		Axel Dörfler, axeld@pinc-software.de
9  */
10 #ifndef STYLED_EDIT_VIEW_H
11 #define STYLED_EDIT_VIEW_H
12 
13 
14 #include <String.h>
15 #include <TextView.h>
16 
17 class BFile;
18 class BHandler;
19 class BMessenger;
20 class BPositionIO;
21 
22 
23 class StyledEditView : public BTextView {
24 	public:
25 						StyledEditView(BRect viewframe, BRect textframe,
26 							BHandler* handler);
27 		virtual			~StyledEditView();
28 
29 		virtual void	Select(int32 start, int32 finish);
30 		virtual void	DeleteText(int32 start, int32 finish);
31 		virtual void	FrameResized(float width, float height);
32 		virtual void	InsertText(const char* text, int32 length, int32 offset,
33 							const text_run_array* runs = NULL);
34 
35 		void		Reset();
36 		void		SetSuppressChanges(bool suppressChanges);
37 		status_t	GetStyledText(BPositionIO* stream);
38 		status_t	WriteStyledEditFile(BFile* file);
39 
40 		void 		SetEncoding(uint32 encoding);
41 		uint32 		GetEncoding() const;
42 
43 	private:
44 		BMessenger 	*fMessenger;
45 		bool		fSuppressChanges;
46 		BString		fEncoding;
47 };
48 
49 #endif	// STYLED_EDIT_VIEW_H
50 
51