xref: /haiku/src/apps/stylededit/StyledEditView.h (revision d0fc29af1fce2ab5ad25cb9bca43700f00b80a68)
131139022SAxel Dörfler /*
2*d0fc29afSAxel 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
8*d0fc29afSAxel 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 
140b46ec98Sshatty #include <File.h>
15ed48868fSshatty #include <DataIO.h>
16*d0fc29afSAxel Dörfler #include <String.h>
17*d0fc29afSAxel Dörfler #include <TextView.h>
18f7afd44bSPhil Greenway 
1931139022SAxel Dörfler 
20f7afd44bSPhil Greenway class StyledEditView : public BTextView {
21f7afd44bSPhil Greenway 	public:
22f7afd44bSPhil Greenway 		StyledEditView(BRect viewframe, BRect textframe, BHandler *handler);
235376b695SJérôme Duval 		virtual ~StyledEditView();
24f7afd44bSPhil Greenway 
25f7afd44bSPhil Greenway 		virtual void Select(int32 start, int32 finish);
26f7afd44bSPhil Greenway 		virtual void FrameResized(float width, float height);
27ed48868fSshatty 
28ed48868fSshatty 		virtual void Reset();
29ed48868fSshatty 		virtual status_t GetStyledText(BPositionIO * stream);
30670567f9Sshatty 		virtual status_t WriteStyledEditFile(BFile * file);
31670567f9Sshatty 
32670567f9Sshatty 		virtual void SetEncoding(uint32 encoding);
33670567f9Sshatty 		virtual uint32 GetEncoding() const;
3431139022SAxel Dörfler 
35f7afd44bSPhil Greenway 	protected:
36ebf4610fSshatty 		virtual void InsertText(const char *text, int32 length, int32 offset, const text_run_array *runs = NULL);
37f7afd44bSPhil Greenway 		virtual void DeleteText(int32 start, int32 finish);
38f7afd44bSPhil Greenway 
39f7afd44bSPhil Greenway 	private:
40f7afd44bSPhil Greenway 		BHandler	*fHandler;
41f7afd44bSPhil Greenway 		BMessage	*fChangeMessage;
42f7afd44bSPhil Greenway 		BMessenger 	*fMessenger;
43ed48868fSshatty 		bool		fSuppressChanges;
44*d0fc29afSAxel Dörfler 		BString		fEncoding;
45f7afd44bSPhil Greenway };
46f7afd44bSPhil Greenway 
47ed48868fSshatty #endif	// STYLED_EDIT_VIEW_H
48