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:
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -844,6 +844,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.
|
||||
*/
|
||||
@@ -1631,6 +1653,11 @@ public:
|
||||
*/
|
||||
virtual bool EditProperties(wxRichTextObject* obj, wxWindow* parent) { return obj->EditProperties(parent, & GetBuffer()); }
|
||||
|
||||
/**
|
||||
Gets the object's properties menu label.
|
||||
*/
|
||||
virtual wxString GetPropertiesMenuLabel(wxRichTextObject* obj) { return obj->GetPropertiesMenuLabel(); }
|
||||
|
||||
// Command handlers
|
||||
|
||||
/**
|
||||
@@ -2022,6 +2049,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).
|
||||
*/
|
||||
@@ -2404,6 +2436,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLESHEE
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, wxRichTextEvent );
|
||||
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_RICHTEXT, wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED, wxRichTextEvent );
|
||||
@@ -2429,6 +2462,7 @@ typedef void (wxEvtHandler::*wxRichTextEventFunction)(wxRichTextEvent&);
|
||||
#define EVT_RICHTEXT_CONTENT_INSERTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_CONTENT_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_STYLE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_PROPERTIES_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_PROPERTIES_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_SELECTION_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_BUFFER_RESET(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_BUFFER_RESET, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
#define EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED, id, -1, wxRichTextEventHandler( fn ), NULL ),
|
||||
|
Reference in New Issue
Block a user