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 172cfeb3caSJohn Scipione 18f303cd6cSRyan Leavengood class BFile; 19f303cd6cSRyan Leavengood class BHandler; 20b40c9906SRyan Leavengood class BMessenger; 21f6e4cbb9SAxel Dörfler class BPositionIO; 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 FrameResized(float width, float height); 302cfeb3caSJohn Scipione virtual void DeleteText(int32 start, int32 finish); 312cfeb3caSJohn Scipione virtual void InsertText(const char* text, int32 length, 322cfeb3caSJohn Scipione int32 offset, 33b40c9906SRyan Leavengood const text_run_array* runs = NULL); 342cfeb3caSJohn Scipione virtual void Select(int32 start, int32 finish); 35ed48868fSshatty 36f303cd6cSRyan Leavengood void Reset(); 37e7d3e55aSJérôme Duval void SetSuppressChanges(bool suppressChanges); 380cc8d8abSSiarzhuk Zharski status_t GetStyledText(BPositionIO* stream, 390cc8d8abSSiarzhuk Zharski const char* forceEncoding = NULL); 40f303cd6cSRyan Leavengood status_t WriteStyledEditFile(BFile* file); 41670567f9Sshatty 42f303cd6cSRyan Leavengood void SetEncoding(uint32 encoding); 43f303cd6cSRyan Leavengood uint32 GetEncoding() const; 44f7afd44bSPhil Greenway 45f7afd44bSPhil Greenway private: 460f4985d8SVlad Slepukhin void _UpdateStatus(); 470f4985d8SVlad Slepukhin 48f7afd44bSPhil Greenway BMessenger* fMessenger; 49ed48868fSshatty bool fSuppressChanges; 50d0fc29afSAxel Dörfler BString fEncoding; 51*e62d9cf8SPhilippe Saint-Pierre rgb_color fInitialColor; 52f7afd44bSPhil Greenway }; 53f7afd44bSPhil Greenway 54f303cd6cSRyan Leavengood 552cfeb3caSJohn Scipione #endif // STYLED_EDIT_VIEW_H 56