X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/523d2f145ef7d8e653fbe1f16797c1f0b4d91c16..85136e3bf5dadf921652519e71da5db351fb3194:/docs/latex/wx/richtextctrl.tex diff --git a/docs/latex/wx/richtextctrl.tex b/docs/latex/wx/richtextctrl.tex index d268a9be20..790038530b 100644 --- a/docs/latex/wx/richtextctrl.tex +++ b/docs/latex/wx/richtextctrl.tex @@ -3,6 +3,12 @@ wxRichTextCtrl provides a generic, ground-up implementation of a text control capable of showing multiple styles and images. +wxRichTextCtrl sends notification events: see \helpref{wxRichTextEvent}{wxrichtextevent}. +It also sends the standard wxTextCtrl events wxEVT\_COMMAND\_TEXT\_ENTER and wxEVT\_COMMAND\_TEXT\_UPDATED, +and wxTextUrlEvent when URL content is clicked. + +For more information, see the \helpref{wxRichTextCtrl overview}{wxrichtextctrloverview}. + \wxheading{Derived from} wxTextCtrlBase @@ -11,6 +17,10 @@ wxTextCtrlBase +\wxheading{Library} + +\helpref{wxRichtext}{librarieslist} + \wxheading{Data structures} \latexignore{\rtfignore{\wxheading{Members}}} @@ -55,7 +65,7 @@ Sets the insertion point to the end of the buffer and writes the text. Applies the given alignment to the selection (undoable). -For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}. +For alignment values, see \helpref{wxTextAttr}{wxtextattr}. \membersection{wxRichTextCtrl::ApplyBoldToSelection}\label{wxrichtextctrlapplyboldtoselection} @@ -103,7 +113,7 @@ Returns \true if undo commands are being batched. Begins using alignment -For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}. +For alignment values, see \helpref{wxTextAttr}{wxtextattr}. \membersection{wxRichTextCtrl::BeginBatchUndo}\label{wxrichtextctrlbeginbatchundo} @@ -239,7 +249,7 @@ Begins a right indent, specified in tenths of a millimetre. \membersection{wxRichTextCtrl::BeginStyle}\label{wxrichtextctrlbeginstyle} -\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}} +\func{bool}{BeginStyle}{\param{const wxTextAttr\& }{style}} Begins applying a style. @@ -360,6 +370,12 @@ Creates the underlying window. Copies the selected content (if any) to the clipboard and deletes the selection. This is undoable. +\membersection{wxRichTextCtrl::Delete}\label{wxrichtextctrldelete} + +\func{bool}{Delete}{\param{const wxRichTextRange\&}{ range}} + +Deletes the content within the given range. + \membersection{wxRichTextCtrl::DeleteSelectedContent}\label{wxrichtextctrldeleteselectedcontent} \func{bool}{DeleteSelectedContent}{\param{long* }{newPos = NULL}} @@ -535,7 +551,7 @@ refresh the control. \membersection{wxRichTextCtrl::GetBasicStyle}\label{wxrichtextctrlgetbasicstyle} -\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void} +\constfunc{const wxTextAttr\&}{GetBasicStyle}{\void} Gets the basic (overall) style. This is the style of the whole buffer before further styles are applied, unlike the default style, which @@ -568,13 +584,12 @@ Returns the caret height and position for the given character position Gets the command processor associated with the control's buffer. -\membersection{wxRichTextCtrl::GetDefaultStyleEx}\label{wxrichtextctrlgetdefaultstyleex} +\membersection{wxRichTextCtrl::GetDefaultStyle}\label{wxrichtextctrlgetdefaultstyle} -\constfunc{const wxTextAttrEx\&}{GetDefaultStyleEx}{\void} +\constfunc{const wxTextAttr\&}{GetDefaultStyle}{\void} 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. +text is displayed. \membersection{wxRichTextCtrl::GetDelayedLayoutThreshold}\label{wxrichtextctrlgetdelayedlayoutthreshold} @@ -676,19 +691,21 @@ Returns the text within the current selection range, if any. \membersection{wxRichTextCtrl::GetStyle}\label{wxrichtextctrlgetstyle} -\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} - -\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} - \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}} -Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient -because it does not use wxFont objects. +Gets the attributes at the given position. This function gets the combined style - that is, the style you see on the screen as a result of combining base style, paragraph style and character style attributes. To get the character or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextctrlgetuncombinedstyle}. +\membersection{wxRichTextCtrl::GetStyleForRange}\label{wxrichtextctrlgetstyleforrange} + +\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\& }{range}, \param{wxTextAttr\& }{style}} + +Gets the attributes common to the specified range. Attributes that differ in value within the range will +not be included in {\it style}'s flags. + \membersection{wxRichTextCtrl::GetStyleSheet}\label{wxrichtextctrlgetstylesheet} \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} @@ -698,14 +715,9 @@ character and paragraph styles to be applied. \membersection{wxRichTextCtrl::GetUncombinedStyle}\label{wxrichtextctrlgetuncombinedstyle} -\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} - -\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} - \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}} -Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient -because it does not use wxFont objects. +Gets the attributes at the given position. This function gets the {\it uncombined style} - that is, the attributes associated with the paragraph or character content, and not necessarily the combined attributes you see on the @@ -731,9 +743,7 @@ if this is the case. \membersection{wxRichTextCtrl::HasCharacterAttributes}\label{wxrichtextctrlhascharacterattributes} -\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}} - -\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}} +\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}} 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 @@ -742,9 +752,7 @@ flags indicating which attributes are of interest. \membersection{wxRichTextCtrl::HasParagraphAttributes}\label{wxrichtextctrlhasparagraphattributes} -\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}} - -\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}} +\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}} 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 @@ -795,7 +803,7 @@ bool wxRichTextCtrl::IsSelectionBold() { if (HasSelection()) { - wxRichTextAttr attr; + wxTextAttr attr; wxRichTextRange range = GetInternalSelectionRange(); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFontWeight(wxBOLD); @@ -806,7 +814,7 @@ bool wxRichTextCtrl::IsSelectionBold() { // If no selection, then we need to combine current style with default style // to see what the effect would be if we started typing. - wxRichTextAttr attr; + wxTextAttr attr; attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); long pos = GetAdjustedCaretPosition(GetCaretPosition()); @@ -898,6 +906,14 @@ 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. +\membersection{wxRichTextCtrl::LineBreak}\label{wxrichtextctrllinebreak} + +\func{bool}{LineBreak}{\void} + +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 {\bf wxRichTextLineBreakChar} to text content, +or by typing Shift-Return. + \membersection{wxRichTextCtrl::LoadFile}\label{wxrichtextctrlloadfile} \func{bool}{LoadFile}{\param{const wxString\& }{file}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}} @@ -999,7 +1015,7 @@ Moves up. \func{bool}{Newline}{\void} -Insert a newline (actually paragraph) at the current insertion point. +Inserts a new paragraph at the current insertion point. See also \helpref{wxRichTextCtrl::LineBreak}{wxrichtextctrllinebreak}. \membersection{wxRichTextCtrl::NumberList}\label{wxrichtextctrlnumberlist} @@ -1219,7 +1235,7 @@ Cancels any selection. \membersection{wxRichTextCtrl::SetAndShowDefaultStyle}\label{wxrichtextctrlsetandshowdefaultstyle} -\func{void}{SetAndShowDefaultStyle}{\param{const wxRichTextAttr\& }{attr}} +\func{void}{SetAndShowDefaultStyle}{\param{const wxTextAttr\& }{attr}} Sets {\it attr} as the default style and tells the control that the UI should reflect this attribute until the user moves the caret. @@ -1228,9 +1244,7 @@ See also \helpref{IsDefaultStyleShowing}{wxrichtextctrlisdefaultstyleshowing}. \membersection{wxRichTextCtrl::SetBasicStyle}\label{wxrichtextctrlsetbasicstyle} -\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} - -\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}} +\func{void}{SetBasicStyle}{\param{const wxTextAttr\& }{style}} Sets the basic (overall) style. This is the style of the whole buffer before further styles are applied, unlike the default style, which @@ -1246,7 +1260,7 @@ A value of -1 means the caret is at the start of the buffer. \membersection{wxRichTextCtrl::SetDefaultStyle}\label{wxrichtextctrlsetdefaultstyle} -\func{bool}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}} +\func{bool}{SetDefaultStyle}{\param{const wxTextAttr\& }{style}} Sets the current default style, which can be used to change how subsequently inserted text is displayed. @@ -1327,7 +1341,7 @@ See also \helpref{wxRichTextCtrl::NumberList}{wxrichtextctrlnumberlist}, \helpre 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. -So, for example, to set the style for a character at position 5, use the range (5,6). +So, for example, to set the selection for a character at position 5, use the range (5,6). \membersection{wxRichTextCtrl::SetSelectionRange}\label{wxrichtextctrlsetselectionrange} @@ -1336,32 +1350,26 @@ So, for example, to set the style for a character at position 5, use the range ( 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. -So, for example, to set the style for a character at position 5, use the range (5,6). +So, for example, to set the selection for a character at position 5, use the range (5,6). \membersection{wxRichTextCtrl::SetStyle}\label{wxrichtextctrlsetstyle} -\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}} - -\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}} +\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}} \func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}} -Sets the attributes for the given range. The wxRichTextAttr version is more efficient -because it does not use wxFont objects. +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. So, for example, to set the style for a character at position 5, use the range (5,6). \membersection{wxRichTextCtrl::SetStyleEx}\label{wxrichtextctrlsetstyleex} -\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} - -\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} +\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} -\func{bool}{SetStyleEx}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} +\func{bool}{SetStyleEx}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} -Sets the attributes for the given range, passing flags to determine how the attributes are set. The wxRichTextAttr version is more efficient -because it does not use wxFont objects. +Sets the attributes for the given range, passing flags to determine how the attributes are set. The end point of range is specified as the last character position of the span of text, plus one. So, for example, to set the style for a character at position 5, use the range (5,6). @@ -1378,6 +1386,7 @@ and not the content. This allows content styling to be preserved independently f \item 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. \item wxRICHTEXT\_SETSTYLE\_RESET: resets (clears) the existing style before applying the new style. +\item wxRICHTEXT\_SETSTYLE\_REMOVE: removes the specified style. Only the style flags are used in this operation. \end{itemize} \membersection{wxRichTextCtrl::SetStyleSheet}\label{wxrichtextctrlsetstylesheet}