xref: /haiku/src/apps/stylededit/StyledEditView.h (revision d0fc29af1fce2ab5ad25cb9bca43700f00b80a68)
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 <File.h>
15 #include <DataIO.h>
16 #include <String.h>
17 #include <TextView.h>
18 
19 
20 class StyledEditView : public BTextView {
21 	public:
22 		StyledEditView(BRect viewframe, BRect textframe, BHandler *handler);
23 		virtual ~StyledEditView();
24 
25 		virtual void Select(int32 start, int32 finish);
26 		virtual void FrameResized(float width, float height);
27 
28 		virtual void Reset();
29 		virtual status_t GetStyledText(BPositionIO * stream);
30 		virtual status_t WriteStyledEditFile(BFile * file);
31 
32 		virtual void SetEncoding(uint32 encoding);
33 		virtual uint32 GetEncoding() const;
34 
35 	protected:
36 		virtual void InsertText(const char *text, int32 length, int32 offset, const text_run_array *runs = NULL);
37 		virtual void DeleteText(int32 start, int32 finish);
38 
39 	private:
40 		BHandler	*fHandler;
41 		BMessage	*fChangeMessage;
42 		BMessenger 	*fMessenger;
43 		bool		fSuppressChanges;
44 		BString		fEncoding;
45 };
46 
47 #endif	// STYLED_EDIT_VIEW_H
48