X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f7667b84a6adbb6fcfeca12d5ef3ad9c61277b55..9869c26285dc51d13607cddaa04f65ce983653a5:/include/wx/richtext/richtextbuffer.h?ds=inline diff --git a/include/wx/richtext/richtextbuffer.h b/include/wx/richtext/richtextbuffer.h index 21b512f8ae..771802d779 100644 --- a/include/wx/richtext/richtextbuffer.h +++ b/include/wx/richtext/richtextbuffer.h @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: // Created: 2005-09-30 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -66,6 +65,7 @@ #include "wx/cmdproc.h" #include "wx/txtstrm.h" #include "wx/variant.h" +#include "wx/position.h" #if wxUSE_DATAOBJ #include "wx/dataobj.h" @@ -2252,7 +2252,7 @@ public: is invalid for this object. */ - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; /** Do a split from @a pos, returning an object containing the second part, and setting @@ -2793,7 +2793,7 @@ public: virtual wxString GetTextForRange(const wxRichTextRange& range) const; - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual void Dump(wxTextOutputStream& stream); @@ -2910,7 +2910,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -3562,8 +3562,8 @@ protected: covers common needs especially for simple, static fields using text or a bitmap. Register field types on application initialisation with the static function - wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically - on application exit. + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. An application can write a field to a control with wxRichTextCtrl::WriteField, taking a field type, the properties for the field, and optional attributes. @@ -3598,7 +3598,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual wxString GetXMLNodeName() const { return wxT("field"); } @@ -3649,8 +3649,8 @@ protected: property editing functionality for a field. Register field types on application initialisation with the static function - wxRichTextParagraphLayoutBox::AddFieldType. They will be deleted automatically - on application exit. + wxRichTextBuffer::AddFieldType. They will be deleted automatically on + application exit. @library{wxrichtext} @category{richtext} @@ -3696,7 +3696,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const = 0; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const = 0; /** Returns @true if we can edit the object's properties via a GUI. @@ -3864,7 +3864,7 @@ public: Returns the object size for the given range. Returns @false if the range is invalid for this object. */ - virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(wxRichTextField* obj, const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; /** Get the size of the field, given the label, font size, and so on. @@ -4171,7 +4171,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool FindPosition(wxDC& dc, wxRichTextDrawingContext& context, long index, wxPoint& pt, int* height, bool forceLineStart); @@ -4342,7 +4342,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual wxString GetTextForRange(const wxRichTextRange& range) const; @@ -4616,6 +4616,11 @@ public: */ wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject(obj) { Copy(obj); } + /** + Destructor. + */ + ~wxRichTextImage(); + /** Initialisation. */ @@ -4627,7 +4632,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; /** Returns the 'natural' size for this object - the image size. @@ -4698,7 +4703,7 @@ public: /** Creates a cached image at the required size. */ - virtual bool LoadImageCache(wxDC& dc, bool resetCache = false); + virtual bool LoadImageCache(wxDC& dc, bool resetCache = false, const wxSize& parentSize = wxDefaultSize); /** Gets the original image size. @@ -4836,23 +4841,41 @@ public: */ virtual void ResetAndClearCommands(); +#if wxUSE_FFILE && wxUSE_STREAMS //@{ /** - Loads content from a stream or file. + Loads content from a file. Not all handlers will implement file loading. */ virtual bool LoadFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); - virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); //@} //@{ /** - Saves content to a stream or file. + Saves content to a file. Not all handlers will implement file saving. */ virtual bool SaveFile(const wxString& filename, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} +#endif // wxUSE_FFILE + +#if wxUSE_STREAMS + //@{ + /** + Loads content from a stream. + Not all handlers will implement loading from a stream. + */ + virtual bool LoadFile(wxInputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); + //@} + + //@{ + /** + Saves content to a stream. + Not all handlers will implement saving to a stream. + */ virtual bool SaveFile(wxOutputStream& stream, wxRichTextFileType type = wxRICHTEXT_TYPE_ANY); //@} +#endif // wxUSE_STREAMS /** Sets the handler flags, controlling loading and saving. @@ -5556,6 +5579,14 @@ public: // Accessors + int GetColspan() const; + + void SetColspan(long span) { GetProperties().SetProperty(wxT("colspan"), span); } + + int GetRowspan() const; + + void SetRowspan(long span) { GetProperties().SetProperty(wxT("rowspan"), span); } + // Operations virtual wxRichTextObject* Clone() const { return new wxRichTextCell(*this); } @@ -5572,7 +5603,7 @@ protected: */ WX_DEFINE_ARRAY_PTR(wxRichTextObject*, wxRichTextObjectPtrArray); -WX_DECLARE_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray); +WX_DECLARE_USER_EXPORTED_OBJARRAY(wxRichTextObjectPtrArray, wxRichTextObjectPtrArrayArray, WXDLLIMPEXP_RICHTEXT); class WXDLLIMPEXP_RICHTEXT wxRichTextTable: public wxRichTextBox { @@ -5601,7 +5632,7 @@ public: virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context, const wxRect& rect, const wxRect& parentRect, int style); - virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, wxPoint position = wxPoint(0,0), wxArrayInt* partialExtents = NULL) const; + virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size, int& descent, wxDC& dc, wxRichTextDrawingContext& context, int flags, const wxPoint& position = wxPoint(0,0), const wxSize& parentSize = wxDefaultSize, wxArrayInt* partialExtents = NULL) const; virtual bool DeleteRange(const wxRichTextRange& range); @@ -5678,6 +5709,11 @@ public: */ virtual bool GetCellRowColumnPosition(long pos, int& row, int& col) const; + /** + Returns the coordinates of the cell with keyboard focus, or (-1,-1) if none. + */ + virtual wxPosition GetFocusedCell() const; + // Operations /** @@ -5956,6 +5992,12 @@ public: */ wxRichTextObject* GetObject() const { return m_object; } + /** + Stores the object to replace the one at the position defined by the container address + without making an address for it (cf SetObject() and MakeObject()). + */ + void StoreObject(wxRichTextObject* obj) { m_object = obj; } + /** Sets the object to replace the one at the position defined by the container address and the action's range start position.