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

@@ -241,6 +241,29 @@ enum wxRichTextHitTestFlags
// Removes the given style instead of applying it
#define wxRICHTEXT_SETSTYLE_REMOVE 0x80
/**
Flags for SetProperties.
*/
#define wxRICHTEXT_SETPROPERTIES_NONE 0x00
// Specifies that this operation should be undoable
#define wxRICHTEXT_SETPROPERTIES_WITH_UNDO 0x01
// Specifies that the properties should only be applied to paragraphs,
// and not the content.
#define wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY 0x02
// Specifies that the properties should only be applied to characters,
// and not the paragraph.
#define wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY 0x04
// Resets the existing properties before applying the new properties.
#define wxRICHTEXT_SETPROPERTIES_RESET 0x08
// Removes the given properties instead of applying them.
#define wxRICHTEXT_SETPROPERTIES_REMOVE 0x10
/**
Flags for object insertion.
*/
@@ -1588,6 +1611,11 @@ public:
*/
int Find(const wxString& name) const;
/**
Removes the given property.
*/
bool Remove(const wxString& name);
/**
Gets the property variant by name.
*/
@@ -1648,6 +1676,16 @@ public:
*/
void SetProperty(const wxString& name, bool value);
/**
Removes the given properties from these properties.
*/
void RemoveProperties(const wxRichTextProperties& properties);
/**
Merges the given properties with these properties.
*/
void MergeProperties(const wxRichTextProperties& properties);
protected:
wxRichTextVariantArray m_properties;
};
@@ -3106,6 +3144,28 @@ public:
*/
virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const;
/**
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_SETPROPERTIES_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);
/**
Test if this whole range has character attributes of the specified kind. If any
of the attributes are different within the range, the test fails. You
@@ -4925,6 +4985,7 @@ enum wxRichTextCommandId
wxRICHTEXT_DELETE,
wxRICHTEXT_CHANGE_ATTRIBUTES,
wxRICHTEXT_CHANGE_STYLE,
wxRICHTEXT_CHANGE_PROPERTIES,
wxRICHTEXT_CHANGE_OBJECT
};