whose properties are available to be edited.
*/
-class WXDLLIMPEXP_RICHTEXT wxRichTextContextMenuPropertiesInfo
+class wxRichTextContextMenuPropertiesInfo
{
public:
/**
Constructor.
*/
- wxRichTextContextMenuPropertiesInfo() { Init(); }
+ wxRichTextContextMenuPropertiesInfo();
// Operations
/**
Initialisation.
*/
- void Init() {}
+ void Init();
/**
Adds an item.
/**
Clears the items.
*/
- void Clear() { m_objects.Clear(); m_labels.Clear(); }
+ void Clear();
// Accessors
/**
Returns the nth label.
*/
- wxString GetLabel(int n) const { return m_labels[n]; }
+ wxString GetLabel(int n) const;
/**
Returns the nth object.
*/
- wxRichTextObject* GetObject(int n) const { return m_objects[n]; }
+ wxRichTextObject* GetObject(int n) const;
/**
Returns the array of objects.
*/
- wxRichTextObjectPtrArray& GetObjects() { return m_objects; }
+ wxRichTextObjectPtrArray& GetObjects();
/**
Returns the array of objects.
*/
- const wxRichTextObjectPtrArray& GetObjects() const { return m_objects; }
+ const wxRichTextObjectPtrArray& GetObjects() const;
/**
Returns the array of labels.
*/
- wxArrayString& GetLabels() { return m_labels; }
+ wxArrayString& GetLabels();
/**
Returns the array of labels.
*/
- const wxArrayString& GetLabels() const { return m_labels; }
+ const wxArrayString& GetLabels() const;
/**
Returns the number of items.
*/
- int GetCount() const { return m_objects.GetCount(); }
+ int GetCount() const;
wxRichTextObjectPtrArray m_objects;
wxArrayString m_labels;
wxRichTextCtrl sends notification events: see wxRichTextEvent.
- It also sends the standard wxTextCtrl events @c wxEVT_COMMAND_TEXT_ENTER and
- @c wxEVT_COMMAND_TEXT_UPDATED, and wxTextUrlEvent when URL content is clicked.
+ It also sends the standard wxTextCtrl events @c wxEVT_TEXT_ENTER and
+ @c wxEVT_TEXT, and wxTextUrlEvent when URL content is clicked.
For more information, see the @ref overview_richtextctrl.
@library{wxrichtext}
@category{richtext}
- @appearance{richtextctrl.png}
+ @appearance{richtextctrl}
*/
-class WXDLLIMPEXP_RICHTEXT wxRichTextCtrl : public wxControl,
- public wxTextCtrlIface,
- public wxScrollHelper
+class wxRichTextCtrl : public wxControl,
+ public wxTextCtrlIface,
+ public wxScrollHelper
{
- DECLARE_CLASS( wxRichTextCtrl )
- DECLARE_EVENT_TABLE()
-
public:
// Constructors
Returns @true if the control is single-line.
Currently wxRichTextCtrl does not support single-line editing.
*/
- bool IsSingleLine() const { return !HasFlag(wxRE_MULTILINE); }
+ bool IsSingleLine() const;
/**
Returns @true if the control is multiline.
*/
- bool IsMultiLine() const { return !IsSingleLine(); }
+ bool IsMultiLine() const;
//@{
/**
If the return values @a from and @a to are the same, there is no selection.
*/
virtual void GetSelection(long* from, long* to) const;
- const wxRichTextSelection& GetSelection() const { return m_selection; }
- wxRichTextSelection& GetSelection() { return m_selection; }
+ const wxRichTextSelection& GetSelection() const;
+ wxRichTextSelection& GetSelection();
//@}
/**
/**
Gets the current filename associated with the control.
*/
- wxString GetFilename() const { return m_filename; }
+ wxString GetFilename() const;
/**
Sets the current filename.
*/
- void SetFilename(const wxString& filename) { m_filename = filename; }
+ void SetFilename(const wxString& filename);
/**
Sets the size of the buffer beyond which layout is delayed during resizing.
This optimizes sizing for large buffers. The default is 20000.
*/
- void SetDelayedLayoutThreshold(long threshold) { m_delayedLayoutThreshold = threshold; }
+ void SetDelayedLayoutThreshold(long threshold);
/**
Gets the size of the buffer beyond which layout is delayed during resizing.
This optimizes sizing for large buffers. The default is 20000.
*/
- long GetDelayedLayoutThreshold() const { return m_delayedLayoutThreshold; }
+ long GetDelayedLayoutThreshold() const;
/**
*/
- bool GetFullLayoutRequired() const { return m_fullLayoutRequired; }
+ bool GetFullLayoutRequired() const;
/**
*/
- void SetFullLayoutRequired(bool b) { m_fullLayoutRequired = b; }
+ void SetFullLayoutRequired(bool b);
/**
*/
- wxLongLong GetFullLayoutTime() const { return m_fullLayoutTime; }
+ wxLongLong GetFullLayoutTime() const;
/**
*/
- void SetFullLayoutTime(wxLongLong t) { m_fullLayoutTime = t; }
+ void SetFullLayoutTime(wxLongLong t);
/**
*/
- long GetFullLayoutSavedPosition() const { return m_fullLayoutSavedPosition; }
+ long GetFullLayoutSavedPosition() const;
/**
*/
- void SetFullLayoutSavedPosition(long p) { m_fullLayoutSavedPosition = p; }
+ void SetFullLayoutSavedPosition(long p);
// Force any pending layout due to large buffer
/**
/**
Sets the text (normal) cursor.
*/
- void SetTextCursor(const wxCursor& cursor ) { m_textCursor = cursor; }
+ void SetTextCursor(const wxCursor& cursor );
/**
Returns the text (normal) cursor.
*/
- wxCursor GetTextCursor() const { return m_textCursor; }
+ wxCursor GetTextCursor() const;
/**
Sets the cursor to be used over URLs.
*/
- void SetURLCursor(const wxCursor& cursor ) { m_urlCursor = cursor; }
+ void SetURLCursor(const wxCursor& cursor );
/**
Returns the cursor to be used over URLs.
*/
- wxCursor GetURLCursor() const { return m_urlCursor; }
+ wxCursor GetURLCursor() const;
/**
Returns @true if we are showing the caret position at the start of a line
instead of at the end of the previous one.
*/
- bool GetCaretAtLineStart() const { return m_caretAtLineStart; }
+ bool GetCaretAtLineStart() const;
/**
Sets a flag to remember that we are showing the caret position at the start of a line
instead of at the end of the previous one.
*/
- void SetCaretAtLineStart(bool atStart) { m_caretAtLineStart = atStart; }
+ void SetCaretAtLineStart(bool atStart);
/**
Returns @true if we are extending a selection.
*/
- bool GetDragging() const { return m_dragging; }
+ bool GetDragging() const;
/**
Sets a flag to remember if we are extending a selection.
*/
- void SetDragging(bool dragging) { m_dragging = dragging; }
+ void SetDragging(bool dragging);
/**
Are we trying to start Drag'n'Drop?
*/
- bool GetPreDrag() const { return m_preDrag; }
+ bool GetPreDrag() const;
/**
Set if we're trying to start Drag'n'Drop
*/
- void SetPreDrag(bool pd) { m_preDrag = pd; }
+ void SetPreDrag(bool pd);
/**
Get the possible Drag'n'Drop start point
*/
- const wxPoint GetDragStartPoint() const { return m_dragStartPoint; }
+ const wxPoint GetDragStartPoint() const;
/**
Set the possible Drag'n'Drop start point
*/
- void SetDragStartPoint(wxPoint sp) { m_dragStartPoint = sp; }
+ void SetDragStartPoint(wxPoint sp);
/**
Get the possible Drag'n'Drop start time
*/
- const wxDateTime GetDragStartTime() const { return m_dragStartTime; }
+ const wxDateTime GetDragStartTime() const;
/**
Set the possible Drag'n'Drop start time
*/
- void SetDragStartTime(wxDateTime st) { m_dragStartTime = st; }
+ void SetDragStartTime(wxDateTime st);
#if wxRICHTEXT_BUFFERED_PAINTING
//@{
/**
Returns the buffer bitmap if using buffered painting.
*/
- const wxBitmap& GetBufferBitmap() const { return m_bufferBitmap; }
- wxBitmap& GetBufferBitmap() { return m_bufferBitmap; }
+ const wxBitmap& GetBufferBitmap() const;
+ wxBitmap& GetBufferBitmap();
//@}
#endif
/**
Returns the current context menu.
*/
- wxMenu* GetContextMenu() const { return m_contextMenu; }
+ wxMenu* GetContextMenu() const;
/**
Sets the current context menu.
Returns an anchor so we know how to extend the selection.
It's a caret position since it's between two characters.
*/
- long GetSelectionAnchor() const { return m_selectionAnchor; }
+ long GetSelectionAnchor() const;
/**
Sets an anchor so we know how to extend the selection.
It's a caret position since it's between two characters.
*/
- void SetSelectionAnchor(long anchor) { m_selectionAnchor = anchor; }
+ void SetSelectionAnchor(long anchor);
/**
Returns the anchor object if selecting multiple containers.
*/
- wxRichTextObject* GetSelectionAnchorObject() const { return m_selectionAnchorObject; }
+ wxRichTextObject* GetSelectionAnchorObject() const;
/**
Sets the anchor object if selecting multiple containers.
*/
- void SetSelectionAnchorObject(wxRichTextObject* anchor) { m_selectionAnchorObject = anchor; }
+ void SetSelectionAnchorObject(wxRichTextObject* anchor);
//@{
/**
item for each object that could respond to a property-editing event. If
objects are nested, several might be editable.
*/
- wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() { return m_contextMenuPropertiesInfo; }
- const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const { return m_contextMenuPropertiesInfo; }
+ wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo();
+ const wxRichTextContextMenuPropertiesInfo& GetContextMenuPropertiesInfo() const;
//@}
/**
Returns the wxRichTextObject object that currently has the editing focus.
If there are no composite objects, this will be the top-level buffer.
*/
- wxRichTextParagraphLayoutBox* GetFocusObject() const { return m_focusObject; }
+ wxRichTextParagraphLayoutBox* GetFocusObject() const;
/**
Setter for m_focusObject.
/**
Invalidates the whole buffer to trigger painting later.
*/
- void Invalidate() { GetBuffer().Invalidate(wxRICHTEXT_ALL); }
+ void Invalidate();
/**
Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
*/
virtual void Remove(long from, long to);
-#ifdef DOXYGEN
/**
Loads content into the control's buffer using the given type.
*/
bool LoadFile(const wxString& file,
int type = wxRICHTEXT_TYPE_ANY);
-#endif
/**
Helper function for LoadFile(). Loads content into the control's buffer using the given type.
*/
virtual bool DoLoadFile(const wxString& file, int fileType);
-#ifdef DOXYGEN
/**
Saves the buffer content using the given type.
*/
bool SaveFile(const wxString& file = wxEmptyString,
int type = wxRICHTEXT_TYPE_ANY);
-#endif
/**
Helper function for SaveFile(). Saves the buffer content using the given type.
See the documentation for each handler class to see what flags are
relevant for each handler.
*/
- void SetHandlerFlags(int flags) { GetBuffer().SetHandlerFlags(flags); }
+ void SetHandlerFlags(int flags);
/**
Returns flags that change the behaviour of loading or saving.
See the documentation for each handler class to see what flags are
relevant for each handler.
*/
- int GetHandlerFlags() const { return GetBuffer().GetHandlerFlags(); }
+ int GetHandlerFlags() const;
/**
Marks the buffer as modified.
*/
virtual void DiscardEdits();
+
+ void SetModified(bool modified);
+
/**
Sets the maximum number of characters that may be entered in a single line
text control. For compatibility only; currently does nothing.
*/
- virtual void SetMaxLength(unsigned long WXUNUSED(len)) { }
+ virtual void SetMaxLength(unsigned long len);
/**
Writes text at the current position.
/**
Sets the attributes for a single object
*/
- virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr);
+ virtual void SetStyle(wxRichTextObject *obj, const wxRichTextAttr& textAttr, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
//@{
/**
range (5,6).
*/
virtual void SetSelection(long from, long to);
- void SetSelection(const wxRichTextSelection& sel) { m_selection = sel; }
+ void SetSelection(const wxRichTextSelection& sel);
//@}
*/
virtual wxRichTextBox* WriteTextBox(const wxRichTextAttr& textAttr = wxRichTextAttr());
+ /**
+ Writes a field at the current insertion point.
+
+ @param fieldType
+ The field type, matching an existing field type definition.
+ @param properties
+ Extra data for the field.
+ @param textAttr
+ Optional attributes.
+
+ @see wxRichTextField, wxRichTextFieldType, wxRichTextFieldTypeStandard
+ */
+ virtual wxRichTextField* WriteField(const wxString& fieldType, const wxRichTextProperties& properties,
+ const wxRichTextAttr& textAttr = wxRichTextAttr());
+
/**
Write a table at the current insertion point, returning the table.
You can then call SetFocusObject() to set the focus to the new object.
applied (for example, setting the default style to bold will cause
subsequently inserted text to be bold).
*/
- virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); }
+ virtual void SetBasicStyle(const wxRichTextAttr& style);
/**
Gets the basic (overall) style.
applied (for example, setting the default style to bold will cause
subsequently inserted text to be bold).
*/
- virtual const wxRichTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); }
+ virtual const wxRichTextAttr& GetBasicStyle() const;
/**
Begins applying a style.
*/
- virtual bool BeginStyle(const wxRichTextAttr& style) { return GetBuffer().BeginStyle(style); }
+ virtual bool BeginStyle(const wxRichTextAttr& style);
/**
Ends the current style.
*/
- virtual bool EndStyle() { return GetBuffer().EndStyle(); }
+ virtual bool EndStyle();
/**
Ends application of all styles in the current style stack.
*/
- virtual bool EndAllStyles() { return GetBuffer().EndAllStyles(); }
+ virtual bool EndAllStyles();
/**
Begins using bold.
*/
- bool BeginBold() { return GetBuffer().BeginBold(); }
+ bool BeginBold();
/**
Ends using bold.
*/
- bool EndBold() { return GetBuffer().EndBold(); }
+ bool EndBold();
/**
Begins using italic.
*/
- bool BeginItalic() { return GetBuffer().BeginItalic(); }
+ bool BeginItalic();
/**
Ends using italic.
*/
- bool EndItalic() { return GetBuffer().EndItalic(); }
+ bool EndItalic();
/**
Begins using underlining.
*/
- bool BeginUnderline() { return GetBuffer().BeginUnderline(); }
+ bool BeginUnderline();
/**
End applying underlining.
*/
- bool EndUnderline() { return GetBuffer().EndUnderline(); }
+ bool EndUnderline();
/**
Begins using the given point size.
*/
- bool BeginFontSize(int pointSize) { return GetBuffer().BeginFontSize(pointSize); }
+ bool BeginFontSize(int pointSize);
/**
Ends using a point size.
*/
- bool EndFontSize() { return GetBuffer().EndFontSize(); }
+ bool EndFontSize();
/**
Begins using this font.
*/
- bool BeginFont(const wxFont& font) { return GetBuffer().BeginFont(font); }
+ bool BeginFont(const wxFont& font);
/**
Ends using a font.
*/
- bool EndFont() { return GetBuffer().EndFont(); }
+ bool EndFont();
/**
Begins using this colour.
*/
- bool BeginTextColour(const wxColour& colour) { return GetBuffer().BeginTextColour(colour); }
+ bool BeginTextColour(const wxColour& colour);
/**
Ends applying a text colour.
*/
- bool EndTextColour() { return GetBuffer().EndTextColour(); }
+ bool EndTextColour();
/**
Begins using alignment.
For alignment values, see wxTextAttr.
*/
- bool BeginAlignment(wxTextAttrAlignment alignment) { return GetBuffer().BeginAlignment(alignment); }
+ bool BeginAlignment(wxTextAttrAlignment alignment);
/**
Ends alignment.
*/
- bool EndAlignment() { return GetBuffer().EndAlignment(); }
+ bool EndAlignment();
/**
Begins applying a left indent and subindent in tenths of a millimetre.
The distance between the left edge of the bullet and the left edge
of the actual paragraph.
*/
- bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0) { return GetBuffer().BeginLeftIndent(leftIndent, leftSubIndent); }
+ bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0);
/**
Ends left indent.
*/
- bool EndLeftIndent() { return GetBuffer().EndLeftIndent(); }
+ bool EndLeftIndent();
/**
Begins a right indent, specified in tenths of a millimetre.
*/
- bool BeginRightIndent(int rightIndent) { return GetBuffer().BeginRightIndent(rightIndent); }
+ bool BeginRightIndent(int rightIndent);
/**
Ends right indent.
*/
- bool EndRightIndent() { return GetBuffer().EndRightIndent(); }
+ bool EndRightIndent();
/**
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing
in tenths of a millimetre.
*/
- bool BeginParagraphSpacing(int before, int after) { return GetBuffer().BeginParagraphSpacing(before, after); }
+ bool BeginParagraphSpacing(int before, int after);
/**
Ends paragraph spacing.
*/
- bool EndParagraphSpacing() { return GetBuffer().EndParagraphSpacing(); }
+ bool EndParagraphSpacing();
/**
Begins appling line spacing. @e spacing is a multiple, where 10 means
The ::wxTextAttrLineSpacing constants are defined for convenience.
*/
- bool BeginLineSpacing(int lineSpacing) { return GetBuffer().BeginLineSpacing(lineSpacing); }
+ bool BeginLineSpacing(int lineSpacing);
/**
Ends line spacing.
*/
- bool EndLineSpacing() { return GetBuffer().EndLineSpacing(); }
+ bool EndLineSpacing();
/**
Begins a numbered bullet.
So the distance between the left edge of the bullet and the
left of the actual paragraph is leftSubIndent.
*/
- bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD)
- { return GetBuffer().BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle); }
-
+ bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD);
+
/**
Ends application of a numbered bullet.
*/
- bool EndNumberedBullet() { return GetBuffer().EndNumberedBullet(); }
+ bool EndNumberedBullet();
/**
Begins applying a symbol bullet, using a character from the current font.
See BeginNumberedBullet() for an explanation of how indentation is used
to render the bulleted paragraph.
*/
- bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL)
- { return GetBuffer().BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle); }
-
+ bool BeginSymbolBullet(const wxString& symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL);
+
/**
Ends applying a symbol bullet.
*/
- bool EndSymbolBullet() { return GetBuffer().EndSymbolBullet(); }
+ bool EndSymbolBullet();
/**
Begins applying a symbol bullet.
*/
- bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD)
- { return GetBuffer().BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle); }
+ bool BeginStandardBullet(const wxString& bulletName, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD);
/**
Begins applying a standard bullet.
*/
- bool EndStandardBullet() { return GetBuffer().EndStandardBullet(); }
+ bool EndStandardBullet();
/**
Begins using the named character style.
*/
- bool BeginCharacterStyle(const wxString& characterStyle) { return GetBuffer().BeginCharacterStyle(characterStyle); }
+ bool BeginCharacterStyle(const wxString& characterStyle);
/**
Ends application of a named character style.
*/
- bool EndCharacterStyle() { return GetBuffer().EndCharacterStyle(); }
+ bool EndCharacterStyle();
/**
Begins applying the named paragraph style.
*/
- bool BeginParagraphStyle(const wxString& paragraphStyle) { return GetBuffer().BeginParagraphStyle(paragraphStyle); }
+ bool BeginParagraphStyle(const wxString& paragraphStyle);
/**
Ends application of a named paragraph style.
*/
- bool EndParagraphStyle() { return GetBuffer().EndParagraphStyle(); }
+ bool EndParagraphStyle();
/**
Begins using a specified list style.
Optionally, you can also pass a level and a number.
*/
- bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1) { return GetBuffer().BeginListStyle(listStyle, level, number); }
+ bool BeginListStyle(const wxString& listStyle, int level = 1, int number = 1);
/**
Ends using a specified list style.
*/
- bool EndListStyle() { return GetBuffer().EndListStyle(); }
+ bool EndListStyle();
/**
Begins applying wxTEXT_ATTR_URL to the content.
Pass a URL and optionally, a character style to apply, since it is common
to mark a URL with a familiar style such as blue text with underlining.
*/
- bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString) { return GetBuffer().BeginURL(url, characterStyle); }
+ bool BeginURL(const wxString& url, const wxString& characterStyle = wxEmptyString);
/**
Ends applying a URL.
*/
- bool EndURL() { return GetBuffer().EndURL(); }
+ bool EndURL();
/**
Sets the default style to the style under the cursor.
The range is in internal format, i.e. a single character selection is denoted
by (n, n)
*/
- wxRichTextRange GetInternalSelectionRange() const { return m_selection.GetRange(); }
+ wxRichTextRange GetInternalSelectionRange() const;
/**
Sets the selection range in character positions. -2, -2 means no selection
The range is in internal format, i.e. a single character selection is denoted
by (n, n)
*/
- void SetInternalSelectionRange(const wxRichTextRange& range) { m_selection.Set(range, GetFocusObject()); }
+ void SetInternalSelectionRange(const wxRichTextRange& range);
/**
Adds a new paragraph of text to the end of the buffer.
/**
Returns the buffer associated with the control.
*/
- wxRichTextBuffer& GetBuffer() { return m_buffer; }
- const wxRichTextBuffer& GetBuffer() const { return m_buffer; }
+ wxRichTextBuffer& GetBuffer();
+ const wxRichTextBuffer& GetBuffer() const;
//@}
/**
Starts batching undo history for commands.
*/
- virtual bool BeginBatchUndo(const wxString& cmdName) { return m_buffer.BeginBatchUndo(cmdName); }
+ virtual bool BeginBatchUndo(const wxString& cmdName);
/**
Ends batching undo command history.
*/
- virtual bool EndBatchUndo() { return m_buffer.EndBatchUndo(); }
+ virtual bool EndBatchUndo();
/**
Returns @true if undo commands are being batched.
*/
- virtual bool BatchingUndo() const { return m_buffer.BatchingUndo(); }
+ virtual bool BatchingUndo() const;
/**
Starts suppressing undo history for commands.
*/
- virtual bool BeginSuppressUndo() { return m_buffer.BeginSuppressUndo(); }
+ virtual bool BeginSuppressUndo();
/**
Ends suppressing undo command history.
*/
- virtual bool EndSuppressUndo() { return m_buffer.EndSuppressUndo(); }
+ virtual bool EndSuppressUndo();
/**
Returns @true if undo history suppression is on.
*/
- virtual bool SuppressingUndo() const { return m_buffer.SuppressingUndo(); }
+ virtual bool SuppressingUndo() const;
/**
Test if this whole range has character attributes of the specified kind.
You can use this to implement, for example, bold button updating.
@a style must have flags indicating which attributes are of interest.
*/
- virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
- {
- return GetBuffer().HasCharacterAttributes(range.ToInternal(), style);
- }
+ virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
+
/**
Test if this whole range has paragraph attributes of the specified kind.
You can use this to implement, for example, centering button updating.
@a style must have flags indicating which attributes are of interest.
*/
- virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
- {
- return GetBuffer().HasParagraphAttributes(range.ToInternal(), style);
- }
+ virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
+
/**
Returns @true if all of the selection, or the content at the caret position, is bold.
Sets the style sheet associated with the control.
A style sheet allows named character and paragraph styles to be applied.
*/
- void SetStyleSheet(wxRichTextStyleSheet* styleSheet) { GetBuffer().SetStyleSheet(styleSheet); }
+ void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
/**
Returns the style sheet associated with the control, if any.
A style sheet allows named character and paragraph styles to be applied.
*/
- wxRichTextStyleSheet* GetStyleSheet() const { return GetBuffer().GetStyleSheet(); }
+ wxRichTextStyleSheet* GetStyleSheet() const;
/**
Push the style sheet to top of stack.
*/
- bool PushStyleSheet(wxRichTextStyleSheet* styleSheet) { return GetBuffer().PushStyleSheet(styleSheet); }
+ bool PushStyleSheet(wxRichTextStyleSheet* styleSheet);
/**
Pops the style sheet from top of stack.
*/
- wxRichTextStyleSheet* PopStyleSheet() { return GetBuffer().PopStyleSheet(); }
+ wxRichTextStyleSheet* PopStyleSheet();
/**
Applies the style sheet to the buffer, for example if the styles have changed.
Prepares the content just before insertion (or after buffer reset). Called by the same function in wxRichTextBuffer.
Currently is only called if undo mode is on.
*/
- virtual void PrepareContent(wxRichTextParagraphLayoutBox& WXUNUSED(container)) {}
+ virtual void PrepareContent(wxRichTextParagraphLayoutBox& container);
/**
Can we delete this range?
*/
virtual bool CanInsertContent(wxRichTextParagraphLayoutBox& container, long pos) const;
+ /**
+ Enable or disable the vertical scrollbar.
+ */
+ virtual void EnableVerticalScrollbar(bool enable);
+
+ /**
+ Returns @true if the vertical scrollbar is enabled.
+ */
+ virtual bool GetVerticalScrollbarEnabled() const;
+
+ /**
+ Sets the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ void SetFontScale(double fontScale, bool refresh = false);
+
+ /**
+ Returns the scale factor for displaying fonts, for example for more comfortable
+ editing.
+ */
+ double GetFontScale() const { return GetBuffer().GetFontScale(); }
+
+ /**
+ Sets the scale factor for displaying certain dimensions such as indentation and
+ inter-paragraph spacing. This can be useful when editing in a small control
+ where you still want legible text, but a minimum of wasted white space.
+ */
+ void SetDimensionScale(double dimScale, bool refresh = false);
+
+ /**
+ Returns the scale factor for displaying certain dimensions such as indentation
+ and inter-paragraph spacing.
+ */
+ double GetDimensionScale() const { return GetBuffer().GetDimensionScale(); }
+
+ /**
+ Sets an overall scale factor for displaying and editing the content.
+ */
+ void SetScale(double scale, bool refresh = false);
+
+ /**
+ Returns an overall scale factor for displaying and editing the content.
+ */
+ double GetScale() const;
+
+ /**
+ Returns an unscaled point.
+ */
+ wxPoint GetUnscaledPoint(const wxPoint& pt) const;
+
+ /**
+ Returns a scaled point.
+ */
+ wxPoint GetScaledPoint(const wxPoint& pt) const;
+
+ /**
+ Returns an unscaled size.
+ */
+ wxSize GetUnscaledSize(const wxSize& sz) const;
+
+ /**
+ Returns a scaled size.
+ */
+ wxSize GetScaledSize(const wxSize& sz) const;
+
+ /**
+ Returns an unscaled rectangle.
+ */
+ wxRect GetUnscaledRect(const wxRect& rect) const;
+
+ /**
+ Returns a scaled rectangle.
+ */
+ wxRect GetScaledRect(const wxRect& rect) const;
+
+ /**
+ Returns @true if this control can use virtual attributes and virtual text.
+ The default is @false.
+ */
+ bool GetVirtualAttributesEnabled() const;
+
+ /**
+ Pass @true to let the control use virtual attributes.
+ The default is @false.
+ */
+ void EnableVirtualAttributes(bool b);
+
// Command handlers
/**
virtual void PaintBackground(wxDC& dc);
/**
- Other user defined painting after everything else (i.e. all text) is painted.
+ Other user defined painting after everything else (i.e.\ all text) is painted.
@since 2.9.1
*/
virtual void DoWriteText(const wxString& value, int flags = 0);
// Should we inherit colours?
- virtual bool ShouldInheritColours() const { return false; }
+ virtual bool ShouldInheritColours() const;
/**
Internal function to position the visible caret according to the current caret
/**
Returns the current caret position.
*/
- long GetCaretPosition() const { return m_caretPosition; }
+ long GetCaretPosition() const;
/**
The adjusted caret position is the character position adjusted to take
/**
Gets the command processor associated with the control's buffer.
*/
- wxCommandProcessor* GetCommandProcessor() const { return GetBuffer().GetCommandProcessor(); }
+ wxCommandProcessor* GetCommandProcessor() const;
/**
Deletes content if there is a selection, e.g. when pressing a key.
in the UI. A value of -2 means that we should only reflect the style of the
content under the caret.
*/
- long GetCaretPositionForDefaultStyle() const { return m_caretPositionForDefaultStyle; }
+ long GetCaretPositionForDefaultStyle() const;
/**
Set the caret position for the default style that the user is selecting.
*/
- void SetCaretPositionForDefaultStyle(long pos) { m_caretPositionForDefaultStyle = pos; }
+ void SetCaretPositionForDefaultStyle(long pos);
/**
Returns @true if the user has recently set the default style without moving
@see SetAndShowDefaultStyle().
*/
- bool IsDefaultStyleShowing() const { return m_caretPositionForDefaultStyle != -2; }
+ bool IsDefaultStyleShowing() const;
/**
Sets @a attr as the default style and tells the control that the UI should
@see IsDefaultStyleShowing().
*/
- void SetAndShowDefaultStyle(const wxRichTextAttr& attr)
- {
- SetDefaultStyle(attr);
- SetCaretPositionForDefaultStyle(GetCaretPosition());
- }
+ void SetAndShowDefaultStyle(const wxRichTextAttr& attr);
/**
Returns the first visible point in the window.
*/
wxPoint GetFirstVisiblePoint() const;
-#ifdef DOXYGEN
/**
Returns the content of the entire control as a string.
*/
*/
virtual void SetValue(const wxString& value);
- /**
- Call this function to prevent refresh and allow fast updates, and then Thaw() to
- refresh the control.
- */
- void Freeze();
+
+// Implementation
/**
- Call this function to end a Freeze and refresh the display.
+ Processes the back key.
*/
- void Thaw();
+ virtual bool ProcessBackKey(wxKeyEvent& event, int flags);
/**
- Returns @true if Freeze has been called without a Thaw.
+ Given a character position at which there is a list style, find the range
+ encompassing the same list style by looking backwards and forwards.
*/
- bool IsFrozen() const;
-
-#endif
-
-// Implementation
+ virtual wxRichTextRange FindRangeForList(long pos, bool& isNumberedList);
/**
Sets up the caret for the given position and container, after a mouse click.
since this is ambiguous (same position used for end of line and start of next).
*/
long FindCaretPositionForCharacterPosition(long position, int hitTestFlags, wxRichTextParagraphLayoutBox* container,
- bool& caretLineStart);
+ bool& caretLineStart);
/**
Processes mouse movement in order to change the cursor
*/
static void ClearAvailableFontNames();
- WX_FORWARD_TO_SCROLL_HELPER()
-
// implement wxTextEntry methods
virtual wxString DoGetValue() const;
protected:
// implement the wxTextEntry pure virtual method
- virtual wxWindow *GetEditableWindow() { return this; }
+ virtual wxWindow *GetEditableWindow();
// margins functions
virtual bool DoSetMargins(const wxPoint& pt);
virtual wxPoint DoGetMargins() const;
- // FIXME: this does not work, it allows this code to compile but will fail
- // during run-time
-#ifndef __WXUNIVERSAL__
-#ifdef __WXMSW__
- virtual WXHWND GetEditHWND() const { return GetHWND(); }
-#endif
-#ifdef __WXMOTIF__
- virtual WXWidget GetTextWidget() const { return NULL; }
-#endif
-#ifdef __WXGTK20__
- virtual GtkEditable *GetEditable() const { return NULL; }
- virtual GtkEntry *GetEntry() const { return NULL; }
-#endif
-#endif // !__WXUNIVERSAL__
// Overrides
protected:
@beginEventTable{wxRichTextEvent}
@event{EVT_RICHTEXT_LEFT_CLICK(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_LEFT_CLICK event, generated when the user
+ Process a @c wxEVT_RICHTEXT_LEFT_CLICK event, generated when the user
releases the left mouse button over an object.
@event{EVT_RICHTEXT_RIGHT_CLICK(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_RIGHT_CLICK event, generated when the user
+ Process a @c wxEVT_RICHTEXT_RIGHT_CLICK event, generated when the user
releases the right mouse button over an object.
@event{EVT_RICHTEXT_MIDDLE_CLICK(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_MIDDLE_CLICK event, generated when the user
+ Process a @c wxEVT_RICHTEXT_MIDDLE_CLICK event, generated when the user
releases the middle mouse button over an object.
@event{EVT_RICHTEXT_LEFT_DCLICK(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_LEFT_DCLICK event, generated when the user
+ Process a @c wxEVT_RICHTEXT_LEFT_DCLICK event, generated when the user
double-clicks an object.
@event{EVT_RICHTEXT_RETURN(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user
+ Process a @c wxEVT_RICHTEXT_RETURN event, generated when the user
presses the return key. Valid event functions: GetFlags, GetPosition.
@event{EVT_RICHTEXT_CHARACTER(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_CHARACTER event, generated when the user
+ Process a @c wxEVT_RICHTEXT_CHARACTER event, generated when the user
presses a character key. Valid event functions: GetFlags, GetPosition, GetCharacter.
@event{EVT_RICHTEXT_DELETE(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_DELETE event, generated when the user
+ Process a @c wxEVT_RICHTEXT_DELETE event, generated when the user
presses the backspace or delete key. Valid event functions: GetFlags, GetPosition.
@event{EVT_RICHTEXT_RETURN(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_RETURN event, generated when the user
+ Process a @c wxEVT_RICHTEXT_RETURN event, generated when the user
presses the return key. Valid event functions: GetFlags, GetPosition.
@event{EVT_RICHTEXT_STYLE_CHANGED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED event, generated when
+ Process a @c wxEVT_RICHTEXT_STYLE_CHANGED event, generated when
styling has been applied to the control. Valid event functions: GetPosition, GetRange.
@event{EVT_RICHTEXT_STYLESHEET_CHANGED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING event, generated
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING event, generated
when the control's stylesheet has changed, for example the user added,
edited or deleted a style. Valid event functions: GetRange, GetPosition.
@event{EVT_RICHTEXT_STYLESHEET_REPLACING(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING event, generated
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACING event, generated
when the control's stylesheet is about to be replaced, for example when
a file is loaded into the control.
Valid event functions: Veto, GetOldStyleSheet, GetNewStyleSheet.
@event{EVT_RICHTEXT_STYLESHEET_REPLACED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACED event, generated
+ Process a @c wxEVT_RICHTEXT_STYLESHEET_REPLACED event, generated
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
+ Process a @c wxEVT_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
+ Process a @c wxEVT_RICHTEXT_CONTENT_INSERTED event, generated when
content has been inserted into the control.
Valid event functions: GetPosition, GetRange.
@event{EVT_RICHTEXT_CONTENT_DELETED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED event, generated when
+ Process a @c wxEVT_RICHTEXT_CONTENT_DELETED event, generated when
content has been deleted from the control.
Valid event functions: GetPosition, GetRange.
@event{EVT_RICHTEXT_BUFFER_RESET(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_BUFFER_RESET event, generated when the
+ Process a @c wxEVT_RICHTEXT_BUFFER_RESET event, generated when the
buffer has been reset by deleting all content.
You can use this to set a default style for the first new paragraph.
@event{EVT_RICHTEXT_SELECTION_CHANGED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_SELECTION_CHANGED event, generated when the
+ Process a @c wxEVT_RICHTEXT_SELECTION_CHANGED event, generated when the
selection range has changed.
@event{EVT_RICHTEXT_FOCUS_OBJECT_CHANGED(id, func)}
- Process a @c wxEVT_COMMAND_RICHTEXT_FOCUS_OBJECT_CHANGED event, generated when the
+ Process a @c wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED event, generated when the
current focus object has changed.
@endEventTable
@category{events,richtext}
*/
-class WXDLLIMPEXP_RICHTEXT wxRichTextEvent : public wxNotifyEvent
+class wxRichTextEvent : public wxNotifyEvent
{
public:
/**
@param id
Window identifier. The value @c wxID_ANY indicates a default value.
*/
- wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
- : wxNotifyEvent(commandType, winid),
- m_flags(0), m_position(-1), m_oldStyleSheet(NULL), m_newStyleSheet(NULL),
- m_char((wxChar) 0), m_container(NULL), m_oldContainer(NULL)
- { }
+ wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
/**
Copy constructor.
*/
- wxRichTextEvent(const wxRichTextEvent& event)
- : wxNotifyEvent(event),
- m_flags(event.m_flags), m_position(-1),
- m_oldStyleSheet(event.m_oldStyleSheet), m_newStyleSheet(event.m_newStyleSheet),
- m_char((wxChar) 0), m_container(event.m_container), m_oldContainer(event.m_oldContainer)
- { }
-
+ wxRichTextEvent(const wxRichTextEvent& event);
+
/**
- Returns the buffer position at which the event occured.
+ Returns the buffer position at which the event occurred.
*/
- long GetPosition() const { return m_position; }
+ long GetPosition() const;
/**
Sets the buffer position variable.
*/
- void SetPosition(long pos) { m_position = pos; }
+ void SetPosition(long pos);
/**
Returns flags indicating modifier keys pressed.
Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
*/
- int GetFlags() const { return m_flags; }
+ int GetFlags() const;
/**
Sets flags indicating modifier keys pressed.
Possible values are @c wxRICHTEXT_CTRL_DOWN, @c wxRICHTEXT_SHIFT_DOWN, and @c wxRICHTEXT_ALT_DOWN.
*/
- void SetFlags(int flags) { m_flags = flags; }
+ void SetFlags(int flags);
/**
Returns the old style sheet.
- Can be used in a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
- @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
+ Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler.
*/
- wxRichTextStyleSheet* GetOldStyleSheet() const { return m_oldStyleSheet; }
+ wxRichTextStyleSheet* GetOldStyleSheet() const;
/**
Sets the old style sheet variable.
*/
- void SetOldStyleSheet(wxRichTextStyleSheet* sheet) { m_oldStyleSheet = sheet; }
+ void SetOldStyleSheet(wxRichTextStyleSheet* sheet);
/**
Returns the new style sheet.
- Can be used in a @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
- @c wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
+ Can be used in a @c wxEVT_RICHTEXT_STYLESHEET_CHANGING or
+ @c wxEVT_RICHTEXT_STYLESHEET_CHANGED event handler.
*/
- wxRichTextStyleSheet* GetNewStyleSheet() const { return m_newStyleSheet; }
+ wxRichTextStyleSheet* GetNewStyleSheet() const;
/**
Sets the new style sheet variable.
*/
- void SetNewStyleSheet(wxRichTextStyleSheet* sheet) { m_newStyleSheet = sheet; }
+ void SetNewStyleSheet(wxRichTextStyleSheet* sheet);
/**
Gets the range for the current operation.
*/
- const wxRichTextRange& GetRange() const { return m_range; }
+ const wxRichTextRange& GetRange() const;
/**
Sets the range variable.
*/
- void SetRange(const wxRichTextRange& range) { m_range = range; }
+ void SetRange(const wxRichTextRange& range);
/**
- Returns the character pressed, within a @c wxEVT_COMMAND_RICHTEXT_CHARACTER event.
+ Returns the character pressed, within a @c wxEVT_RICHTEXT_CHARACTER event.
*/
- wxChar GetCharacter() const { return m_char; }
+ wxChar GetCharacter() const;
/**
Sets the character variable.
*/
- void SetCharacter(wxChar ch) { m_char = ch; }
+ void SetCharacter(wxChar ch);
/**
Returns the container for which the event is relevant.
*/
- wxRichTextParagraphLayoutBox* GetContainer() const { return m_container; }
+ wxRichTextParagraphLayoutBox* GetContainer() const;
/**
Sets the container for which the event is relevant.
*/
- void SetContainer(wxRichTextParagraphLayoutBox* container) { m_container = container; }
+ void SetContainer(wxRichTextParagraphLayoutBox* container);
/**
Returns the old container, for a focus change event.
*/
- wxRichTextParagraphLayoutBox* GetOldContainer() const { return m_oldContainer; }
+ wxRichTextParagraphLayoutBox* GetOldContainer() const;
/**
Sets the old container, for a focus change event.
*/
- void SetOldContainer(wxRichTextParagraphLayoutBox* container) { m_oldContainer = container; }
+ void SetOldContainer(wxRichTextParagraphLayoutBox* container);
- virtual wxEvent *Clone() const { return new wxRichTextEvent(*this); }
+ virtual wxEvent *Clone() const;
protected:
int m_flags;
wxRichTextParagraphLayoutBox* m_container;
wxRichTextParagraphLayoutBox* m_oldContainer;
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxRichTextEvent)
};
+
+
+wxEventType wxEVT_RICHTEXT_LEFT_CLICK;
+wxEventType wxEVT_RICHTEXT_RIGHT_CLICK;
+wxEventType wxEVT_RICHTEXT_MIDDLE_CLICK;
+wxEventType wxEVT_RICHTEXT_LEFT_DCLICK;
+wxEventType wxEVT_RICHTEXT_RETURN;
+wxEventType wxEVT_RICHTEXT_CHARACTER;
+wxEventType wxEVT_RICHTEXT_DELETE;
+
+wxEventType wxEVT_RICHTEXT_STYLESHEET_CHANGING;
+wxEventType wxEVT_RICHTEXT_STYLESHEET_CHANGED;
+wxEventType wxEVT_RICHTEXT_STYLESHEET_REPLACING;
+wxEventType wxEVT_RICHTEXT_STYLESHEET_REPLACED;
+
+wxEventType wxEVT_RICHTEXT_CONTENT_INSERTED;
+wxEventType wxEVT_RICHTEXT_CONTENT_DELETED;
+wxEventType wxEVT_RICHTEXT_STYLE_CHANGED;
+wxEventType wxEVT_RICHTEXT_PROPERTIES_CHANGED;
+wxEventType wxEVT_RICHTEXT_SELECTION_CHANGED;
+wxEventType wxEVT_RICHTEXT_BUFFER_RESET;
+wxEventType wxEVT_RICHTEXT_FOCUS_OBJECT_CHANGED;