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:
@@ -126,6 +126,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.
|
||||
*/
|
||||
@@ -1472,6 +1495,11 @@ public:
|
||||
*/
|
||||
int Find(const wxString& name) const;
|
||||
|
||||
/**
|
||||
Removes the given property.
|
||||
*/
|
||||
bool Remove(const wxString& name);
|
||||
|
||||
/**
|
||||
Gets the property variant by name.
|
||||
*/
|
||||
@@ -1532,6 +1560,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;
|
||||
};
|
||||
@@ -2987,6 +3025,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
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user