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