Support for undoable application of custom properties, and customisation of properties menu label

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2012-01-17 12:56:53 +00:00
parent d1852ec0c3
commit 590a0f8bcb
6 changed files with 421 additions and 25 deletions

View File

@@ -810,6 +810,28 @@ public:
virtual bool PromoteList(int promoteBy, const wxRichTextRange& range, const wxString& defName, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int specifiedLevel = -1);
//@}
/**
Sets the properties for the given range, passing flags to determine how the
attributes are set. You can merge properties or replace them.
The end point of range is specified as the last character position of the span
of text, plus one. So, for example, to set the properties for a character at
position 5, use the range (5,6).
@a flags may contain a bit list of the following values:
- wxRICHTEXT_SETSPROPERTIES_NONE: no flag.
- wxRICHTEXT_SETPROPERTIES_WITH_UNDO: specifies that this operation should be
undoable.
- wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY: specifies that the properties should only be
applied to paragraphs, and not the content.
- wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY: specifies that the properties should only be
applied to characters, and not the paragraph.
- wxRICHTEXT_SETPROPERTIES_RESET: resets (clears) the existing properties before applying
the new properties.
- wxRICHTEXT_SETPROPERTIES_REMOVE: removes the specified properties.
*/
virtual bool SetProperties(const wxRichTextRange& range, const wxRichTextProperties& properties, int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO);
/**
Deletes the content within the given range.
*/
@@ -1583,12 +1605,17 @@ public:
/**
Returns @true if we can edit the object's properties via a GUI.
*/
virtual bool CanEditProperties(wxRichTextObject* obj) const { return obj->CanEditProperties(); }
virtual bool CanEditProperties(wxRichTextObject* obj) const;
/**
Edits the object's properties via a GUI.
*/
virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent) { return obj->EditProperties(parent, & GetBuffer()); }
virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent);
/**
Gets the object's properties menu label.
*/
virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj);
// Command handlers
@@ -1981,6 +2008,11 @@ public:
long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
bool& caretLineStart);
/**
Processes mouse movement in order to change the cursor
*/
virtual bool ProcessMouseMovement(wxRichTextParagraphLayoutBox* container, wxRichTextObject* obj, long position, const wxPoint& pos);
/**
Font names take a long time to retrieve, so cache them (on demand).
*/
@@ -2142,6 +2174,9 @@ protected:
when the control's stylesheet has been replaced, for example when a file
is loaded into the control.
Valid event functions: GetOldStyleSheet, GetNewStyleSheet.
@event{EVT_RICHTEXT_PROPERTIES_CHANGED(id, func)}
Process a @c wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED event, generated when
properties have been applied to the control. Valid event functions: GetPosition, GetRange.
@event{EVT_RICHTEXT_CONTENT_INSERTED(id, func)}
Process a @c wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED event, generated when
content has been inserted into the control.