Contents Up Previous Next

wxRichTextCtrl

wxRichTextCtrl provides a generic, ground-up implementation of a text control capable of showing multiple styles and images.

Derived from

wxTextCtrlBase

Include files

<wx/richtext/richtextctrl.h>

Data structures

Members

wxRichTextCtrl::wxRichTextCtrl
wxRichTextCtrl::~wxRichTextCtrl
wxRichTextCtrl::AddImage
wxRichTextCtrl::AddParagraph
wxRichTextCtrl::AppendText
wxRichTextCtrl::ApplyAlignmentToSelection
wxRichTextCtrl::ApplyBoldToSelection
wxRichTextCtrl::ApplyItalicToSelection
wxRichTextCtrl::ApplyUnderlineToSelection
wxRichTextCtrl::BatchingUndo
wxRichTextCtrl::BeginAlignment
wxRichTextCtrl::BeginBatchUndo
wxRichTextCtrl::BeginBold
wxRichTextCtrl::BeginCharacterStyle
wxRichTextCtrl::BeginFont
wxRichTextCtrl::BeginFontSize
wxRichTextCtrl::BeginItalic
wxRichTextCtrl::BeginLeftIndent
wxRichTextCtrl::BeginLineSpacing
wxRichTextCtrl::BeginNumberedBullet
wxRichTextCtrl::BeginParagraphSpacing
wxRichTextCtrl::BeginParagraphStyle
wxRichTextCtrl::BeginRightIndent
wxRichTextCtrl::BeginStyle
wxRichTextCtrl::BeginSuppressUndo
wxRichTextCtrl::BeginSymbolBullet
wxRichTextCtrl::BeginTextColour
wxRichTextCtrl::BeginUnderline
wxRichTextCtrl::CanCopy
wxRichTextCtrl::CanCut
wxRichTextCtrl::CanDeleteSelection
wxRichTextCtrl::CanPaste
wxRichTextCtrl::CanRedo
wxRichTextCtrl::CanUndo
wxRichTextCtrl::Clear
wxRichTextCtrl::Command
wxRichTextCtrl::Copy
wxRichTextCtrl::Create
wxRichTextCtrl::Cut
wxRichTextCtrl::DeleteSelectedContent
wxRichTextCtrl::DeleteSelection
wxRichTextCtrl::DiscardEdits
wxRichTextCtrl::DoGetBestSize
wxRichTextCtrl::EndAlignment
wxRichTextCtrl::EndAllStyles
wxRichTextCtrl::EndBatchUndo
wxRichTextCtrl::EndBold
wxRichTextCtrl::EndCharacterStyle
wxRichTextCtrl::EndFont
wxRichTextCtrl::EndFontSize
wxRichTextCtrl::EndItalic
wxRichTextCtrl::EndLeftIndent
wxRichTextCtrl::EndLineSpacing
wxRichTextCtrl::EndNumberedBullet
wxRichTextCtrl::EndParagraphSpacing
wxRichTextCtrl::EndParagraphStyle
wxRichTextCtrl::EndRightIndent
wxRichTextCtrl::EndStyle
wxRichTextCtrl::EndSuppressUndo
wxRichTextCtrl::EndSymbolBullet
wxRichTextCtrl::EndTextColour
wxRichTextCtrl::EndUnderline
wxRichTextCtrl::ExtendSelection
wxRichTextCtrl::FindNextWordPosition
wxRichTextCtrl::Freeze
wxRichTextCtrl::GetBasicStyle
wxRichTextCtrl::GetBuffer
wxRichTextCtrl::GetCaretPosition
wxRichTextCtrl::GetCaretPositionForIndex
wxRichTextCtrl::GetCommandProcessor
wxRichTextCtrl::GetDefaultStyleEx
wxRichTextCtrl::GetDelayedLayoutThreshold
wxRichTextCtrl::GetFilename
wxRichTextCtrl::GetFirstVisiblePosition
wxRichTextCtrl::GetInsertionPoint
wxRichTextCtrl::GetLastPosition
wxRichTextCtrl::GetLineLength
wxRichTextCtrl::GetLineText
wxRichTextCtrl::GetLogicalPoint
wxRichTextCtrl::GetNumberOfLines
wxRichTextCtrl::GetPhysicalPoint
wxRichTextCtrl::GetRange
wxRichTextCtrl::GetSelection
wxRichTextCtrl::GetSelectionRange
wxRichTextCtrl::GetStringSelection
wxRichTextCtrl::GetStyle
wxRichTextCtrl::GetStyleSheet
wxRichTextCtrl::GetValue
wxRichTextCtrl::GetVisibleLineForCaretPosition
wxRichTextCtrl::HasCharacterAttributes
wxRichTextCtrl::HasParagraphAttributes
wxRichTextCtrl::HasSelection
wxRichTextCtrl::HitTest
wxRichTextCtrl::Init
wxRichTextCtrl::InitCommandEvent
wxRichTextCtrl::IsEditable
wxRichTextCtrl::IsFrozen
wxRichTextCtrl::IsModified
wxRichTextCtrl::IsMultiLine
wxRichTextCtrl::IsPositionVisible
wxRichTextCtrl::IsSelectionAligned
wxRichTextCtrl::IsSelectionBold
wxRichTextCtrl::IsSelectionItalics
wxRichTextCtrl::IsSelectionUnderlined
wxRichTextCtrl::IsSingleLine
wxRichTextCtrl::KeyboardNavigate
wxRichTextCtrl::LayoutContent
wxRichTextCtrl::LoadFile
wxRichTextCtrl::MarkDirty
wxRichTextCtrl::MoveCaret
wxRichTextCtrl::MoveCaretBack
wxRichTextCtrl::MoveCaretForward
wxRichTextCtrl::MoveDown
wxRichTextCtrl::MoveEnd
wxRichTextCtrl::MoveHome
wxRichTextCtrl::MoveLeft
wxRichTextCtrl::MoveRight
wxRichTextCtrl::MoveToLineEnd
wxRichTextCtrl::MoveToLineStart
wxRichTextCtrl::MoveToParagraphEnd
wxRichTextCtrl::MoveToParagraphStart
wxRichTextCtrl::MoveUp
wxRichTextCtrl::Newline
wxRichTextCtrl::OnClear
wxRichTextCtrl::OnContextMenu
wxRichTextCtrl::OnCopy
wxRichTextCtrl::OnCut
wxRichTextCtrl::OnDropFiles
wxRichTextCtrl::OnPaste
wxRichTextCtrl::OnRedo
wxRichTextCtrl::OnSelectAll
wxRichTextCtrl::OnUndo
wxRichTextCtrl::OnUpdateClear
wxRichTextCtrl::OnUpdateCopy
wxRichTextCtrl::OnUpdateCut
wxRichTextCtrl::OnUpdatePaste
wxRichTextCtrl::OnUpdateRedo
wxRichTextCtrl::OnUpdateSelectAll
wxRichTextCtrl::OnUpdateUndo
wxRichTextCtrl::PageDown
wxRichTextCtrl::PageUp
wxRichTextCtrl::PaintBackground
wxRichTextCtrl::Paste
wxRichTextCtrl::PositionCaret
wxRichTextCtrl::PositionToXY
wxRichTextCtrl::Redo
wxRichTextCtrl::Remove
wxRichTextCtrl::Replace
wxRichTextCtrl::SaveFile
wxRichTextCtrl::ScrollIntoView
wxRichTextCtrl::SelectAll
wxRichTextCtrl::SelectNone
wxRichTextCtrl::SetBasicStyle
wxRichTextCtrl::SetCaretPosition
wxRichTextCtrl::SetDefaultStyle
wxRichTextCtrl::SetDefaultStyleToCursorStyle
wxRichTextCtrl::SetDelayedLayoutThreshold
wxRichTextCtrl::SetEditable
wxRichTextCtrl::SetFilename
wxRichTextCtrl::SetFont
wxRichTextCtrl::SetInsertionPoint
wxRichTextCtrl::SetInsertionPointEnd
wxRichTextCtrl::SetSelection
wxRichTextCtrl::SetSelectionRange
wxRichTextCtrl::SetStyle
wxRichTextCtrl::SetStyleSheet
wxRichTextCtrl::SetValue
wxRichTextCtrl::SetupScrollbars
wxRichTextCtrl::ShowPosition
wxRichTextCtrl::SuppressingUndo
wxRichTextCtrl::Thaw
wxRichTextCtrl::Undo
wxRichTextCtrl::WordLeft
wxRichTextCtrl::WordRight
wxRichTextCtrl::WriteImage
wxRichTextCtrl::WriteText
wxRichTextCtrl::XYToPosition


wxRichTextCtrl::wxRichTextCtrl

wxRichTextCtrl()

wxRichTextCtrl(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxRE_MULTILINE)

Constructors.


wxRichTextCtrl::~wxRichTextCtrl

~wxRichTextCtrl()

Destructor.


wxRichTextCtrl::AddImage

wxRichTextRange AddImage(const wxImage& image)

Adds an image to the control's buffer.


wxRichTextCtrl::AddParagraph

wxRichTextRange AddParagraph(const wxString& text)

Adds a new paragraph of text to the end of the buffer.


wxRichTextCtrl::AppendText

void AppendText(const wxString& text)

Sets the insertion point to the end of the buffer and writes the text.


wxRichTextCtrl::ApplyAlignmentToSelection

bool ApplyAlignmentToSelection(wxTextAttrAlignment alignment)

Applies the given alignment to the selection (undoable).

For alignment values, see wxTextAttrEx.


wxRichTextCtrl::ApplyBoldToSelection

bool ApplyBoldToSelection()

Apples bold to the selection (undoable).


wxRichTextCtrl::ApplyItalicToSelection

bool ApplyItalicToSelection()

Applies italic to the selection (undoable).


wxRichTextCtrl::ApplyUnderlineToSelection

bool ApplyUnderlineToSelection()

Applies underline to the selection (undoable).


wxRichTextCtrl::BatchingUndo

bool BatchingUndo() const

Returns true if undo commands are being batched.


wxRichTextCtrl::BeginAlignment

bool BeginAlignment(wxTextAttrAlignment alignment)

Begins using alignment

For alignment values, see wxTextAttrEx.


wxRichTextCtrl::BeginBatchUndo

bool BeginBatchUndo(const wxString& cmdName)

Starts batching undo history for commands.


wxRichTextCtrl::BeginBold

bool BeginBold()

Begins using bold.


wxRichTextCtrl::BeginCharacterStyle

bool BeginCharacterStyle(const wxString& characterStyle)

Begins using the named character style.


wxRichTextCtrl::BeginFont

bool BeginFont(const wxFont& font)

Begins using this font.


wxRichTextCtrl::BeginFontSize

bool BeginFontSize(int pointSize)

Begins using the given point size.


wxRichTextCtrl::BeginItalic

bool BeginItalic()

Begins using italic.


wxRichTextCtrl::BeginLeftIndent

bool BeginLeftIndent(int leftIndent, int leftSubIndent = 0)

Begins applying a left indent and subindent in tenths of a millimetre.

The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph. A positive value will 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 relative to the subsequent lines.

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 left of the actual paragraph is leftSubIndent.


wxRichTextCtrl::BeginLineSpacing

bool BeginLineSpacing(int lineSpacing)

Begins appling line spacing. spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means double spacing. The following constants are defined for convenience:

#define wxTEXT_ATTR_LINE_SPACING_NORMAL         10
#define wxTEXT_ATTR_LINE_SPACING_HALF           15
#define wxTEXT_ATTR_LINE_SPACING_TWICE          20


wxRichTextCtrl::BeginNumberedBullet

bool BeginNumberedBullet(int bulletNumber, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD)

Begins a numbered bullet. This call will be needed for each item in the list, and the application should take care of incrementing the numbering.

bulletNumber is a number, usually starting with 1.

leftIndent and leftSubIndent are values in tenths of a millimetre.

bulletStyle is a bitlist of the following values:

#define wxTEXT_ATTR_BULLET_STYLE_NONE           0x0000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC         0x0001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER  0x0002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER  0x0004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER    0x0008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER    0x0010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL         0x0020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP         0x0040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES    0x0080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD         0x0100

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 left of the actual paragraph is leftSubIndent.


wxRichTextCtrl::BeginParagraphSpacing

bool BeginParagraphSpacing(int before, int after)

Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of a millimetre.


wxRichTextCtrl::BeginParagraphStyle

bool BeginParagraphStyle(const wxString& paragraphStyle)

Begins applying the named paragraph style.


wxRichTextCtrl::BeginRightIndent

bool BeginRightIndent(int rightIndent)

Begins a right indent, specified in tenths of a millimetre.


wxRichTextCtrl::BeginStyle

bool BeginStyle(const wxTextAttrEx& style)

Begins applying a style.


wxRichTextCtrl::BeginSuppressUndo

bool BeginSuppressUndo()

Starts suppressing undo history for commands.


wxRichTextCtrl::BeginSymbolBullet

bool BeginSymbolBullet(wxChar symbol, int leftIndent, int leftSubIndent, int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL)

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.


wxRichTextCtrl::BeginTextColour

bool BeginTextColour(const wxColour& colour)

Begins using this colour.


wxRichTextCtrl::BeginUnderline

bool BeginUnderline()

Begins using underlining.


wxRichTextCtrl::CanCopy

bool CanCopy() const

Returns true if selected content can be copied to the clipboard.


wxRichTextCtrl::CanCut

bool CanCut() const

Returns true if selected content can be copied to the clipboard and deleted.


wxRichTextCtrl::CanDeleteSelection

bool CanDeleteSelection() const

Returns true if selected content can be deleted.


wxRichTextCtrl::CanPaste

bool CanPaste() const

Returns true if the clipboard content can be pasted to the buffer.


wxRichTextCtrl::CanRedo

bool CanRedo() const

Returns true if there is a command in the command history that can be redone.


wxRichTextCtrl::CanUndo

bool CanUndo() const

Returns true if there is a command in the command history that can be undone.


wxRichTextCtrl::Clear

void Clear()

Clears the buffer content, leaving a single empty paragraph. Cannot be undone.


wxRichTextCtrl::Command

void Command(wxCommandEvent& event)

Sends the event to the control.


wxRichTextCtrl::Copy

void Copy()

Copies the selected content (if any) to the clipboard.


wxRichTextCtrl::Create

bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxRE_MULTILINE)

Creates the underlying window.


wxRichTextCtrl::Cut

void Cut()

Copies the selected content (if any) to the clipboard and deletes the selection. This is undoable.


wxRichTextCtrl::DeleteSelectedContent

bool DeleteSelectedContent(long* newPos = NULL)

Deletes content if there is a selection, e.g. when pressing a key. Returns the new caret position in newPos, or leaves it if there was no action. This is undoable.


wxRichTextCtrl::DeleteSelection

void DeleteSelection()

Deletes the content in the selection, if any. This is undoable.


wxRichTextCtrl::DiscardEdits

void DiscardEdits()

Sets the buffer's modified status to false, and clears the buffer's command history.


wxRichTextCtrl::DoGetBestSize

wxSize DoGetBestSize() const

Currently this simply returns wxSize(10, 10).


wxRichTextCtrl::EndAlignment

bool EndAlignment()

Ends alignment.


wxRichTextCtrl::EndAllStyles

bool EndAllStyles()

Ends application of all styles in the current style stack.


wxRichTextCtrl::EndBatchUndo

bool EndBatchUndo()

Ends batching undo command history.


wxRichTextCtrl::EndBold

bool EndBold()

Ends using bold.


wxRichTextCtrl::EndCharacterStyle

bool EndCharacterStyle()

Ends application of a named character style.


wxRichTextCtrl::EndFont

bool EndFont()

Ends using a font.


wxRichTextCtrl::EndFontSize

bool EndFontSize()

Ends using a point size.


wxRichTextCtrl::EndItalic

bool EndItalic()

Ends using italic.


wxRichTextCtrl::EndLeftIndent

bool EndLeftIndent()

Ends left indent.


wxRichTextCtrl::EndLineSpacing

bool EndLineSpacing()

Ends line spacing.


wxRichTextCtrl::EndNumberedBullet

bool EndNumberedBullet()

Ends application of a numbered bullet.


wxRichTextCtrl::EndParagraphSpacing

bool EndParagraphSpacing()

Ends paragraph spacing.


wxRichTextCtrl::EndParagraphStyle

bool EndParagraphStyle()

Ends application of a named character style.


wxRichTextCtrl::EndRightIndent

bool EndRightIndent()

Ends right indent.


wxRichTextCtrl::EndStyle

bool EndStyle()

Ends the current style.


wxRichTextCtrl::EndSuppressUndo

bool EndSuppressUndo()

Ends suppressing undo command history.


wxRichTextCtrl::EndSymbolBullet

bool EndSymbolBullet()

Ends applying a symbol bullet.


wxRichTextCtrl::EndTextColour

bool EndTextColour()

Ends applying a text colour.


wxRichTextCtrl::EndUnderline

bool EndUnderline()

End applying underlining.


wxRichTextCtrl::ExtendSelection

bool ExtendSelection(long oldPosition, long newPosition, int flags)

Helper function for extending the selection, returning true if the selection was changed. Selections are in caret positions.


wxRichTextCtrl::FindNextWordPosition

long FindNextWordPosition(int direction = 1) const

Helper function for finding the caret position for the next word. Direction is 1 (forward) or -1 (backwards).


wxRichTextCtrl::Freeze

void Freeze()

Call this function to prevent refresh and allow fast updates, and then Thaw to refresh the control.


wxRichTextCtrl::GetBasicStyle

const wxTextAttrEx& GetBasicStyle() const

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).


wxRichTextCtrl::GetBuffer

const wxRichTextBuffer& GetBuffer() const

wxRichTextBuffer& GetBuffer()

Returns the buffer associated with the control.


wxRichTextCtrl::GetCaretPosition

long GetCaretPosition() const

Returns the current caret position.


wxRichTextCtrl::GetCaretPositionForIndex

bool GetCaretPositionForIndex(long position, wxRect& rect)

Returns the caret height and position for the given character position


wxRichTextCtrl::GetCommandProcessor

wxCommandProcessor* GetCommandProcessor() const

Gets the command processor associated with the control's buffer.


wxRichTextCtrl::GetDefaultStyleEx

const wxTextAttrEx& GetDefaultStyleEx() const

Returns the current default style, which can be used to change how subsequently inserted text is displayed. When wxTextAttrEx is merged with wxTextAttr, this function will become GetDefaultStyle.


wxRichTextCtrl::GetDelayedLayoutThreshold

long GetDelayedLayoutThreshold() const

Gets the size of the buffer beyond which layout is delayed during resizing. This optimizes sizing for large buffers. The default is 20000.


wxRichTextCtrl::GetFilename

wxString GetFilename() const

Gets the current filename associated with the control.


wxRichTextCtrl::GetFirstVisiblePosition

long GetFirstVisiblePosition() const

Returns the first visible position in the current view.


wxRichTextCtrl::GetInsertionPoint

long GetInsertionPoint() const

Returns the current insertion point.


wxRichTextCtrl::GetLastPosition

wxTextPos GetLastPosition() const

Returns the last position in the buffer.


wxRichTextCtrl::GetLineLength

int GetLineLength(long lineNo) const

Returns the length of the specified line in characters.


wxRichTextCtrl::GetLineText

wxString GetLineText(long lineNo) const

Returns the text for the given line.


wxRichTextCtrl::GetLogicalPoint

wxPoint GetLogicalPoint(const wxPoint& ptPhysical) const

Transforms physical window position to logical (unscrolled) position.


wxRichTextCtrl::GetNumberOfLines

int GetNumberOfLines() const

Returns the number of lines in the buffer.


wxRichTextCtrl::GetPhysicalPoint

wxPoint GetPhysicalPoint(const wxPoint& ptLogical) const

Transforms logical (unscrolled) position to physical window position.


wxRichTextCtrl::GetRange

wxString GetRange(long from, long to) const

Gets the text for the given range.


wxRichTextCtrl::GetSelection

void GetSelection(long* from, long* to) const

Returns the range of the current selection. If the return values from and to are the same, there is no selection.


wxRichTextCtrl::GetSelectionRange

const wxRichTextRange& GetSelectionRange() const

Returns the selection range in character positions. -1, -1 means no selection.


wxRichTextCtrl::GetStringSelection

wxString GetStringSelection() const

Returns the text within the current selection range, if any.


wxRichTextCtrl::GetStyle

bool GetStyle(long position, wxRichTextAttr& style) const

bool GetStyle(long position, wxTextAttrEx& style) const

Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient because it does not use wxFont objects.


wxRichTextCtrl::GetStyleSheet

wxRichTextStyleSheet* GetStyleSheet() const

Returns the style sheet associated with the control, if any. A style sheet allows named character and paragraph styles to be applied.


wxRichTextCtrl::GetValue

wxString GetValue() const

Returns the content of the entire control as a string.


wxRichTextCtrl::GetVisibleLineForCaretPosition

wxRichTextLine* GetVisibleLineForCaretPosition(long caretPosition) const

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.


wxRichTextCtrl::HasCharacterAttributes

bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const

bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const

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. style must have flags indicating which attributes are of interest.


wxRichTextCtrl::HasParagraphAttributes

bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const

bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const

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. style must have flags indicating which attributes are of interest.


wxRichTextCtrl::HasSelection

bool HasSelection() const

Returns true if there is a selection.


wxRichTextCtrl::HitTest

wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long* pos) const

wxTextCtrlHitTestResult HitTest(const wxPoint& pt, wxTextCoord* col, wxTextCoord* row) const

Finds the character at the given position in pixels.

pt is in device coords (not adjusted for the client area origin nor for scrolling).


wxRichTextCtrl::Init

void Init()

Initialises the members of the control.


wxRichTextCtrl::InitCommandEvent

void InitCommandEvent(wxCommandEvent& event) const

Initialises the command event.


wxRichTextCtrl::IsEditable

bool IsEditable() const

Returns true if the control is editable.


wxRichTextCtrl::IsFrozen

bool IsFrozen() const

Returns true if Freeze has been called without a Thaw.


wxRichTextCtrl::IsModified

bool IsModified() const

Returns true if the buffer has been modified.


wxRichTextCtrl::IsMultiLine

bool IsMultiLine() const

Returns true if the control is multiline.


wxRichTextCtrl::IsPositionVisible

bool IsPositionVisible(long pos) const

Returns true if the given position is visible on the screen.


wxRichTextCtrl::IsSelectionAligned

bool IsSelectionAligned(wxTextAttrAlignment alignment) const

Returns true if all of the selection is aligned according to the specified flag.


wxRichTextCtrl::IsSelectionBold

bool IsSelectionBold() const

Returns true if all of the selection is bold.


wxRichTextCtrl::IsSelectionItalics

bool IsSelectionItalics() const

Returns true if all of the selection is italic.


wxRichTextCtrl::IsSelectionUnderlined

bool IsSelectionUnderlined() const

Returns true if all of the selection is underlined.


wxRichTextCtrl::IsSingleLine

bool IsSingleLine() const

Returns true if the control is single-line. Currently wxRichTextCtrl does not support single-line editing.


wxRichTextCtrl::KeyboardNavigate

bool KeyboardNavigate(int keyCode, int flags)

Helper function implementing keyboard navigation.


wxRichTextCtrl::LayoutContent

bool LayoutContent(bool onlyVisibleRect = false)

Lays out the buffer, which must be done before certain operations, such as setting the caret position. This function should not normally be required by the application.


wxRichTextCtrl::LoadFile

bool LoadFile(const wxString& file, int type = wxRICHTEXT_TYPE_ANY)

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.

This function looks for a suitable wxRichTextFileHandler object.


wxRichTextCtrl::MarkDirty

void MarkDirty()

Marks the buffer as modified.


wxRichTextCtrl::MoveCaret

bool MoveCaret(long pos, bool showAtLineStart = false)

Move the caret to the given character position.


wxRichTextCtrl::MoveCaretBack

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.


wxRichTextCtrl::MoveCaretForward

void MoveCaretForward(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.


wxRichTextCtrl::MoveDown

bool MoveDown(int noLines = 1, int flags = 0)

Moves the caret down.


wxRichTextCtrl::MoveEnd

bool MoveEnd(int flags = 0)

Moves to the end of the buffer.


wxRichTextCtrl::MoveHome

bool MoveHome(int flags = 0)

Moves to the start of the buffer.


wxRichTextCtrl::MoveLeft

bool MoveLeft(int noPositions = 1, int flags = 0)

Moves left.


wxRichTextCtrl::MoveRight

bool MoveRight(int noPositions = 1, int flags = 0)

Moves right.


wxRichTextCtrl::MoveToLineEnd

bool MoveToLineEnd(int flags = 0)

Moves to the end of the line.


wxRichTextCtrl::MoveToLineStart

bool MoveToLineStart(int flags = 0)

Moves to the start of the line.


wxRichTextCtrl::MoveToParagraphEnd

bool MoveToParagraphEnd(int flags = 0)

Moves to the end of the paragraph.


wxRichTextCtrl::MoveToParagraphStart

bool MoveToParagraphStart(int flags = 0)

Moves to the start of the paragraph.


wxRichTextCtrl::MoveUp

bool MoveUp(int noLines = 1, int flags = 0)

Moves up.


wxRichTextCtrl::Newline

bool Newline()

Insert a newline (actually paragraph) at the current insertion point.


wxRichTextCtrl::OnClear

void OnClear(wxCommandEvent& event)

Standard handler for the wxID_CLEAR command.


wxRichTextCtrl::OnContextMenu

void OnContextMenu(wxContextMenuEvent& event)

Shows a standard context menu with undo, redo, cut, copy, paste, clear, and select all commands.


wxRichTextCtrl::OnCopy

void OnCopy(wxCommandEvent& event)

Standard handler for the wxID_COPY command.


wxRichTextCtrl::OnCut

void OnCut(wxCommandEvent& event)

Standard handler for the wxID_CUT command.


wxRichTextCtrl::OnDropFiles

void OnDropFiles(wxDropFilesEvent& event)

Loads the first dropped file.


wxRichTextCtrl::OnPaste

void OnPaste(wxCommandEvent& event)

Standard handler for the wxID_PASTE command.


wxRichTextCtrl::OnRedo

void OnRedo(wxCommandEvent& event)

Standard handler for the wxID_REDO command.


wxRichTextCtrl::OnSelectAll

void OnSelectAll(wxCommandEvent& event)

Standard handler for the wxID_SELECTALL command.


wxRichTextCtrl::OnUndo

void OnUndo(wxCommandEvent& event)

Standard handler for the wxID_PASTE command.


wxRichTextCtrl::OnUpdateClear

void OnUpdateClear(wxUpdateUIEvent& event)

Standard update handler for the wxID_CLEAR command.


wxRichTextCtrl::OnUpdateCopy

void OnUpdateCopy(wxUpdateUIEvent& event)

Standard update handler for the wxID_COPY command.


wxRichTextCtrl::OnUpdateCut

void OnUpdateCut(wxUpdateUIEvent& event)

Standard update handler for the wxID_CUT command.


wxRichTextCtrl::OnUpdatePaste

void OnUpdatePaste(wxUpdateUIEvent& event)

Standard update handler for the wxID_PASTE command.


wxRichTextCtrl::OnUpdateRedo

void OnUpdateRedo(wxUpdateUIEvent& event)

Standard update handler for the wxID_REDO command.


wxRichTextCtrl::OnUpdateSelectAll

void OnUpdateSelectAll(wxUpdateUIEvent& event)

Standard update handler for the wxID_SELECTALL command.


wxRichTextCtrl::OnUpdateUndo

void OnUpdateUndo(wxUpdateUIEvent& event)

Standard update handler for the wxID_UNDO command.


wxRichTextCtrl::PageDown

bool PageDown(int noPages = 1, int flags = 0)

Moves one or more pages down.


wxRichTextCtrl::PageUp

bool PageUp(int noPages = 1, int flags = 0)

Moves one or more pages up.


wxRichTextCtrl::PaintBackground

void PaintBackground(wxDC& dc)

Paints the background.


wxRichTextCtrl::Paste

void Paste()

Pastes content from the clipboard to the buffer.


wxRichTextCtrl::PositionCaret

void PositionCaret()

Internal function to position the visible caret according to the current caret position.


wxRichTextCtrl::PositionToXY

bool PositionToXY(long pos, long* x, long* y) const

Converts a text position to zero-based column and line numbers.


wxRichTextCtrl::Redo

void Redo()

Redoes the current command.


wxRichTextCtrl::Remove

void Remove(long from, long to)

Removes the content in the specified range.


wxRichTextCtrl::Replace

void Replace(long from, long to, const wxString& value)

Replaces the content in the specified range with the string specified by value.


wxRichTextCtrl::SaveFile

bool SaveFile(const wxString& file = wxEmptyString, int type = wxRICHTEXT_TYPE_ANY)

Saves the buffer content using the given type. If the specified type is wxRICHTEXT_TYPE_ANY, the type is deduced from the filename extension.

This function looks for a suitable wxRichTextFileHandler object.


wxRichTextCtrl::ScrollIntoView

bool ScrollIntoView(long position, int keyCode)

Scrolls position into view. This function takes a caret position.


wxRichTextCtrl::SelectAll

void SelectAll()

Selects all the text in the buffer.


wxRichTextCtrl::SelectNone

void SelectNone()

Cancels any selection.


wxRichTextCtrl::SetBasicStyle

void SetBasicStyle(const wxRichTextAttr& style)

void SetBasicStyle(const wxTextAttrEx& style)

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).


wxRichTextCtrl::SetCaretPosition

void SetCaretPosition(long position, bool showAtLineStart = false)

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.


wxRichTextCtrl::SetDefaultStyle

bool SetDefaultStyle(const wxTextAttrEx& style)

Sets the current default style, which can be used to change how subsequently inserted text is displayed.


wxRichTextCtrl::SetDefaultStyleToCursorStyle

bool SetDefaultStyleToCursorStyle()

Sets the default style to the style under the cursor.


wxRichTextCtrl::SetDelayedLayoutThreshold

void SetDelayedLayoutThreshold(long threshold)

Sets the size of the buffer beyond which layout is delayed during resizing. This optimizes sizing for large buffers. The default is 20000.


wxRichTextCtrl::SetEditable

void SetEditable(bool editable)

Makes the control editable, or not.


wxRichTextCtrl::SetFilename

void SetFilename(const wxString& filename)

Sets the current filename.


wxRichTextCtrl::SetFont

bool SetFont(const wxFont& font)

Sets the font, and also the basic and default attributes (see SetDefaultStyle).


wxRichTextCtrl::SetInsertionPoint

void SetInsertionPoint(long pos)

Sets the insertion point.


wxRichTextCtrl::SetInsertionPointEnd

void SetInsertionPointEnd()

Sets the insertion point to the end of the text control.


wxRichTextCtrl::SetSelection

void SetSelection(long from, long to)

Sets the selection to the given range.


wxRichTextCtrl::SetSelectionRange

void SetSelectionRange(const wxRichTextRange& range)

Sets the selection to the given range.


wxRichTextCtrl::SetStyle

bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style)

bool SetStyle(long start, long end, const wxTextAttrEx& style)

Sets the attributes for the given range. The wxRichTextAttr version is more efficient because it does not use wxFont objects.


wxRichTextCtrl::SetStyleSheet

void SetStyleSheet(wxRichTextStyleSheet* styleSheet)

Sets the style sheet associated with the control. A style sheet allows named character and paragraph styles to be applied.


wxRichTextCtrl::SetValue

void SetValue(const wxString& value)

Replaces existing content with the given text.


wxRichTextCtrl::SetupScrollbars

void SetupScrollbars(bool atTop = false)

A helper function setting up scrollbars, for example after a resize.


wxRichTextCtrl::ShowPosition

void ShowPosition(long pos)

Scrolls the buffer so that the given position is in view.


wxRichTextCtrl::SuppressingUndo

bool SuppressingUndo() const

Returns true if undo history suppression is on.


wxRichTextCtrl::Thaw

void Thaw()

Call this function to end a Freeze and refresh the display.


wxRichTextCtrl::Undo

void Undo()

Undoes the command at the top of the command history, if there is one.


wxRichTextCtrl::WordLeft

bool WordLeft(int noWords = 1, int flags = 0)

Moves a number of words to the left.


wxRichTextCtrl::WordRight

bool WordRight(int noWords = 1, int flags = 0)

Move a nuber of words to the right.


wxRichTextCtrl::WriteImage

bool WriteImage(const wxString& filename, int bitmapType)

Loads an image from a file and writes it at the current insertion point.

bool WriteImage(const wxRichTextImageBlock& imageBlock)

Writes an image block at the current insertion point.

bool WriteImage(const wxBitmap& bitmap, int bitmapType = wxBITMAP_TYPE_PNG)

bool WriteImage(const wxImage& image, int bitmapType = wxBITMAP_TYPE_PNG)

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.


wxRichTextCtrl::WriteText

void WriteText(const wxString& text)

Writes text at the current position.


wxRichTextCtrl::XYToPosition

long XYToPosition(long x, long y) const

Translates from column and line number to position.