richtextctrl.tex

来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 1,206 行 · 第 1/3 页

TEX
1,206
字号
\section{\class{wxRichTextCtrl}}\label{wxrichtextctrl}

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

\wxheading{Derived from}

wxTextCtrlBase

\wxheading{Include files}

<wx/richtext/richtextctrl.h>

\wxheading{Data structures}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxRichTextCtrl::wxRichTextCtrl}\label{wxrichtextctrlwxrichtextctrl}

\func{}{wxRichTextCtrl}{\void}

\func{}{wxRichTextCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{value = wxEmptyString}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxRE\_MULTILINE}}

Constructors.

\membersection{wxRichTextCtrl::\destruct{wxRichTextCtrl}}\label{wxrichtextctrldtor}

\func{}{\destruct{wxRichTextCtrl}}{\void}

Destructor.

\membersection{wxRichTextCtrl::AddImage}\label{wxrichtextctrladdimage}

\func{wxRichTextRange}{AddImage}{\param{const wxImage\& }{image}}

Adds an image to the control's buffer.

\membersection{wxRichTextCtrl::AddParagraph}\label{wxrichtextctrladdparagraph}

\func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}

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

\membersection{wxRichTextCtrl::AppendText}\label{wxrichtextctrlappendtext}

\func{void}{AppendText}{\param{const wxString\& }{text}}

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

\membersection{wxRichTextCtrl::ApplyAlignmentToSelection}\label{wxrichtextctrlapplyalignmenttoselection}

\func{bool}{ApplyAlignmentToSelection}{\param{wxTextAttrAlignment }{alignment}}

Applies the given alignment to the selection (undoable).

For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}.

\membersection{wxRichTextCtrl::ApplyBoldToSelection}\label{wxrichtextctrlapplyboldtoselection}

\func{bool}{ApplyBoldToSelection}{\void}

Apples bold to the selection (undoable).

\membersection{wxRichTextCtrl::ApplyItalicToSelection}\label{wxrichtextctrlapplyitalictoselection}

\func{bool}{ApplyItalicToSelection}{\void}

Applies italic to the selection (undoable).

\membersection{wxRichTextCtrl::ApplyUnderlineToSelection}\label{wxrichtextctrlapplyunderlinetoselection}

\func{bool}{ApplyUnderlineToSelection}{\void}

Applies underline to the selection (undoable).

\membersection{wxRichTextCtrl::BatchingUndo}\label{wxrichtextctrlbatchingundo}

\constfunc{bool}{BatchingUndo}{\void}

Returns \true if undo commands are being batched.

\membersection{wxRichTextCtrl::BeginAlignment}\label{wxrichtextctrlbeginalignment}

\func{bool}{BeginAlignment}{\param{wxTextAttrAlignment }{alignment}}

Begins using alignment

For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}.

\membersection{wxRichTextCtrl::BeginBatchUndo}\label{wxrichtextctrlbeginbatchundo}

\func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}

Starts batching undo history for commands.

\membersection{wxRichTextCtrl::BeginBold}\label{wxrichtextctrlbeginbold}

\func{bool}{BeginBold}{\void}

Begins using bold.

\membersection{wxRichTextCtrl::BeginCharacterStyle}\label{wxrichtextctrlbegincharacterstyle}

\func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}

Begins using the named character style.

\membersection{wxRichTextCtrl::BeginFont}\label{wxrichtextctrlbeginfont}

\func{bool}{BeginFont}{\param{const wxFont\& }{font}}

Begins using this font.

\membersection{wxRichTextCtrl::BeginFontSize}\label{wxrichtextctrlbeginfontsize}

\func{bool}{BeginFontSize}{\param{int }{pointSize}}

Begins using the given point size.

\membersection{wxRichTextCtrl::BeginItalic}\label{wxrichtextctrlbeginitalic}

\func{bool}{BeginItalic}{\void}

Begins using italic.

\membersection{wxRichTextCtrl::BeginLeftIndent}\label{wxrichtextctrlbeginleftindent}

\func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{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.

\membersection{wxRichTextCtrl::BeginLineSpacing}\label{wxrichtextctrlbeginlinespacing}

\func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}

Begins appling line spacing. {\it 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:


{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL         10
#define wxTEXT_ATTR_LINE_SPACING_HALF           15
#define wxTEXT_ATTR_LINE_SPACING_TWICE          20
\end{verbatim}
}

\membersection{wxRichTextCtrl::BeginNumberedBullet}\label{wxrichtextctrlbeginnumberedbullet}

\func{bool}{BeginNumberedBullet}{\param{int }{bulletNumber}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{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.

{\it bulletNumber} is a number, usually starting with 1.

{\it leftIndent} and {\it leftSubIndent} are values in tenths of a millimetre.

{\it bulletStyle} is a bitlist of the following values:

{\small
\begin{verbatim}
#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
\end{verbatim}
}

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.

\membersection{wxRichTextCtrl::BeginParagraphSpacing}\label{wxrichtextctrlbeginparagraphspacing}

\func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}

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

\membersection{wxRichTextCtrl::BeginParagraphStyle}\label{wxrichtextctrlbeginparagraphstyle}

\func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}

Begins applying the named paragraph style.

\membersection{wxRichTextCtrl::BeginRightIndent}\label{wxrichtextctrlbeginrightindent}

\func{bool}{BeginRightIndent}{\param{int }{rightIndent}}

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

\membersection{wxRichTextCtrl::BeginStyle}\label{wxrichtextctrlbeginstyle}

\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}

Begins applying a style.

\membersection{wxRichTextCtrl::BeginSuppressUndo}\label{wxrichtextctrlbeginsuppressundo}

\func{bool}{BeginSuppressUndo}{\void}

Starts suppressing undo history for commands.

\membersection{wxRichTextCtrl::BeginSymbolBullet}\label{wxrichtextctrlbeginsymbolbullet}

\func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}

Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextctrlbeginnumberedbullet} for
an explanation of how indentation is used to render the bulleted paragraph.

\membersection{wxRichTextCtrl::BeginTextColour}\label{wxrichtextctrlbegintextcolour}

\func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}

Begins using this colour.

\membersection{wxRichTextCtrl::BeginUnderline}\label{wxrichtextctrlbeginunderline}

\func{bool}{BeginUnderline}{\void}

Begins using underlining.

\membersection{wxRichTextCtrl::CanCopy}\label{wxrichtextctrlcancopy}

\constfunc{bool}{CanCopy}{\void}

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

\membersection{wxRichTextCtrl::CanCut}\label{wxrichtextctrlcancut}

\constfunc{bool}{CanCut}{\void}

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

\membersection{wxRichTextCtrl::CanDeleteSelection}\label{wxrichtextctrlcandeleteselection}

\constfunc{bool}{CanDeleteSelection}{\void}

Returns \true if selected content can be deleted.

\membersection{wxRichTextCtrl::CanPaste}\label{wxrichtextctrlcanpaste}

\constfunc{bool}{CanPaste}{\void}

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

\membersection{wxRichTextCtrl::CanRedo}\label{wxrichtextctrlcanredo}

\constfunc{bool}{CanRedo}{\void}

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

\membersection{wxRichTextCtrl::CanUndo}\label{wxrichtextctrlcanundo}

\constfunc{bool}{CanUndo}{\void}

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

\membersection{wxRichTextCtrl::Clear}\label{wxrichtextctrlclear}

\func{void}{Clear}{\void}

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

\membersection{wxRichTextCtrl::Command}\label{wxrichtextctrlcommand}

\func{void}{Command}{\param{wxCommandEvent\& }{event}}

Sends the event to the control.

\membersection{wxRichTextCtrl::Copy}\label{wxrichtextctrlcopy}

\func{void}{Copy}{\void}

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

\membersection{wxRichTextCtrl::Create}\label{wxrichtextctrlcreate}

\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{value = wxEmptyString}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxRE\_MULTILINE}}

Creates the underlying window.

\membersection{wxRichTextCtrl::Cut}\label{wxrichtextctrlcut}

\func{void}{Cut}{\void}

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

\membersection{wxRichTextCtrl::DeleteSelectedContent}\label{wxrichtextctrldeleteselectedcontent}

\func{bool}{DeleteSelectedContent}{\param{long* }{newPos = NULL}}

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

\membersection{wxRichTextCtrl::DeleteSelection}\label{wxrichtextctrldeleteselection}

\func{void}{DeleteSelection}{\void}

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

\membersection{wxRichTextCtrl::DiscardEdits}\label{wxrichtextctrldiscardedits}

\func{void}{DiscardEdits}{\void}

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

\membersection{wxRichTextCtrl::DoGetBestSize}\label{wxrichtextctrldogetbestsize}

\constfunc{wxSize}{DoGetBestSize}{\void}

Currently this simply returns {\tt wxSize(10, 10)}.

\membersection{wxRichTextCtrl::EndAlignment}\label{wxrichtextctrlendalignment}

\func{bool}{EndAlignment}{\void}

Ends alignment.

\membersection{wxRichTextCtrl::EndAllStyles}\label{wxrichtextctrlendallstyles}

\func{bool}{EndAllStyles}{\void}

Ends application of all styles in the current style stack.

\membersection{wxRichTextCtrl::EndBatchUndo}\label{wxrichtextctrlendbatchundo}

\func{bool}{EndBatchUndo}{\void}

Ends batching undo command history.

\membersection{wxRichTextCtrl::EndBold}\label{wxrichtextctrlendbold}

\func{bool}{EndBold}{\void}

Ends using bold.

\membersection{wxRichTextCtrl::EndCharacterStyle}\label{wxrichtextctrlendcharacterstyle}

\func{bool}{EndCharacterStyle}{\void}

Ends application of a named character style.

\membersection{wxRichTextCtrl::EndFont}\label{wxrichtextctrlendfont}

\func{bool}{EndFont}{\void}

Ends using a font.

\membersection{wxRichTextCtrl::EndFontSize}\label{wxrichtextctrlendfontsize}

\func{bool}{EndFontSize}{\void}

Ends using a point size.

\membersection{wxRichTextCtrl::EndItalic}\label{wxrichtextctrlenditalic}

\func{bool}{EndItalic}{\void}

Ends using italic.

\membersection{wxRichTextCtrl::EndLeftIndent}\label{wxrichtextctrlendleftindent}

\func{bool}{EndLeftIndent}{\void}

Ends left indent.

\membersection{wxRichTextCtrl::EndLineSpacing}\label{wxrichtextctrlendlinespacing}

\func{bool}{EndLineSpacing}{\void}

Ends line spacing.

\membersection{wxRichTextCtrl::EndNumberedBullet}\label{wxrichtextctrlendnumberedbullet}

\func{bool}{EndNumberedBullet}{\void}

Ends application of a numbered bullet.

\membersection{wxRichTextCtrl::EndParagraphSpacing}\label{wxrichtextctrlendparagraphspacing}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?