2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: richtext/richtextctrl.h
|
2008-10-09 12:30:57 -04:00
|
|
|
// Purpose: interface of wxRichTextCtrl and wxRichTextEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxRichTextEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This is the event class for wxRichTextCtrl notifications.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-09 12:30:57 -04:00
|
|
|
@beginEventTable{wxRichTextEvent}
|
|
|
|
@event{EVT_RICHTEXT_CHARACTER(id, func)}
|
|
|
|
Process a wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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_CONTENT_INSERTED(id, func)}
|
|
|
|
Process a wxEVT_COMMAND_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 wxEVT_COMMAND_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 wxEVT_COMMAND_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.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxrichtext}
|
2008-10-09 12:30:57 -04:00
|
|
|
@category{events,richtext}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxRichTextEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-06-27 17:32:25 -04:00
|
|
|
Copy constructor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxRichTextEvent(const wxRichTextEvent& event);
|
2008-06-27 17:32:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
|
2008-10-09 12:30:57 -04:00
|
|
|
@param commandType
|
|
|
|
The type of the event.
|
2008-06-27 17:32:25 -04:00
|
|
|
@param id
|
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
|
|
|
*/
|
|
|
|
wxRichTextEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the character pressed, within a wxEVT_COMMAND_RICHTEXT_CHARACTER event.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxChar GetCharacter() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns flags indicating modifier keys pressed.
|
|
|
|
|
|
|
|
Possible values are wxRICHTEXT_CTRL_DOWN, wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetFlags() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns the new style sheet.
|
|
|
|
|
|
|
|
Can be used in a wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
|
2008-03-08 08:52:38 -05:00
|
|
|
wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextStyleSheet* GetNewStyleSheet() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns the old style sheet.
|
|
|
|
|
|
|
|
Can be used in a wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGING or
|
2008-03-08 08:52:38 -05:00
|
|
|
wxEVT_COMMAND_RICHTEXT_STYLESHEET_CHANGED event handler.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextStyleSheet* GetOldStyleSheet() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the buffer position at which the event occured.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
long GetPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the range for the current operation.
|
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
const wxRichTextRange& GetRange() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the character variable.
|
|
|
|
*/
|
|
|
|
void SetCharacter(wxChar ch);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Sets flags indicating modifier keys pressed.
|
|
|
|
|
|
|
|
Possible values are wxRICHTEXT_CTRL_DOWN, wxRICHTEXT_SHIFT_DOWN, and wxRICHTEXT_ALT_DOWN.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetFlags(int flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the new style sheet variable.
|
|
|
|
*/
|
|
|
|
void SetNewStyleSheet(wxRichTextStyleSheet* sheet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the old style sheet variable.
|
|
|
|
*/
|
|
|
|
void SetOldStyleSheet(wxRichTextStyleSheet* sheet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the buffer position variable.
|
|
|
|
*/
|
|
|
|
void SetPosition(long pos);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the range variable.
|
|
|
|
*/
|
|
|
|
void SetRange(const wxRichTextRange& range);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxRichTextCtrl
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxRichTextCtrl provides a generic, ground-up implementation of a text control
|
|
|
|
capable of showing multiple styles and images.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxRichTextCtrl sends notification events: see wxRichTextEvent.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
It also sends the standard wxTextCtrl events wxEVT_COMMAND_TEXT_ENTER and
|
2008-10-09 12:30:57 -04:00
|
|
|
wxEVT_COMMAND_TEXT_UPDATED, and wxTextUrlEvent when URL content is clicked.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-06-27 17:32:25 -04:00
|
|
|
For more information, see the @ref overview_richtextctrl.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-01-21 07:06:21 -05:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxRE_CENTRE_CARET}
|
|
|
|
The control will try to keep the caret line centred vertically while editing.
|
|
|
|
wxRE_CENTER_CARET is a synonym for this style.
|
|
|
|
@style{wxRE_MULTILINE}
|
|
|
|
The control will be multiline (mandatory).
|
|
|
|
@style{wxRE_READONLY}
|
|
|
|
The control will not be editable.
|
|
|
|
@endStyleTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxrichtext}
|
2008-03-09 13:09:29 -04:00
|
|
|
@category{richtext}
|
2008-11-28 18:48:58 -05:00
|
|
|
@appearance{richtextctrl.png}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxRichTextCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-06-27 17:32:25 -04:00
|
|
|
Default Constructor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxRichTextCtrl();
|
2008-06-27 17:32:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Constructor, creating and showing a rich text control.
|
|
|
|
|
|
|
|
@param parent
|
|
|
|
Parent window. Must not be @NULL.
|
|
|
|
@param id
|
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
|
|
|
@param value
|
|
|
|
Default string.
|
|
|
|
@param pos
|
|
|
|
Window position.
|
|
|
|
@param size
|
|
|
|
Window size.
|
|
|
|
@param style
|
|
|
|
Window style.
|
|
|
|
@param validator
|
|
|
|
Window validator.
|
|
|
|
@param name
|
|
|
|
Window name.
|
|
|
|
|
|
|
|
@see Create(), wxValidator
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxRichTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxRE_MULTILINE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxTextCtrlNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxRichTextCtrl();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Adds an image to the control's buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxRichTextRange AddImage(const wxImage& image);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Adds a new paragraph of text to the end of the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxRichTextRange AddParagraph(const wxString& text);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the insertion point to the end of the buffer and writes the text.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void AppendText(const wxString& text);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies the given alignment to the selection (undoable).
|
|
|
|
For alignment values, see wxTextAttr.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Apples bold to the selection (undoable).
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ApplyBoldToSelection();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies italic to the selection (undoable).
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ApplyItalicToSelection();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies the given style to the selection.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ApplyStyle(wxRichTextStyleDefinition* def);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies the style sheet to the buffer, matching paragraph styles in the sheet
|
2008-10-09 12:30:57 -04:00
|
|
|
against named styles in the buffer.
|
|
|
|
|
|
|
|
This might be useful if the styles have changed.
|
|
|
|
If @a sheet is @NULL, the sheet set with SetStyleSheet() is used.
|
2008-03-08 08:52:38 -05:00
|
|
|
Currently this applies paragraph styles only.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool ApplyStyleSheet(wxRichTextStyleSheet* sheet = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Applies underline to the selection (undoable).
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ApplyUnderlineToSelection();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if undo commands are being batched.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool BatchingUndo() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Begins using alignment.
|
2008-03-08 08:52:38 -05:00
|
|
|
For alignment values, see wxTextAttr.
|
|
|
|
*/
|
|
|
|
bool BeginAlignment(wxTextAttrAlignment alignment);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Starts batching undo history for commands.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool BeginBatchUndo(const wxString& cmdName);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using bold.
|
|
|
|
*/
|
|
|
|
bool BeginBold();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using the named character style.
|
|
|
|
*/
|
|
|
|
bool BeginCharacterStyle(const wxString& characterStyle);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using this font.
|
|
|
|
*/
|
|
|
|
bool BeginFont(const wxFont& font);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using the given point size.
|
|
|
|
*/
|
|
|
|
bool BeginFontSize(int pointSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using italic.
|
|
|
|
*/
|
|
|
|
bool BeginItalic();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins applying a left indent and subindent in tenths of a millimetre.
|
2008-10-09 12:30:57 -04:00
|
|
|
The subindent is an offset from the left edge of the paragraph, and is
|
|
|
|
used for all but the first line in a paragraph. A positive value will
|
2008-06-27 17:32:25 -04:00
|
|
|
cause the first line to appear to the left of the subsequent lines, and
|
|
|
|
a negative value will cause the first line to be indented to the right
|
|
|
|
of the subsequent lines.
|
|
|
|
|
|
|
|
wxRichTextBuffer uses indentation to render a bulleted item. The
|
|
|
|
content of the paragraph, including the first line, starts at the
|
|
|
|
@a leftIndent plus the @a leftSubIndent.
|
|
|
|
|
|
|
|
@param leftIndent
|
|
|
|
The distance between the margin and the bullet.
|
|
|
|
@param leftSubIndent
|
|
|
|
The distance between the left edge of the bullet and the left edge
|
|
|
|
of the actual paragraph.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins appling line spacing. @e spacing is a multiple, where 10 means
|
2008-10-09 12:30:57 -04:00
|
|
|
single-spacing, 15 means 1.5 spacing, and 20 means double spacing.
|
|
|
|
|
|
|
|
The ::wxTextAttrLineSpacing constants are defined for convenience.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool BeginLineSpacing(int lineSpacing);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Begins using a specified list style.
|
|
|
|
Optionally, you can also pass a level and a number.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool BeginListStyle(const wxString& listStyle, int level = 1,
|
|
|
|
int number = 1);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Begins a numbered bullet.
|
|
|
|
|
|
|
|
This call will be needed for each item in the list, and the
|
2008-03-08 08:52:38 -05:00
|
|
|
application should take care of incrementing the numbering.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a bulletNumber is a number, usually starting with 1.
|
|
|
|
@a leftIndent and @a leftSubIndent are values in tenths of a millimetre.
|
2008-10-09 12:30:57 -04:00
|
|
|
@a bulletStyle is a bitlist of the ::wxTextAttrBulletStyle values.
|
|
|
|
|
|
|
|
wxRichTextBuffer uses indentation to render a bulleted item.
|
|
|
|
The left indent is the distance between the margin and the bullet.
|
|
|
|
The content of the paragraph, including the first line, starts
|
|
|
|
at leftMargin + leftSubIndent.
|
|
|
|
So the distance between the left edge of the bullet and the
|
2008-03-08 08:52:38 -05:00
|
|
|
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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing
|
2008-10-09 12:30:57 -04:00
|
|
|
in tenths of a millimetre.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool BeginParagraphSpacing(int before, int after);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins applying the named paragraph style.
|
|
|
|
*/
|
|
|
|
bool BeginParagraphStyle(const wxString& paragraphStyle);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins a right indent, specified in tenths of a millimetre.
|
|
|
|
*/
|
|
|
|
bool BeginRightIndent(int rightIndent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins applying a style.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool BeginStyle(const wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Starts suppressing undo history for commands.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool BeginSuppressUndo();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
bool BeginSymbolBullet(const wxString& symbol, int leftIndent,
|
2008-03-08 08:52:38 -05:00
|
|
|
int leftSubIndent,
|
|
|
|
int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using this colour.
|
|
|
|
*/
|
|
|
|
bool BeginTextColour(const wxColour& colour);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool BeginURL(const wxString& url,
|
|
|
|
const wxString& characterStyle = wxEmptyString);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Begins using underlining.
|
|
|
|
*/
|
|
|
|
bool BeginUnderline();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if selected content can be copied to the clipboard.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanCopy() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if selected content can be copied to the clipboard and deleted.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanCut() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if selected content can be deleted.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanDeleteSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the clipboard content can be pasted to the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanPaste() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if there is a command in the command history that can be redone.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanRedo() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if there is a command in the command history that can be undone.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool CanUndo() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Clear();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Clears the list style from the given range, clearing list-related attributes
|
|
|
|
and applying any named paragraph style associated with each paragraph.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags is a bit list of the following:
|
2008-10-09 12:30:57 -04:00
|
|
|
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
|
|
|
|
|
|
|
|
@see SetListStyle(), PromoteList(), NumberList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
virtual bool ClearListStyle(const wxRichTextRange& range,
|
2008-03-08 08:52:38 -05:00
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sends the event to the control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Command(wxCommandEvent& event);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Copies the selected content (if any) to the clipboard.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Copy();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the underlying window.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxString& value = wxEmptyString,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxRE_MULTILINE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxTextCtrlNameStr);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Copies the selected content (if any) to the clipboard and deletes the selection.
|
|
|
|
This is undoable.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Cut();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes the content within the given range.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool Delete(const wxRichTextRange& range);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes content if there is a selection, e.g. when pressing a key.
|
|
|
|
Returns the new caret position in @e newPos, or leaves it if there
|
|
|
|
was no action. This is undoable.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool DeleteSelectedContent(long* newPos = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Deletes the content in the selection, if any. This is undoable.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void DeleteSelection();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the buffer's modified status to @false, and clears the buffer's command
|
|
|
|
history.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void DiscardEdits();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Ends alignment.
|
|
|
|
*/
|
|
|
|
bool EndAlignment();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends application of all styles in the current style stack.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool EndAllStyles();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Ends batching undo command history.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool EndBatchUndo();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Ends using bold.
|
|
|
|
*/
|
|
|
|
bool EndBold();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends application of a named character style.
|
|
|
|
*/
|
|
|
|
bool EndCharacterStyle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends using a font.
|
|
|
|
*/
|
|
|
|
bool EndFont();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends using a point size.
|
|
|
|
*/
|
|
|
|
bool EndFontSize();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends using italic.
|
|
|
|
*/
|
|
|
|
bool EndItalic();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends left indent.
|
|
|
|
*/
|
|
|
|
bool EndLeftIndent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends line spacing.
|
|
|
|
*/
|
|
|
|
bool EndLineSpacing();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends using a specified list style.
|
|
|
|
*/
|
|
|
|
bool EndListStyle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends application of a numbered bullet.
|
|
|
|
*/
|
|
|
|
bool EndNumberedBullet();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends paragraph spacing.
|
|
|
|
*/
|
|
|
|
bool EndParagraphSpacing();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends application of a named character style.
|
|
|
|
*/
|
|
|
|
bool EndParagraphStyle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends right indent.
|
|
|
|
*/
|
|
|
|
bool EndRightIndent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends the current style.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool EndStyle();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Ends suppressing undo command history.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool EndSuppressUndo();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Ends applying a symbol bullet.
|
|
|
|
*/
|
|
|
|
bool EndSymbolBullet();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends applying a text colour.
|
|
|
|
*/
|
|
|
|
bool EndTextColour();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Ends applying a URL.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool EndURL();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
End applying underlining.
|
|
|
|
*/
|
|
|
|
bool EndUnderline();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function for extending the selection, returning @true if the selection
|
2008-10-09 12:30:57 -04:00
|
|
|
was changed. Selections are in caret positions.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual bool ExtendSelection(long oldPosition, long newPosition, int flags);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Helper function for finding the caret position for the next word.
|
|
|
|
Direction is 1 (forward) or -1 (backwards).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual long FindNextWordPosition(int direction = 1) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Call this function to prevent refresh and allow fast updates, and then Thaw() to
|
|
|
|
refresh the control.
|
|
|
|
*/
|
|
|
|
void Freeze();
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Gets the basic (overall) style.
|
|
|
|
|
|
|
|
This is the style of the whole buffer before further styles are applied,
|
|
|
|
unlike the default style, which only affects the style currently being
|
|
|
|
applied (for example, setting the default style to bold will cause
|
|
|
|
subsequently inserted text to be bold).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual const wxTextAttr& GetBasicStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Returns the buffer associated with the control.
|
|
|
|
*/
|
|
|
|
const wxRichTextBuffer GetBuffer();
|
2008-03-09 12:24:26 -04:00
|
|
|
const wxRichTextBuffer& GetBuffer();
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current caret position.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
long GetCaretPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns the caret height and position for the given character position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool GetCaretPositionForIndex(long position, wxRect& rect);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the command processor associated with the control's buffer.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxCommandProcessor* GetCommandProcessor() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current default style, which can be used to change how subsequently
|
2008-10-09 12:30:57 -04:00
|
|
|
inserted text is displayed.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
virtual const wxTextAttr& GetDefaultStyle() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the size of the buffer beyond which layout is delayed during resizing.
|
|
|
|
This optimizes sizing for large buffers. The default is 20000.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
long GetDelayedLayoutThreshold() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the current filename associated with the control.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxString GetFilename() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the first visible position in the current view.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
long GetFirstVisiblePosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetHandlerFlags() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current insertion point.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual long GetInsertionPoint() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the last position in the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTextPos GetLastPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the length of the specified line in characters.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetLineLength(long lineNo) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the text for the given line.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetLineText(long lineNo) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Transforms physical window position to logical (unscrolled) position.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of lines in the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual int GetNumberOfLines() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Transforms logical (unscrolled) position to physical window position.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the text for the given range.
|
2008-10-09 12:30:57 -04:00
|
|
|
The end point of range is specified as the last character position of
|
|
|
|
the span of text, plus one.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetRange(long from, long to) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the range of the current selection.
|
|
|
|
The end point of range is specified as the last character position of the span
|
|
|
|
of text, plus one.
|
2008-03-09 08:33:59 -04:00
|
|
|
If the return values @a from and @a to are the same, there is no selection.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void GetSelection(long* from, long* to) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the selection range in character positions. -1, -1 means no selection.
|
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
wxRichTextRange GetSelectionRange() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the text within the current selection range, if any.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetStringSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the attributes at the given position.
|
|
|
|
This function gets the combined style - that is, the style you see on the
|
2008-10-09 12:30:57 -04:00
|
|
|
screen as a result of combining base style, paragraph style and character
|
|
|
|
style attributes.
|
|
|
|
|
|
|
|
To get the character or paragraph style alone, use GetUncombinedStyle().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool GetStyle(long position, wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Gets the attributes common to the specified range.
|
|
|
|
Attributes that differ in value within the range will not be included
|
|
|
|
in @a style flags.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual bool GetStyleForRange(const wxRichTextRange& range,
|
|
|
|
wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns the style sheet associated with the control, if any.
|
|
|
|
A style sheet allows named character and paragraph styles to be applied.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextStyleSheet* GetStyleSheet() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Gets the attributes at the given position.
|
|
|
|
This function gets the @e uncombined style - that is, the attributes associated
|
2008-10-09 12:30:57 -04:00
|
|
|
with the paragraph or character content, and not necessarily the combined
|
|
|
|
attributes you see on the screen.
|
|
|
|
To get the combined attributes, use GetStyle().
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
If you specify (any) paragraph attribute in @e style's flags, this function
|
2008-10-09 12:30:57 -04:00
|
|
|
will fetch the paragraph attributes.
|
|
|
|
Otherwise, it will return the character attributes.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool GetUncombinedStyle(long position, wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the content of the entire control as a string.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetValue() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Internal helper function returning the line for the visible caret position.
|
|
|
|
If the caret is shown at the very end of the line, it means the next character
|
|
|
|
is actually on the following line.
|
|
|
|
So this function gets the line we're expecting to find if this is the case.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
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 can use this to implement, for example, bold button updating.
|
|
|
|
@a style must have flags indicating which attributes are of interest.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual bool HasCharacterAttributes(const wxRichTextRange& range,
|
|
|
|
const wxTextAttr& style) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Test if this whole range has paragraph attributes of the specified kind.
|
|
|
|
If any of the attributes are different within the range, the test fails.
|
|
|
|
You can use this to implement, for example, centering button updating.
|
|
|
|
@a style must have flags indicating which attributes are of interest.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual bool HasParagraphAttributes(const wxRichTextRange& range,
|
|
|
|
const wxTextAttr& style) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if there is a selection.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool HasSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Finds the character at the given position in pixels.
|
2008-03-09 08:33:59 -04:00
|
|
|
@a pt is in device coords (not adjusted for the client area origin nor for
|
2008-03-08 08:52:38 -05:00
|
|
|
scrolling).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long* pos) const;
|
|
|
|
const wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
|
|
|
|
wxTextCoord* col,
|
|
|
|
wxTextCoord* row) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initialises the members of the control.
|
|
|
|
*/
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the user has recently set the default style without moving
|
2008-10-09 12:30:57 -04:00
|
|
|
the caret, and therefore the UI needs to reflect the default style and not
|
|
|
|
the style at the caret.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Below is an example of code that uses this function to determine whether the UI
|
|
|
|
should show that the current style is bold.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
@see SetAndShowDefaultStyle().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsDefaultStyleShowing() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the control is editable.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsEditable() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if Freeze has been called without a Thaw.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsFrozen() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the buffer has been modified.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsModified() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the control is multiline.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsMultiLine() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the given position is visible on the screen.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsPositionVisible(long pos) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns @true if all of the selection is aligned according to the specified flag.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsSelectionAligned(wxTextAttrAlignment alignment);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if all of the selection is bold.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsSelectionBold();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if all of the selection is italic.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsSelectionItalics();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if all of the selection is underlined.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsSelectionUnderlined();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Returns @true if the control is single-line.
|
|
|
|
Currently wxRichTextCtrl does not support single-line editing.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsSingleLine() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Helper function implementing keyboard navigation.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool KeyboardNavigate(int keyCode, int flags);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Lays out the buffer, which must be done before certain operations, such as
|
2008-10-09 12:30:57 -04:00
|
|
|
setting the caret position.
|
|
|
|
This function should not normally be required by the application.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool LayoutContent(bool onlyVisibleRect = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Inserts a line break at the current insertion point.
|
|
|
|
|
|
|
|
A line break forces wrapping within a paragraph, and can be introduced by
|
|
|
|
using this function, by appending the wxChar value @b wxRichTextLineBreakChar
|
|
|
|
to text content, or by typing Shift-Return.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool LineBreak();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Loads content into the control's buffer using the given type.
|
|
|
|
|
|
|
|
If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
|
|
|
|
the filename extension.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function looks for a suitable wxRichTextFileHandler object.
|
|
|
|
*/
|
|
|
|
bool LoadFile(const wxString& file,
|
|
|
|
int type = wxRICHTEXT_TYPE_ANY);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Marks the buffer as modified.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void MarkDirty();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Move the caret to the given character position.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveCaret(long pos, bool showAtLineStart = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Move the caret one visual step forward: this may mean setting a flag
|
|
|
|
and keeping the same position if we're going from the end of one line
|
|
|
|
to the start of the next, which may be the exact same caret position.
|
|
|
|
*/
|
|
|
|
void MoveCaretBack(long oldPosition);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Move the caret one visual step forward: this may mean setting a flag
|
|
|
|
and keeping the same position if we're going from the end of one line
|
|
|
|
to the start of the next, which may be the exact same caret position.
|
|
|
|
*/
|
|
|
|
void MoveCaretForward(long oldPosition);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Moves the caret down.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveDown(int noLines = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the end of the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveEnd(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the start of the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveHome(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves left.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveLeft(int noPositions = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves right.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveRight(int noPositions = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the end of the line.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveToLineEnd(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the start of the line.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveToLineStart(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the end of the paragraph.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveToParagraphEnd(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves to the start of the paragraph.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveToParagraphStart(int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves up.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool MoveUp(int noLines = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Inserts a new paragraph at the current insertion point. @see LineBreak().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool Newline();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Numbers the paragraphs in the given range.
|
|
|
|
Pass flags to determine how the attributes are set.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Either the style definition or the name of the style definition (in the current
|
|
|
|
sheet) can be passed.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags is a bit list of the following:
|
2008-10-09 12:30:57 -04:00
|
|
|
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
|
|
|
|
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
|
|
|
|
@a startFrom, otherwise existing attributes are used.
|
|
|
|
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
|
|
|
|
as the level for all paragraphs, otherwise the current indentation will be used.
|
|
|
|
|
|
|
|
@see SetListStyle(), PromoteList(), ClearListStyle().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool NumberList(const wxRichTextRange& range,
|
|
|
|
const wxRichTextListStyleDefinition* style,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int startFrom = -1,
|
|
|
|
int listLevel = -1);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool Number(const wxRichTextRange& range,
|
|
|
|
const wxString& styleName,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int startFrom = -1,
|
|
|
|
int listLevel = -1);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_CLEAR command.
|
|
|
|
*/
|
|
|
|
void OnClear(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Shows a standard context menu with undo, redo, cut, copy, paste, clear, and
|
|
|
|
select all commands.
|
|
|
|
*/
|
|
|
|
void OnContextMenu(wxContextMenuEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_COPY command.
|
|
|
|
*/
|
|
|
|
void OnCopy(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_CUT command.
|
|
|
|
*/
|
|
|
|
void OnCut(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Loads the first dropped file.
|
|
|
|
*/
|
|
|
|
void OnDropFiles(wxDropFilesEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_PASTE command.
|
|
|
|
*/
|
|
|
|
void OnPaste(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_REDO command.
|
|
|
|
*/
|
|
|
|
void OnRedo(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_SELECTALL command.
|
|
|
|
*/
|
|
|
|
void OnSelectAll(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard handler for the wxID_PASTE command.
|
|
|
|
*/
|
|
|
|
void OnUndo(wxCommandEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_CLEAR command.
|
|
|
|
*/
|
|
|
|
void OnUpdateClear(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_COPY command.
|
|
|
|
*/
|
|
|
|
void OnUpdateCopy(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_CUT command.
|
|
|
|
*/
|
|
|
|
void OnUpdateCut(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_PASTE command.
|
|
|
|
*/
|
|
|
|
void OnUpdatePaste(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_REDO command.
|
|
|
|
*/
|
|
|
|
void OnUpdateRedo(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_SELECTALL command.
|
|
|
|
*/
|
|
|
|
void OnUpdateSelectAll(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Standard update handler for the wxID_UNDO command.
|
|
|
|
*/
|
|
|
|
void OnUpdateUndo(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Moves one or more pages down.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool PageDown(int noPages = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves one or more pages up.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool PageUp(int noPages = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Paints the background.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void PaintBackground(wxDC& dc);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Pastes content from the clipboard to the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Paste();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Internal function to position the visible caret according to the current caret
|
|
|
|
position.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void PositionCaret();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Converts a text position to zero-based column and line numbers.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool PositionToXY(long pos, long* x, long* y) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Promotes or demotes the paragraphs in the given range.
|
|
|
|
A positive @a promoteBy produces a smaller indent, and a negative number
|
2008-03-08 08:52:38 -05:00
|
|
|
produces a larger indent. Pass flags to determine how the attributes are set.
|
|
|
|
Either the style definition or the name of the style definition (in the current
|
|
|
|
sheet) can be passed.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags is a bit list of the following:
|
2008-10-09 12:30:57 -04:00
|
|
|
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
|
|
|
|
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
|
|
|
|
@a startFrom, otherwise existing attributes are used.
|
|
|
|
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
|
2008-03-08 08:52:38 -05:00
|
|
|
as the level for all paragraphs, otherwise the current indentation will be used.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
@see SetListStyle(), @see SetListStyle(), ClearListStyle().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool PromoteList(int promoteBy, const wxRichTextRange& range,
|
|
|
|
const wxRichTextListStyleDefinition* style,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int listLevel = -1);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool PromoteList(int promoteBy, const wxRichTextRange& range,
|
|
|
|
const wxString& styleName,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int listLevel = -1);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Redoes the current command.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Redo();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Removes the content in the specified range.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Remove(long from, long to);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Replaces the content in the specified range with the string specified by
|
|
|
|
@a value.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Replace(long from, long to, const wxString& value);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Saves the buffer content using the given type.
|
|
|
|
|
|
|
|
If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from
|
|
|
|
the filename extension.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function looks for a suitable wxRichTextFileHandler object.
|
|
|
|
*/
|
|
|
|
bool SaveFile(const wxString& file = wxEmptyString,
|
|
|
|
int type = wxRICHTEXT_TYPE_ANY);
|
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Scrolls @a position into view. This function takes a caret position.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ScrollIntoView(long position, int keyCode);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Selects all the text in the buffer.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SelectAll();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Cancels any selection.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SelectNone();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Sets @a attr as the default style and tells the control that the UI should
|
2008-10-09 12:30:57 -04:00
|
|
|
reflect this attribute until the user moves the caret.
|
|
|
|
|
|
|
|
@see IsDefaultStyleShowing().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetAndShowDefaultStyle(const wxTextAttr& attr);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Sets the basic (overall) style.
|
|
|
|
|
|
|
|
This is the style of the whole buffer before further styles are applied,
|
|
|
|
unlike the default style, which only affects the style currently being
|
|
|
|
applied (for example, setting the default style to bold will cause
|
|
|
|
subsequently inserted text to be bold).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetBasicStyle(const wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
The caret position is the character position just before the caret.
|
|
|
|
A value of -1 means the caret is at the start of the buffer.
|
|
|
|
*/
|
|
|
|
void SetCaretPosition(long position,
|
2008-03-09 08:33:59 -04:00
|
|
|
bool showAtLineStart = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the current default style, which can be used to change how subsequently
|
2008-10-09 12:30:57 -04:00
|
|
|
inserted text is displayed.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool SetDefaultStyle(const wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the default style to the style under the cursor.
|
|
|
|
*/
|
|
|
|
bool SetDefaultStyleToCursorStyle();
|
|
|
|
|
|
|
|
/**
|
|
|
|
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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Makes the control editable, or not.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetEditable(bool editable);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the current filename.
|
|
|
|
*/
|
|
|
|
void SetFilename(const wxString& filename);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Sets the font, and also the basic and default attributes
|
|
|
|
(see wxRichTextCtrl::SetDefaultStyle).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool SetFont(const wxFont& font);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Sets 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.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetHandlerFlags(int flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the insertion point.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetInsertionPoint(long pos);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the insertion point to the end of the text control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetInsertionPointEnd();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Sets the list attributes for the given range, passing flags to determine how
|
|
|
|
the attributes are set.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Either the style definition or the name of the style definition (in the current
|
|
|
|
sheet) can be passed.
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags is a bit list of the following:
|
2008-10-09 12:30:57 -04:00
|
|
|
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this command will be undoable.
|
|
|
|
- wxRICHTEXT_SETSTYLE_RENUMBER: specifies that numbering should start from
|
|
|
|
@a startFrom, otherwise existing attributes are used.
|
|
|
|
- wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL: specifies that @a listLevel should be used
|
|
|
|
as the level for all paragraphs, otherwise the current indentation will be used.
|
|
|
|
|
|
|
|
@see NumberList(), PromoteList(), ClearListStyle().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool SetListStyle(const wxRichTextRange& range,
|
|
|
|
const wxRichTextListStyleDefinition* style,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int startFrom = -1,
|
|
|
|
int listLevel = -1);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool SetListStyle(const wxRichTextRange& range,
|
|
|
|
const wxString& styleName,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
|
|
|
|
int startFrom = -1,
|
|
|
|
int listLevel = -1);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the selection to the given range.
|
|
|
|
The end point of range is specified as the last character position of the span
|
|
|
|
of text, plus one.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
So, for example, to set the selection for a character at position 5, use the
|
|
|
|
range (5,6).
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetSelection(long from, long to);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the selection to the given range.
|
|
|
|
The end point of range is specified as the last character position of the span
|
|
|
|
of text, plus one.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
So, for example, to set the selection for a character at position 5, use the
|
|
|
|
range (5,6).
|
|
|
|
*/
|
|
|
|
void SetSelectionRange(const wxRichTextRange& range);
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Sets the attributes for the given range.
|
|
|
|
The end point of range is specified as the last character position of the span
|
|
|
|
of text, plus one.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
So, for example, to set the style for a character at position 5, use the range
|
|
|
|
(5,6).
|
|
|
|
*/
|
|
|
|
bool SetStyle(const wxRichTextRange& range,
|
|
|
|
const wxTextAttr& style);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool SetStyle(long start, long end, const wxTextAttr& style);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the attributes for the given range, passing flags to determine how the
|
|
|
|
attributes are set.
|
2008-10-09 12:30:57 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
The end point of range is specified as the last character position of the span
|
2008-10-09 12:30:57 -04:00
|
|
|
of text, plus one. So, for example, to set the style for a character at
|
|
|
|
position 5, use the range (5,6).
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@a flags may contain a bit list of the following values:
|
2008-10-09 12:30:57 -04:00
|
|
|
- wxRICHTEXT_SETSTYLE_NONE: no style flag.
|
|
|
|
- wxRICHTEXT_SETSTYLE_WITH_UNDO: specifies that this operation should be
|
|
|
|
undoable.
|
|
|
|
- wxRICHTEXT_SETSTYLE_OPTIMIZE: specifies that the style should not be applied
|
|
|
|
if the combined style at this point is already the style in question.
|
|
|
|
- wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY: specifies that the style should only be
|
|
|
|
applied to paragraphs, and not the content.
|
|
|
|
This allows content styling to be preserved independently from that
|
|
|
|
of e.g. a named paragraph style.
|
|
|
|
- wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY: specifies that the style should only be
|
|
|
|
applied to characters, and not the paragraph.
|
|
|
|
This allows content styling to be preserved independently from that
|
|
|
|
of e.g. a named paragraph style.
|
|
|
|
- wxRICHTEXT_SETSTYLE_RESET: resets (clears) the existing style before applying
|
|
|
|
the new style.
|
|
|
|
- wxRICHTEXT_SETSTYLE_REMOVE: removes the specified style. Only the style flags
|
|
|
|
are used in this operation.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-01-10 17:42:09 -05:00
|
|
|
virtual bool SetStyleEx(const wxRichTextRange& range,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxTextAttr& style,
|
|
|
|
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
|
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Sets the style sheet associated with the control.
|
|
|
|
A style sheet allows named character and paragraph styles to be applied.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Replaces existing content with the given text.
|
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
virtual void SetValue(const wxString& value);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
A helper function setting up scrollbars, for example after a resize.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetupScrollbars(bool atTop = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Scrolls the buffer so that the given position is in view.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void ShowPosition(long pos);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if undo history suppression is on.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool SuppressingUndo() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Call this function to end a Freeze and refresh the display.
|
|
|
|
*/
|
|
|
|
void Thaw();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Undoes the command at the top of the command history, if there is one.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Undo();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Moves a number of words to the left.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool WordLeft(int noWords = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Move a nuber of words to the right.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool WordRight(int noWords = 1, int flags = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-09 12:30:57 -04:00
|
|
|
Loads an image from a file and writes it at the current insertion point.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-13 16:32:53 -05:00
|
|
|
virtual bool WriteImage(const wxString& filename, wxBitmapType bitmapType);
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Writes an image block at the current insertion point.
|
|
|
|
*/
|
2008-10-13 07:09:56 -04:00
|
|
|
virtual bool WriteImage(const wxRichTextImageBlock& imageBlock);
|
2008-10-09 12:30:57 -04:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Write a bitmap or image at the current insertion point.
|
|
|
|
Supply an optional type to use for internal and file storage of the raw data.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
bool WriteImage(const wxBitmap& bitmap,
|
|
|
|
int bitmapType = wxBITMAP_TYPE_PNG);
|
|
|
|
bool WriteImage(const wxImage& image,
|
|
|
|
int bitmapType = wxBITMAP_TYPE_PNG);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Writes text at the current position.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void WriteText(const wxString& text);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Translates from column and line number to position.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual long XYToPosition(long x, long y) const;
|
2008-10-29 14:55:57 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/**
|
|
|
|
Currently this simply returns @c wxSize(10, 10).
|
|
|
|
*/
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Initialises the command event.
|
|
|
|
*/
|
|
|
|
void InitCommandEvent(wxCommandEvent& event) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|