1 \section{\class{wxRichTextBuffer
}}\label{wxrichtextbuffer
}
3 This class represents the whole buffer associated with a
\helpref{wxRichTextCtrl
}{wxrichtextctrl
}.
5 \wxheading{Derived from
}
7 wxRichTextParagraphLayoutBox
9 \wxheading{Include files
}
11 <wx/richtext/richtextbuffer.h>
13 \wxheading{Data structures
}
17 \helpref{wxTextAttr
}{wxtextattr
},
\helpref{wxTextAttrEx
}{wxtextattrex
},
\helpref{wxRichTextAttr
}{wxrichtextattr
},
\helpref{wxRichTextCtrl
}{wxrichtextctrl
}
19 \latexignore{\rtfignore{\wxheading{Members
}}}
21 \membersection{wxRichTextBuffer::wxRichTextBuffer
}\label{wxrichtextbufferwxrichtextbuffer
}
23 \func{}{wxRichTextBuffer
}{\param{const wxRichTextBuffer\&
}{obj
}}
27 \func{}{wxRichTextBuffer
}{\void}
31 \membersection{wxRichTextBuffer::
\destruct{wxRichTextBuffer
}}\label{wxrichtextbufferdtor
}
33 \func{}{\destruct{wxRichTextBuffer
}}{\void}
37 \membersection{wxRichTextBuffer::AddEventHandler
}\label{wxrichtextbufferaddeventhandler
}
39 \func{bool
}{AddEventHandler
}{\param{wxEvtHandler*
}{handler
}}
41 Adds an event handler to the buffer's list of handlers. A buffer associated with
42 a contol has the control as the only event handler, but the application is free
43 to add more if further notification is required. All handlers are notified
44 of an event originating from the buffer, such as the replacement of a style sheet
45 during loading. The buffer never deletes any of the event handlers, unless
46 \helpref{wxRichTextBuffer::RemoveEventHandler
}{wxrichtextbufferremoveeventhandler
} is
47 called with
\true as the second argument.
49 \membersection{wxRichTextBuffer::AddHandler
}\label{wxrichtextbufferaddhandler
}
51 \func{void
}{AddHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
55 \membersection{wxRichTextBuffer::AddParagraph
}\label{wxrichtextbufferaddparagraph
}
57 \func{wxRichTextRange
}{AddParagraph
}{\param{const wxString\&
}{text
}}
59 Adds a paragraph of text.
61 \membersection{wxRichTextBuffer::BatchingUndo
}\label{wxrichtextbufferbatchingundo
}
63 \constfunc{bool
}{BatchingUndo
}{\void}
65 Returns
\true if the buffer is currently collapsing commands into a single notional command.
67 \membersection{wxRichTextBuffer::BeginAlignment
}\label{wxrichtextbufferbeginalignment
}
69 \func{bool
}{BeginAlignment
}{\param{wxTextAttrAlignment
}{alignment
}}
71 Begins using alignment.
73 \membersection{wxRichTextBuffer::BeginBatchUndo
}\label{wxrichtextbufferbeginbatchundo
}
75 \func{bool
}{BeginBatchUndo
}{\param{const wxString\&
}{cmdName
}}
77 Begins collapsing undo/redo commands. Note that this may not work properly
78 if combining commands that delete or insert content, changing ranges for
81 {\it cmdName
} should be the name of the combined command that will appear
82 next to Undo and Redo in the edit menu.
84 \membersection{wxRichTextBuffer::BeginBold
}\label{wxrichtextbufferbeginbold
}
86 \func{bool
}{BeginBold
}{\void}
90 \membersection{wxRichTextBuffer::BeginCharacterStyle
}\label{wxrichtextbufferbegincharacterstyle
}
92 \func{bool
}{BeginCharacterStyle
}{\param{const wxString\&
}{characterStyle
}}
94 Begins applying the named character style.
96 \membersection{wxRichTextBuffer::BeginFont
}\label{wxrichtextbufferbeginfont
}
98 \func{bool
}{BeginFont
}{\param{const wxFont\&
}{font
}}
100 Begins using this font.
102 \membersection{wxRichTextBuffer::BeginFontSize
}\label{wxrichtextbufferbeginfontsize
}
104 \func{bool
}{BeginFontSize
}{\param{int
}{pointSize
}}
106 Begins using the given point size.
108 \membersection{wxRichTextBuffer::BeginItalic
}\label{wxrichtextbufferbeginitalic
}
110 \func{bool
}{BeginItalic
}{\void}
114 \membersection{wxRichTextBuffer::BeginLeftIndent
}\label{wxrichtextbufferbeginleftindent
}
116 \func{bool
}{BeginLeftIndent
}{\param{int
}{leftIndent
},
\param{int
}{leftSubIndent =
0}}
118 Begin using
{\it leftIndent
} for the left indent, and optionally
{\it leftSubIndent
} for
119 the sub-indent. Both are expressed in tenths of a millimetre.
121 The sub-indent is an offset from the left of the paragraph, and is used for all but the
122 first line in a paragraph. A positive value will cause the first line to appear to the left
123 of the subsequent lines, and a negative value will cause the first line to be indented
124 relative to the subsequent lines.
126 \membersection{wxRichTextBuffer::BeginLineSpacing
}\label{wxrichtextbufferbeginlinespacing
}
128 \func{bool
}{BeginLineSpacing
}{\param{int
}{lineSpacing
}}
130 Begins line spacing using the specified value.
{\it spacing
} is a multiple, where
10 means single-spacing,
131 15 means
1.5 spacing, and
20 means double spacing. The following constants are
132 defined for convenience:
136 #define wxTEXT_ATTR_LINE_SPACING_NORMAL
10
137 #define wxTEXT_ATTR_LINE_SPACING_HALF
15
138 #define wxTEXT_ATTR_LINE_SPACING_TWICE
20
142 \membersection{wxRichTextBuffer::BeginListStyle
}\label{wxrichtextbufferbeginliststyle
}
144 \func{bool
}{BeginListStyle
}{\param{const wxString\&
}{ listStyle
},
\param{int
}{ level=
1},
\param{int
}{ number=
1}}
146 Begins using a specified list style. Optionally, you can also pass a level and a number.
148 \membersection{wxRichTextBuffer::BeginNumberedBullet
}\label{wxrichtextbufferbeginnumberedbullet
}
150 \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}}
152 Begins a numbered bullet. This call will be needed for each item in the list, and the
153 application should take care of incrementing the numbering.
155 {\it bulletNumber
} is a number, usually starting with
1.
157 {\it leftIndent
} and
{\it leftSubIndent
} are values in tenths of a millimetre.
159 {\it bulletStyle
} is a bitlist of the following values:
163 #define wxTEXT_ATTR_BULLET_STYLE_NONE
0x00000000
164 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC
0x00000001
165 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
0x00000002
166 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
0x00000004
167 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
0x00000008
168 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
0x00000010
169 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL
0x00000020
170 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP
0x00000040
171 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
0x00000080
172 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD
0x00000100
173 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD
0x00000200
174 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
0x00000400
175 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE
0x00000800
176 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT
0x00000000
177 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
0x00001000
178 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
0x00002000
182 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
183 the margin and the bullet. The content of the paragraph, including the first line, starts
184 at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
185 left of the actual paragraph is leftSubIndent.
187 \membersection{wxRichTextBuffer::BeginParagraphSpacing
}\label{wxrichtextbufferbeginparagraphspacing
}
189 \func{bool
}{BeginParagraphSpacing
}{\param{int
}{before
},
\param{int
}{after
}}
191 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
194 \membersection{wxRichTextBuffer::BeginParagraphStyle
}\label{wxrichtextbufferbeginparagraphstyle
}
196 \func{bool
}{BeginParagraphStyle
}{\param{const wxString\&
}{paragraphStyle
}}
198 Begins applying the named paragraph style.
200 \membersection{wxRichTextBuffer::BeginRightIndent
}\label{wxrichtextbufferbeginrightindent
}
202 \func{bool
}{BeginRightIndent
}{\param{int
}{rightIndent
}}
204 Begins a right indent, specified in tenths of a millimetre.
206 \membersection{wxRichTextBuffer::BeginStyle
}\label{wxrichtextbufferbeginstyle
}
208 \func{bool
}{BeginStyle
}{\param{const wxTextAttrEx\&
}{style
}}
210 Begins using a specified style.
212 \membersection{wxRichTextBuffer::BeginSuppressUndo
}\label{wxrichtextbufferbeginsuppressundo
}
214 \func{bool
}{BeginSuppressUndo
}{\void}
216 Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
217 differently by each command. If not dealt with by a command implementation, then
218 it will be implemented automatically by not storing the command in the undo history
219 when the action is submitted to the command processor.
221 \membersection{wxRichTextBuffer::BeginStandardBullet
}\label{wxrichtextbufferbeginstandardbullet
}
223 \func{bool
}{BeginStandardBullet
}{\param{const wxString\&
}{ bulletName
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_STANDARD}}
225 Begins applying a standard bullet, using one of the standard bullet names (currently
{\tt standard/circle
} or
{\tt standard/square
}.
226 See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for an explanation of how indentation is used to render the bulleted paragraph.
228 \membersection{wxRichTextBuffer::BeginSymbolBullet
}\label{wxrichtextbufferbeginsymbolbullet
}
230 \func{bool
}{BeginSymbolBullet
}{\param{wxChar
}{symbol
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_SYMBOL}}
232 Begins applying a symbol bullet, using a character from the current font. See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for
233 an explanation of how indentation is used to render the bulleted paragraph.
235 \membersection{wxRichTextBuffer::BeginTextColour
}\label{wxrichtextbufferbegintextcolour
}
237 \func{bool
}{BeginTextColour
}{\param{const wxColour\&
}{colour
}}
239 Begins using the specified text foreground colour.
241 \membersection{wxRichTextBuffer::BeginUnderline
}\label{wxrichtextbufferbeginunderline
}
243 \func{bool
}{BeginUnderline
}{\void}
245 Begins using underline.
247 \membersection{wxRichTextBuffer::BeginURL
}\label{wxrichtextbufferbeginurl
}
249 \func{bool
}{BeginURL
}{\param{const wxString\&
}{ url
},
\param{const wxString\&
}{ characterStyle = wxEmptyString
}}
251 Begins applying wxTEXT
\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
252 since it is common to mark a URL with a familiar style such as blue text with underlining.
254 \membersection{wxRichTextBuffer::CanPasteFromClipboard
}\label{wxrichtextbuffercanpastefromclipboard
}
256 \constfunc{bool
}{CanPasteFromClipboard
}{\void}
258 Returns
\true if content can be pasted from the clipboard.
260 \membersection{wxRichTextBuffer::CleanUpHandlers
}\label{wxrichtextbuffercleanuphandlers
}
262 \func{void
}{CleanUpHandlers
}{\void}
264 Cleans up the file handlers.
266 \membersection{wxRichTextBuffer::Clear
}\label{wxrichtextbufferclear
}
268 \func{void
}{Clear
}{\void}
272 \membersection{wxRichTextBuffer::ClearListStyle
}\label{wxrichtextbufferclearliststyle
}
274 \func{bool
}{ClearListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
276 \func{bool
}{ClearListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
278 Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
280 {\it flags
} is a bit list of the following:
282 \begin{itemize
}\itemsep=
0pt
283 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
286 See also
\helpref{wxRichTextBuffer::SetListStyle
}{wxrichtextbuffersetliststyle
},
\helpref{wxRichTextBuffer::PromoteList
}{wxrichtextbufferpromotelist
},
\helpref{wxRichTextBuffer::NumberList
}{wxrichtextbuffernumberlist
}.
288 \membersection{wxRichTextBuffer::ClearStyleStack
}\label{wxrichtextbufferclearstylestack
}
290 \func{void
}{ClearStyleStack
}{\void}
292 Clears the style stack.
294 \membersection{wxRichTextBuffer::Clone
}\label{wxrichtextbufferclone
}
296 \constfunc{wxRichTextObject*
}{Clone
}{\void}
300 \membersection{wxRichTextBuffer::Copy
}\label{wxrichtextbuffercopy
}
302 \func{void
}{Copy
}{\param{const wxRichTextBuffer\&
}{obj
}}
304 Copies the given buffer.
306 \membersection{wxRichTextBuffer::CopyToClipboard
}\label{wxrichtextbuffercopytoclipboard
}
308 \func{bool
}{CopyToClipboard
}{\param{const wxRichTextRange\&
}{range
}}
310 Copy the given range to the clipboard.
312 \membersection{wxRichTextBuffer::DeleteRangeWithUndo
}\label{wxrichtextbufferdeleterangewithundo
}
314 \func{bool
}{DeleteRangeWithUndo
}{\param{const wxRichTextRange\&
}{range
},
\param{wxRichTextCtrl*
}{ctrl
}}
316 Submits a command to delete the given range.
318 \membersection{wxRichTextBuffer::Dump
}\label{wxrichtextbufferdump
}
320 \func{void
}{Dump
}{\void}
322 \func{void
}{Dump
}{\param{wxTextOutputStream\&
}{stream
}}
324 Dumps the contents of the buffer for debugging purposes.
326 \membersection{wxRichTextBuffer::EndAlignment
}\label{wxrichtextbufferendalignment
}
328 \func{bool
}{EndAlignment
}{\void}
332 \membersection{wxRichTextBuffer::EndAllStyles
}\label{wxrichtextbufferendallstyles
}
334 \func{bool
}{EndAllStyles
}{\void}
336 Ends all styles that have been started with a Begin... command.
338 \membersection{wxRichTextBuffer::EndBatchUndo
}\label{wxrichtextbufferendbatchundo
}
340 \func{bool
}{EndBatchUndo
}{\void}
342 Ends collapsing undo/redo commands, and submits the combined command.
344 \membersection{wxRichTextBuffer::EndBold
}\label{wxrichtextbufferendbold
}
346 \func{bool
}{EndBold
}{\void}
350 \membersection{wxRichTextBuffer::EndCharacterStyle
}\label{wxrichtextbufferendcharacterstyle
}
352 \func{bool
}{EndCharacterStyle
}{\void}
354 Ends using the named character style.
356 \membersection{wxRichTextBuffer::EndFont
}\label{wxrichtextbufferendfont
}
358 \func{bool
}{EndFont
}{\void}
362 \membersection{wxRichTextBuffer::EndFontSize
}\label{wxrichtextbufferendfontsize
}
364 \func{bool
}{EndFontSize
}{\void}
366 Ends using a point size.
368 \membersection{wxRichTextBuffer::EndItalic
}\label{wxrichtextbufferenditalic
}
370 \func{bool
}{EndItalic
}{\void}
374 \membersection{wxRichTextBuffer::EndLeftIndent
}\label{wxrichtextbufferendleftindent
}
376 \func{bool
}{EndLeftIndent
}{\void}
378 Ends using a left indent.
380 \membersection{wxRichTextBuffer::EndLineSpacing
}\label{wxrichtextbufferendlinespacing
}
382 \func{bool
}{EndLineSpacing
}{\void}
384 Ends using a line spacing.
386 \membersection{wxRichTextBuffer::EndListStyle
}\label{wxrichtextbufferendliststyle
}
388 \func{bool
}{EndListStyle
}{\void}
390 Ends using a specified list style.
392 \membersection{wxRichTextBuffer::EndNumberedBullet
}\label{wxrichtextbufferendnumberedbullet
}
394 \func{bool
}{EndNumberedBullet
}{\void}
396 Ends a numbered bullet.
398 \membersection{wxRichTextBuffer::EndParagraphSpacing
}\label{wxrichtextbufferendparagraphspacing
}
400 \func{bool
}{EndParagraphSpacing
}{\void}
402 Ends paragraph spacing.
404 \membersection{wxRichTextBuffer::EndParagraphStyle
}\label{wxrichtextbufferendparagraphstyle
}
406 \func{bool
}{EndParagraphStyle
}{\void}
408 Ends applying a named character style.
410 \membersection{wxRichTextBuffer::EndRightIndent
}\label{wxrichtextbufferendrightindent
}
412 \func{bool
}{EndRightIndent
}{\void}
414 Ends using a right indent.
416 \membersection{wxRichTextBuffer::EndStyle
}\label{wxrichtextbufferendstyle
}
418 \func{bool
}{EndStyle
}{\void}
420 Ends the current style.
422 \membersection{wxRichTextBuffer::EndSuppressUndo
}\label{wxrichtextbufferendsuppressundo
}
424 \func{bool
}{EndSuppressUndo
}{\void}
426 Ends suppressing undo/redo commands.
428 \membersection{wxRichTextBuffer::EndSymbolBullet
}\label{wxrichtextbufferendsymbolbullet
}
430 \func{bool
}{EndSymbolBullet
}{\void}
432 Ends using a symbol bullet.
434 \membersection{wxRichTextBuffer::EndStandardBullet
}\label{wxrichtextbufferendstandardbullet
}
436 \func{bool
}{EndStandardBullet
}{\void}
438 Ends using a standard bullet.
440 \membersection{wxRichTextBuffer::EndTextColour
}\label{wxrichtextbufferendtextcolour
}
442 \func{bool
}{EndTextColour
}{\void}
444 Ends using a text foreground colour.
446 \membersection{wxRichTextBuffer::EndUnderline
}\label{wxrichtextbufferendunderline
}
448 \func{bool
}{EndUnderline
}{\void}
450 Ends using underline.
452 \membersection{wxRichTextBuffer::EndURL
}\label{wxrichtextbufferendurl
}
454 \func{bool
}{EndURL
}{\void}
458 \membersection{wxRichTextBuffer::FindHandler
}\label{wxrichtextbufferfindhandler
}
460 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{int
}{imageType
}}
462 Finds a handler by type.
464 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{int
}{imageType
}}
466 Finds a handler by extension and type.
468 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
470 Finds a handler by name.
472 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType
}\label{wxrichtextbufferfindhandlerfilenameortype
}
474 \func{wxRichTextFileHandler*
}{FindHandlerFilenameOrType
}{\param{const wxString\&
}{filename
},
\param{int
}{imageType
}}
476 Finds a handler by filename or, if supplied, type.
478 \membersection{wxRichTextBuffer::GetBasicStyle
}\label{wxrichtextbuffergetbasicstyle
}
480 \constfunc{const wxTextAttrEx\&
}{GetBasicStyle
}{\void}
482 Gets the basic (overall) style. This is the style of the whole
483 buffer before further styles are applied, unlike the default style, which
484 only affects the style currently being applied (for example, setting the default
485 style to bold will cause subsequently inserted text to be bold).
487 \membersection{wxRichTextBuffer::GetBatchedCommand
}\label{wxrichtextbuffergetbatchedcommand
}
489 \constfunc{wxRichTextCommand*
}{GetBatchedCommand
}{\void}
491 Gets the collapsed command.
493 \membersection{wxRichTextBuffer::GetCommandProcessor
}\label{wxrichtextbuffergetcommandprocessor
}
495 \constfunc{wxCommandProcessor*
}{GetCommandProcessor
}{\void}
497 Gets the command processor. A text buffer always creates its own command processor when it is
500 \membersection{wxRichTextBuffer::GetDefaultStyle
}\label{wxrichtextbuffergetdefaultstyle
}
502 \constfunc{const wxTextAttrEx\&
}{GetDefaultStyle
}{\void}
504 Returns the current default style, affecting the style currently being applied (for example, setting the default
505 style to bold will cause subsequently inserted text to be bold).
507 \membersection{wxRichTextBuffer::GetExtWildcard
}\label{wxrichtextbuffergetextwildcard
}
509 \func{wxString
}{GetExtWildcard
}{\param{bool
}{combine = false
},
\param{bool
}{save = false
},
\param{wxArrayInt*
}{types = NULL
}}
511 Gets a wildcard incorporating all visible handlers. If
{\it types
} is present,
512 it will be filled with the file type corresponding to each filter. This can be
513 used to determine the type to pass to
\helpref{LoadFile
}{wxrichtextbuffergetextwildcard
} given a selected filter.
515 \membersection{wxRichTextBuffer::GetHandlers
}\label{wxrichtextbuffergethandlers
}
517 \func{wxList\&
}{GetHandlers
}{\void}
519 Returns the list of file handlers.
521 \membersection{wxRichTextBuffer::GetRenderer
}\label{wxrichtextbuffergetrenderer
}
523 \func{static wxRichTextRenderer*
}{GetRenderer
}{\void}
525 Returns the object to be used to render certain aspects of the content, such as bullets.
527 \membersection{wxRichTextBuffer::GetStyle
}\label{wxrichtextbuffergetstyle
}
529 \func{bool
}{GetStyle
}{\param{long
}{position
},
\param{wxRichTextAttr\&
}{style
}}
531 \func{bool
}{GetStyle
}{\param{long
}{position
},
\param{wxTextAttrEx\&
}{style
}}
533 Gets the attributes at the given position.
535 This function gets the combined style - that is, the style you see on the screen as a result
536 of combining base style, paragraph style and character style attributes. To get the character
537 or paragraph style alone, use
\helpref{GetUncombinedStyle
}{wxrichtextbuffergetuncombinedstyle
}.
539 \membersection{wxRichTextBuffer::GetStyleForRange
}\label{wxrichtextbuffergetstyleforrange
}
541 \func{bool
}{GetStyleForRange
}{\param{const wxRichTextRange\&
}{ range
},
\param{wxTextAttrEx\&
}{style
}}
543 This function gets a style representing the common, combined attributes in the given range.
544 Attributes which have different values within the specified range will not be included the style
547 The function is used to get the attributes to display in the formatting dialog: the user
548 can edit the attributes common to the selection, and optionally specify the values of further
549 attributes to be applied uniformly.
551 To apply the edited attributes, you can use
\helpref{SetStyle
}{wxrichtextbuffersetstyle
} specifying
552 the wxRICHTEXT
\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different
553 from the
{\it combined
} attributes within the range. So, the user edits the effective, displayed attributes
554 for the range, but his choice won't be applied unnecessarily to content. As an example,
555 say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The
556 combined style is bold, and this is what the user will see on-screen and in the formatting
557 dialog. The user now specifies red text, in addition to bold. When applying with
558 SetStyle, the content font weight attributes won't be changed to bold because this is already specified
559 by the paragraph. However the text colour attributes
{\it will
} be changed to
562 \membersection{wxRichTextBuffer::GetStyleSheet
}\label{wxrichtextbuffergetstylesheet
}
564 \constfunc{wxRichTextStyleSheet*
}{GetStyleSheet
}{\void}
566 Returns the current style sheet associated with the buffer, if any.
568 \membersection{wxRichTextBuffer::GetStyleStackSize
}\label{wxrichtextbuffergetstylestacksize
}
570 \constfunc{size
\_t}{GetStyleStackSize
}{\void}
572 Get the size of the style stack, for example to check correct nesting.
574 \membersection{wxRichTextBuffer::GetUncombinedStyle
}\label{wxrichtextbuffergetuncombinedstyle
}
576 \func{bool
}{GetUncombinedStyle
}{\param{long
}{position
},
\param{wxRichTextAttr\&
}{style
}}
578 \func{bool
}{GetUncombinedStyle
}{\param{long
}{position
},
\param{wxTextAttrEx\&
}{style
}}
580 Gets the attributes at the given position.
582 This function gets the
{\it uncombined style
} - that is, the attributes associated with the
583 paragraph or character content, and not necessarily the combined attributes you see on the
584 screen. To get the combined attributes, use
\helpref{GetStyle
}{wxrichtextbuffergetstyle
}.
586 If you specify (any) paragraph attribute in
{\it style
}'s flags, this function will fetch
587 the paragraph attributes. Otherwise, it will return the character attributes.
589 \membersection{wxRichTextBuffer::HitTest
}\label{wxrichtextbufferhittest
}
591 \func{int
}{HitTest
}{\param{wxDC\&
}{dc
},
\param{const wxPoint\&
}{pt
},
\param{long\&
}{textPosition
}}
593 Finds the text position for the given position, putting the position in
{\it textPosition
} if
594 one is found.
{\it pt
} is in logical units (a zero y position is
595 at the beginning of the buffer).
597 The function returns one of the following values:
601 // The point was not on this object
602 #define wxRICHTEXT_HITTEST_NONE
0x01
603 // The point was before the position returned from HitTest
604 #define wxRICHTEXT_HITTEST_BEFORE
0x02
605 // The point was after the position returned from HitTest
606 #define wxRICHTEXT_HITTEST_AFTER
0x04
607 // The point was on the position returned from HitTest
608 #define wxRICHTEXT_HITTEST_ON
0x08
609 // The point was on space outside content
610 #define wxRICHTEXT_HITTEST_OUTSIDE
0x10
614 \membersection{wxRichTextBuffer::Init
}\label{wxrichtextbufferinit
}
616 \func{void
}{Init
}{\void}
620 \membersection{wxRichTextBuffer::InitStandardHandlers
}\label{wxrichtextbufferinitstandardhandlers
}
622 \func{void
}{InitStandardHandlers
}{\void}
624 Initialises the standard handlers. Currently, only the plain text loading/saving handler
625 is initialised by default.
627 \membersection{wxRichTextBuffer::InsertHandler
}\label{wxrichtextbufferinserthandler
}
629 \func{void
}{InsertHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
631 Inserts a handler at the front of the list.
633 \membersection{wxRichTextBuffer::InsertImageWithUndo
}\label{wxrichtextbufferinsertimagewithundo
}
635 \func{bool
}{InsertImageWithUndo
}{\param{long
}{pos
},
\param{const wxRichTextImageBlock\&
}{imageBlock
},
\param{wxRichTextCtrl*
}{ctrl
}}
637 Submits a command to insert the given image.
639 \membersection{wxRichTextBuffer::InsertNewlineWithUndo
}\label{wxrichtextbufferinsertnewlinewithundo
}
641 \func{bool
}{InsertNewlineWithUndo
}{\param{long
}{pos
},
\param{wxRichTextCtrl*
}{ctrl
}}
643 Submits a command to insert a newline.
645 \membersection{wxRichTextBuffer::InsertTextWithUndo
}\label{wxrichtextbufferinserttextwithundo
}
647 \func{bool
}{InsertTextWithUndo
}{\param{long
}{pos
},
\param{const wxString\&
}{text
},
\param{wxRichTextCtrl*
}{ctrl
}}
649 Submits a command to insert the given text.
651 \membersection{wxRichTextBuffer::IsModified
}\label{wxrichtextbufferismodified
}
653 \constfunc{bool
}{IsModified
}{\void}
655 Returns
\true if the buffer has been modified.
657 \membersection{wxRichTextBuffer::LoadFile
}\label{wxrichtextbufferloadfile
}
659 \func{bool
}{LoadFile
}{\param{wxInputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
661 Loads content from a stream.
663 \func{bool
}{LoadFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
665 Loads content from a file.
667 \membersection{wxRichTextBuffer::Modify
}\label{wxrichtextbuffermodify
}
669 \func{void
}{Modify
}{\param{bool
}{modify = true
}}
671 Marks the buffer as modified or unmodified.
673 \membersection{wxRichTextBuffer::NumberList
}\label{wxrichtextbuffernumberlist
}
675 \func{bool
}{NumberList
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxRichTextListStyleDefinition*
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ startFrom = -
1},
\param{int
}{ listLevel = -
1}}
677 \func{bool
}{Number
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxString\&
}{styleName
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ startFrom = -
1},
\param{int
}{ listLevel = -
1}}
679 Numbers the paragraphs in the given range. Pass flags to determine how the attributes are set.
680 Either the style definition or the name of the style definition (in the current sheet) can be passed.
682 {\it flags
} is a bit list of the following:
684 \begin{itemize
}\itemsep=
0pt
685 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
686 \item wxRICHTEXT
\_SETSTYLE\_RENUMBER: specifies that numbering should start from
{\it startFrom
}, otherwise existing attributes are used.
687 \item wxRICHTEXT
\_SETSTYLE\_SPECIFY\_LEVEL: specifies that
{\it listLevel
} should be used as the level for all paragraphs, otherwise the current indentation will be used.
690 See also
\helpref{wxRichTextBuffer::SetListStyle
}{wxrichtextbuffersetliststyle
},
\helpref{wxRichTextBuffer::PromoteList
}{wxrichtextbufferpromotelist
},
\helpref{wxRichTextBuffer::ClearListStyle
}{wxrichtextbufferclearliststyle
}.
692 \membersection{wxRichTextBuffer::PasteFromClipboard
}\label{wxrichtextbufferpastefromclipboard
}
694 \func{bool
}{PasteFromClipboard
}{\param{long
}{position
}}
696 Pastes the clipboard content to the buffer at the given position.
698 \membersection{wxRichTextBuffer::PromoteList
}\label{wxrichtextbufferpromotelist
}
700 \func{bool
}{PromoteList
}{\param{int
}{ promoteBy
},
\param{const wxRichTextRange\&
}{range
},
\param{const wxRichTextListStyleDefinition*
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ listLevel = -
1}}
702 \func{bool
}{PromoteList
}{\param{int
}{ promoteBy
},
\param{const wxRichTextRange\&
}{range
},
\param{const wxString\&
}{styleName
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ listLevel = -
1}}
704 Promotes or demotes the paragraphs in the given range. A positive
{\it promoteBy
} produces a smaller indent, and a negative number
705 produces a larger indent. Pass flags to determine how the attributes are set.
706 Either the style definition or the name of the style definition (in the current sheet) can be passed.
708 {\it flags
} is a bit list of the following:
710 \begin{itemize
}\itemsep=
0pt
711 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
712 \item wxRICHTEXT
\_SETSTYLE\_RENUMBER: specifies that numbering should start from
{\it startFrom
}, otherwise existing attributes are used.
713 \item wxRICHTEXT
\_SETSTYLE\_SPECIFY\_LEVEL: specifies that
{\it listLevel
} should be used as the level for all paragraphs, otherwise the current indentation will be used.
716 See also
\helpref{wxRichTextBuffer::SetListStyle
}{wxrichtextbuffersetliststyle
}, See also
\helpref{wxRichTextBuffer::SetListStyle
}{wxrichtextbuffernumberlist
},
\helpref{wxRichTextBuffer::ClearListStyle
}{wxrichtextbufferclearliststyle
}.
718 \membersection{wxRichTextBuffer::RemoveEventHandler
}\label{wxrichtextbufferremoveeventhandler
}
720 \func{bool
}{RemoveEventHandler
}{\param{wxEvtHandler*
}{handler
},
\param{bool
}{ deleteHandler = false
}}
722 Removes an event handler from the buffer's list of handlers, deleting the object if
{\it deleteHandler
} is
\true.
724 \membersection{wxRichTextBuffer::RemoveHandler
}\label{wxrichtextbufferremovehandler
}
726 \func{bool
}{RemoveHandler
}{\param{const wxString\&
}{name
}}
730 \membersection{wxRichTextBuffer::ResetAndClearCommands
}\label{wxrichtextbufferresetandclearcommands
}
732 \func{void
}{ResetAndClearCommands
}{\void}
734 Clears the buffer, adds a new blank paragraph, and clears the command history.
736 \membersection{wxRichTextBuffer::SaveFile
}\label{wxrichtextbuffersavefile
}
738 \func{bool
}{SaveFile
}{\param{wxOutputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
740 Saves content to a stream.
742 \func{bool
}{SaveFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
744 Saves content to a file.
746 \membersection{wxRichTextBuffer::SetBasicStyle
}\label{wxrichtextbuffersetbasicstyle
}
748 \func{void
}{SetBasicStyle
}{\param{const wxRichTextAttr\&
}{style
}}
750 \func{void
}{SetBasicStyle
}{\param{const wxTextAttrEx\&
}{style
}}
752 Sets the basic (overall) style. This is the style of the whole
753 buffer before further styles are applied, unlike the default style, which
754 only affects the style currently being applied (for example, setting the default
755 style to bold will cause subsequently inserted text to be bold).
757 \membersection{wxRichTextBuffer::SetDefaultStyle
}\label{wxrichtextbuffersetdefaultstyle
}
759 \func{void
}{SetDefaultStyle
}{\param{const wxTextAttrEx\&
}{style
}}
761 Sets the default style, affecting the style currently being applied (for example, setting the default
762 style to bold will cause subsequently inserted text to be bold).
764 This is not cumulative - setting the default style will replace the previous default style.
766 \membersection{wxRichTextBuffer::SetListStyle
}\label{wxrichtextbuffersetliststyle
}
768 \func{bool
}{SetListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxRichTextListStyleDefinition*
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ startFrom = -
1},
\param{int
}{ listLevel = -
1}}
770 \func{bool
}{SetListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxString\&
}{styleName
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO},
\param{int
}{ startFrom = -
1},
\param{int
}{ listLevel = -
1}}
772 Sets the list attributes for the given range, passing flags to determine how the attributes are set.
773 Either the style definition or the name of the style definition (in the current sheet) can be passed.
775 {\it flags
} is a bit list of the following:
777 \begin{itemize
}\itemsep=
0pt
778 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
779 \item wxRICHTEXT
\_SETSTYLE\_RENUMBER: specifies that numbering should start from
{\it startFrom
}, otherwise existing attributes are used.
780 \item wxRICHTEXT
\_SETSTYLE\_SPECIFY\_LEVEL: specifies that
{\it listLevel
} should be used as the level for all paragraphs, otherwise the current indentation will be used.
783 See also
\helpref{wxRichTextBuffer::NumberList
}{wxrichtextbuffernumberlist
},
\helpref{wxRichTextBuffer::PromoteList
}{wxrichtextbufferpromotelist
},
\helpref{wxRichTextBuffer::ClearListStyle
}{wxrichtextbufferclearliststyle
}.
785 \membersection{wxRichTextBuffer::SetRenderer
}\label{wxrichtextbuffersetrenderer
}
787 \func{static void
}{SetRenderer
}{\param{wxRichTextRenderer*
}{renderer
}}
789 Sets
{\it renderer
} as the object to be used to render certain aspects of the content, such as bullets.
790 You can override default rendering by deriving a new class from wxRichTextRenderer or wxRichTextStdRenderer,
791 overriding one or more virtual functions, and setting an instance of the class using this function.
793 \membersection{wxRichTextBuffer::SetStyle
}\label{wxrichtextbuffersetstyle
}
795 \func{bool
}{SetStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxRichTextAttr\&
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
797 \func{bool
}{SetStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxTextAttrEx\&
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
799 Sets the attributes for the given range. Pass flags to determine how the attributes are set.
801 The end point of range is specified as the last character position of the span of text.
802 So, for example, to set the style for a character at position
5, use the range (
5,
5).
803 This differs from the wxRichTextCtrl API, where you would specify (
5,
6).
805 {\it flags
} may contain a bit list of the following values:
807 \begin{itemize
}\itemsep=
0pt
808 \item wxRICHTEXT
\_SETSTYLE\_NONE: no style flag.
809 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this operation should be undoable.
810 \item wxRICHTEXT
\_SETSTYLE\_OPTIMIZE: specifies that the style should not be applied if the
811 combined style at this point is already the style in question.
812 \item wxRICHTEXT
\_SETSTYLE\_PARAGRAPHS\_ONLY: specifies that the style should only be applied to paragraphs,
813 and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
814 \item wxRICHTEXT
\_SETSTYLE\_CHARACTERS\_ONLY: specifies that the style should only be applied to characters,
815 and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
816 \item wxRICHTEXT
\_SETSTYLE\_RESET: resets (clears) the existing style before applying the new style.
819 \membersection{wxRichTextBuffer::SetStyleSheet
}\label{wxrichtextbuffersetstylesheet
}
821 \func{void
}{SetStyleSheet
}{\param{wxRichTextStyleSheet*
}{styleSheet
}}
823 Sets the current style sheet, if any. This will allow the application to use
824 named character and paragraph styles found in the style sheet.
826 \membersection{wxRichTextBuffer::SubmitAction
}\label{wxrichtextbuffersubmitaction
}
828 \func{bool
}{SubmitAction
}{\param{wxRichTextAction*
}{action
}}
830 Submit an action immediately, or delay it according to whether collapsing is on.
832 \membersection{wxRichTextBuffer::SuppressingUndo
}\label{wxrichtextbuffersuppressingundo
}
834 \constfunc{bool
}{SuppressingUndo
}{\void}
836 Returns
\true if undo suppression is currently on.