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::AddHandler
}\label{wxrichtextbufferaddhandler
}
39 \func{void
}{AddHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
43 \membersection{wxRichTextBuffer::AddParagraph
}\label{wxrichtextbufferaddparagraph
}
45 \func{wxRichTextRange
}{AddParagraph
}{\param{const wxString\&
}{text
}}
47 Adds a paragraph of text.
49 \membersection{wxRichTextBuffer::BatchingUndo
}\label{wxrichtextbufferbatchingundo
}
51 \constfunc{bool
}{BatchingUndo
}{\void}
53 Returns
\true if the buffer is currently collapsing commands into a single notional command.
55 \membersection{wxRichTextBuffer::BeginAlignment
}\label{wxrichtextbufferbeginalignment
}
57 \func{bool
}{BeginAlignment
}{\param{wxTextAttrAlignment
}{alignment
}}
59 Begins using alignment.
61 \membersection{wxRichTextBuffer::BeginBatchUndo
}\label{wxrichtextbufferbeginbatchundo
}
63 \func{bool
}{BeginBatchUndo
}{\param{const wxString\&
}{cmdName
}}
65 Begins collapsing undo/redo commands. Note that this may not work properly
66 if combining commands that delete or insert content, changing ranges for
69 {\it cmdName
} should be the name of the combined command that will appear
70 next to Undo and Redo in the edit menu.
72 \membersection{wxRichTextBuffer::BeginBold
}\label{wxrichtextbufferbeginbold
}
74 \func{bool
}{BeginBold
}{\void}
78 \membersection{wxRichTextBuffer::BeginCharacterStyle
}\label{wxrichtextbufferbegincharacterstyle
}
80 \func{bool
}{BeginCharacterStyle
}{\param{const wxString\&
}{characterStyle
}}
82 Begins applying the named character style.
84 \membersection{wxRichTextBuffer::BeginFont
}\label{wxrichtextbufferbeginfont
}
86 \func{bool
}{BeginFont
}{\param{const wxFont\&
}{font
}}
88 Begins using this font.
90 \membersection{wxRichTextBuffer::BeginFontSize
}\label{wxrichtextbufferbeginfontsize
}
92 \func{bool
}{BeginFontSize
}{\param{int
}{pointSize
}}
94 Begins using the given point size.
96 \membersection{wxRichTextBuffer::BeginItalic
}\label{wxrichtextbufferbeginitalic
}
98 \func{bool
}{BeginItalic
}{\void}
102 \membersection{wxRichTextBuffer::BeginLeftIndent
}\label{wxrichtextbufferbeginleftindent
}
104 \func{bool
}{BeginLeftIndent
}{\param{int
}{leftIndent
},
\param{int
}{leftSubIndent =
0}}
106 Begin using
{\it leftIndent
} for the left indent, and optionally
{\it leftSubIndent
} for
107 the sub-indent. Both are expressed in tenths of a millimetre.
109 The sub-indent is an offset from the left of the paragraph, and is used for all but the
110 first line in a paragraph. A positive value will cause the first line to appear to the left
111 of the subsequent lines, and a negative value will cause the first line to be indented
112 relative to the subsequent lines.
114 \membersection{wxRichTextBuffer::BeginLineSpacing
}\label{wxrichtextbufferbeginlinespacing
}
116 \func{bool
}{BeginLineSpacing
}{\param{int
}{lineSpacing
}}
118 Begins line spacing using the specified value.
{\it spacing
} is a multiple, where
10 means single-spacing,
119 15 means
1.5 spacing, and
20 means double spacing. The following constants are
120 defined for convenience:
124 #define wxTEXT_ATTR_LINE_SPACING_NORMAL
10
125 #define wxTEXT_ATTR_LINE_SPACING_HALF
15
126 #define wxTEXT_ATTR_LINE_SPACING_TWICE
20
130 \membersection{wxRichTextBuffer::BeginNumberedBullet
}\label{wxrichtextbufferbeginnumberedbullet
}
132 \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}}
134 Begins a numbered bullet. This call will be needed for each item in the list, and the
135 application should take care of incrementing the numbering.
137 {\it bulletNumber
} is a number, usually starting with
1.
139 {\it leftIndent
} and
{\it leftSubIndent
} are values in tenths of a millimetre.
141 {\it bulletStyle
} is a bitlist of the following values:
145 #define wxTEXT_ATTR_BULLET_STYLE_NONE
0x0000
146 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC
0x0001
147 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
0x0002
148 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
0x0004
149 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
0x0008
150 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
0x0010
151 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL
0x0020
152 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP
0x0040
153 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
0x0080
154 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD
0x0100
158 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
159 the margin and the bullet. The content of the paragraph, including the first line, starts
160 at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
161 left of the actual paragraph is leftSubIndent.
163 \membersection{wxRichTextBuffer::BeginParagraphSpacing
}\label{wxrichtextbufferbeginparagraphspacing
}
165 \func{bool
}{BeginParagraphSpacing
}{\param{int
}{before
},
\param{int
}{after
}}
167 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
170 \membersection{wxRichTextBuffer::BeginParagraphStyle
}\label{wxrichtextbufferbeginparagraphstyle
}
172 \func{bool
}{BeginParagraphStyle
}{\param{const wxString\&
}{paragraphStyle
}}
174 Begins applying the named paragraph style.
176 \membersection{wxRichTextBuffer::BeginRightIndent
}\label{wxrichtextbufferbeginrightindent
}
178 \func{bool
}{BeginRightIndent
}{\param{int
}{rightIndent
}}
180 Begins a right indent, specified in tenths of a millimetre.
182 \membersection{wxRichTextBuffer::BeginStyle
}\label{wxrichtextbufferbeginstyle
}
184 \func{bool
}{BeginStyle
}{\param{const wxTextAttrEx\&
}{style
}}
186 Begins using a specified style.
188 \membersection{wxRichTextBuffer::BeginSuppressUndo
}\label{wxrichtextbufferbeginsuppressundo
}
190 \func{bool
}{BeginSuppressUndo
}{\void}
192 Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
193 differently by each command. If not dealt with by a command implementation, then
194 it will be implemented automatically by not storing the command in the undo history
195 when the action is submitted to the command processor.
197 \membersection{wxRichTextBuffer::BeginSymbolBullet
}\label{wxrichtextbufferbeginsymbolbullet
}
199 \func{bool
}{BeginSymbolBullet
}{\param{wxChar
}{symbol
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_SYMBOL}}
201 Begins applying a symbol bullet, using a character from the current font. See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for
202 an explanation of how indentation is used to render the bulleted paragraph.
204 \membersection{wxRichTextBuffer::BeginTextColour
}\label{wxrichtextbufferbegintextcolour
}
206 \func{bool
}{BeginTextColour
}{\param{const wxColour\&
}{colour
}}
208 Begins using the specified text foreground colour.
210 \membersection{wxRichTextBuffer::BeginUnderline
}\label{wxrichtextbufferbeginunderline
}
212 \func{bool
}{BeginUnderline
}{\void}
214 Begins using underline.
216 \membersection{wxRichTextBuffer::CanPasteFromClipboard
}\label{wxrichtextbuffercanpastefromclipboard
}
218 \constfunc{bool
}{CanPasteFromClipboard
}{\void}
220 Returns
\true if content can be pasted from the clipboard.
222 \membersection{wxRichTextBuffer::CleanUpHandlers
}\label{wxrichtextbuffercleanuphandlers
}
224 \func{void
}{CleanUpHandlers
}{\void}
226 Cleans up the file handlers.
228 \membersection{wxRichTextBuffer::Clear
}\label{wxrichtextbufferclear
}
230 \func{void
}{Clear
}{\void}
232 Clears the buffer and resets the command processor.
234 \membersection{wxRichTextBuffer::ClearStyleStack
}\label{wxrichtextbufferclearstylestack
}
236 \func{void
}{ClearStyleStack
}{\void}
238 Clears the style stack.
240 \membersection{wxRichTextBuffer::Clone
}\label{wxrichtextbufferclone
}
242 \constfunc{wxRichTextObject*
}{Clone
}{\void}
246 \membersection{wxRichTextBuffer::Copy
}\label{wxrichtextbuffercopy
}
248 \func{void
}{Copy
}{\param{const wxRichTextBuffer\&
}{obj
}}
250 Copies the given buffer.
252 \membersection{wxRichTextBuffer::CopyToClipboard
}\label{wxrichtextbuffercopytoclipboard
}
254 \func{bool
}{CopyToClipboard
}{\param{const wxRichTextRange\&
}{range
}}
256 Copy the given range to the clipboard.
258 \membersection{wxRichTextBuffer::DeleteRangeWithUndo
}\label{wxrichtextbufferdeleterangewithundo
}
260 \func{bool
}{DeleteRangeWithUndo
}{\param{const wxRichTextRange\&
}{range
},
\param{long
}{initialCaretPosition
},
\param{long
}{newCaretPositon
},
\param{wxRichTextCtrl*
}{ctrl
}}
262 Submits a command to delete the given range.
264 \membersection{wxRichTextBuffer::Dump
}\label{wxrichtextbufferdump
}
266 \func{void
}{Dump
}{\void}
268 \func{void
}{Dump
}{\param{wxTextOutputStream\&
}{stream
}}
270 Dumps the contents of the buffer for debugging purposes.
272 \membersection{wxRichTextBuffer::EndAlignment
}\label{wxrichtextbufferendalignment
}
274 \func{bool
}{EndAlignment
}{\void}
278 \membersection{wxRichTextBuffer::EndAllStyles
}\label{wxrichtextbufferendallstyles
}
280 \func{bool
}{EndAllStyles
}{\void}
282 Ends all styles that have been started with a Begin... command.
284 \membersection{wxRichTextBuffer::EndBatchUndo
}\label{wxrichtextbufferendbatchundo
}
286 \func{bool
}{EndBatchUndo
}{\void}
288 Ends collapsing undo/redo commands, and submits the combined command.
290 \membersection{wxRichTextBuffer::EndBold
}\label{wxrichtextbufferendbold
}
292 \func{bool
}{EndBold
}{\void}
296 \membersection{wxRichTextBuffer::EndCharacterStyle
}\label{wxrichtextbufferendcharacterstyle
}
298 \func{bool
}{EndCharacterStyle
}{\void}
300 Ends using the named character style.
302 \membersection{wxRichTextBuffer::EndFont
}\label{wxrichtextbufferendfont
}
304 \func{bool
}{EndFont
}{\void}
308 \membersection{wxRichTextBuffer::EndFontSize
}\label{wxrichtextbufferendfontsize
}
310 \func{bool
}{EndFontSize
}{\void}
312 Ends using a point size.
314 \membersection{wxRichTextBuffer::EndItalic
}\label{wxrichtextbufferenditalic
}
316 \func{bool
}{EndItalic
}{\void}
320 \membersection{wxRichTextBuffer::EndLeftIndent
}\label{wxrichtextbufferendleftindent
}
322 \func{bool
}{EndLeftIndent
}{\void}
324 Ends using a left indent.
326 \membersection{wxRichTextBuffer::EndLineSpacing
}\label{wxrichtextbufferendlinespacing
}
328 \func{bool
}{EndLineSpacing
}{\void}
330 Ends using a line spacing.
332 \membersection{wxRichTextBuffer::EndNumberedBullet
}\label{wxrichtextbufferendnumberedbullet
}
334 \func{bool
}{EndNumberedBullet
}{\void}
336 Ends a numbered bullet.
338 \membersection{wxRichTextBuffer::EndParagraphSpacing
}\label{wxrichtextbufferendparagraphspacing
}
340 \func{bool
}{EndParagraphSpacing
}{\void}
342 Ends paragraph spacing.
344 \membersection{wxRichTextBuffer::EndParagraphStyle
}\label{wxrichtextbufferendparagraphstyle
}
346 \func{bool
}{EndParagraphStyle
}{\void}
348 Ends applying a named character style.
350 \membersection{wxRichTextBuffer::EndRightIndent
}\label{wxrichtextbufferendrightindent
}
352 \func{bool
}{EndRightIndent
}{\void}
354 Ends using a right indent.
356 \membersection{wxRichTextBuffer::EndStyle
}\label{wxrichtextbufferendstyle
}
358 \func{bool
}{EndStyle
}{\void}
360 Ends the current style.
362 \membersection{wxRichTextBuffer::EndSuppressUndo
}\label{wxrichtextbufferendsuppressundo
}
364 \func{bool
}{EndSuppressUndo
}{\void}
366 Ends suppressing undo/redo commands.
368 \membersection{wxRichTextBuffer::EndSymbolBullet
}\label{wxrichtextbufferendsymbolbullet
}
370 \func{bool
}{EndSymbolBullet
}{\void}
372 Ends using a symbol bullet.
374 \membersection{wxRichTextBuffer::EndTextColour
}\label{wxrichtextbufferendtextcolour
}
376 \func{bool
}{EndTextColour
}{\void}
378 Ends using a text foreground colour.
380 \membersection{wxRichTextBuffer::EndUnderline
}\label{wxrichtextbufferendunderline
}
382 \func{bool
}{EndUnderline
}{\void}
384 Ends using underline.
386 \membersection{wxRichTextBuffer::FindHandler
}\label{wxrichtextbufferfindhandler
}
388 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{int
}{imageType
}}
390 Finds a handler by type.
392 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{int
}{imageType
}}
394 Finds a handler by extension and type.
396 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
398 Finds a handler by name.
400 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType
}\label{wxrichtextbufferfindhandlerfilenameortype
}
402 \func{wxRichTextFileHandler*
}{FindHandlerFilenameOrType
}{\param{const wxString\&
}{filename
},
\param{int
}{imageType
}}
404 Finds a handler by filename or, if supplied, type.
406 \membersection{wxRichTextBuffer::GetBatchedCommand
}\label{wxrichtextbuffergetbatchedcommand
}
408 \constfunc{wxRichTextCommand*
}{GetBatchedCommand
}{\void}
410 Gets the collapsed command.
412 \membersection{wxRichTextBuffer::GetCommandProcessor
}\label{wxrichtextbuffergetcommandprocessor
}
414 \constfunc{wxCommandProcessor*
}{GetCommandProcessor
}{\void}
416 Gets the command processor. A text buffer always creates its own command processor when it is
419 \membersection{wxRichTextBuffer::GetExtWildcard
}\label{wxrichtextbuffergetextwildcard
}
421 \func{wxString
}{GetExtWildcard
}{\param{bool
}{combine = false
},
\param{bool
}{save = false
},
\param{wxArrayInt*
}{types = NULL
}}
423 Gets a wildcard incorporating all visible handlers. If
{\it types
} is present,
424 it will be filled with the file type corresponding to each filter. This can be
425 used to determine the type to pass to
\helpref{LoadFile
}{wxrichtextbuffergetextwildcard
} given a selected filter.
427 \membersection{wxRichTextBuffer::GetHandlers
}\label{wxrichtextbuffergethandlers
}
429 \func{wxList\&
}{GetHandlers
}{\void}
431 Returns the list of file handlers.
433 \membersection{wxRichTextBuffer::GetStyleSheet
}\label{wxrichtextbuffergetstylesheet
}
435 \constfunc{wxRichTextStyleSheet*
}{GetStyleSheet
}{\void}
437 Returns the current style sheet associated with the buffer, if any.
439 \membersection{wxRichTextBuffer::GetStyleStackSize
}\label{wxrichtextbuffergetstylestacksize
}
441 \constfunc{size
\_t}{GetStyleStackSize
}{\void}
443 Get the size of the style stack, for example to check correct nesting.
445 \membersection{wxRichTextBuffer::HitTest
}\label{wxrichtextbufferhittest
}
447 \func{int
}{HitTest
}{\param{wxDC\&
}{dc
},
\param{const wxPoint\&
}{pt
},
\param{long\&
}{textPosition
}}
449 Finds the text position for the given position, putting the position in
{\it textPosition
} if
450 one is found.
{\it pt
} is in logical units (a zero y position is
451 at the beginning of the buffer).
453 The function returns one of the following values:
457 // The point was not on this object
458 #define wxRICHTEXT_HITTEST_NONE
0x01
459 // The point was before the position returned from HitTest
460 #define wxRICHTEXT_HITTEST_BEFORE
0x02
461 // The point was after the position returned from HitTest
462 #define wxRICHTEXT_HITTEST_AFTER
0x04
463 // The point was on the position returned from HitTest
464 #define wxRICHTEXT_HITTEST_ON
0x08
468 \membersection{wxRichTextBuffer::Init
}\label{wxrichtextbufferinit
}
470 \func{void
}{Init
}{\void}
474 \membersection{wxRichTextBuffer::InitStandardHandlers
}\label{wxrichtextbufferinitstandardhandlers
}
476 \func{void
}{InitStandardHandlers
}{\void}
478 Initialises the standard handlers. Currently, only the plain text loading/saving handler
479 is initialised by default.
481 \membersection{wxRichTextBuffer::InsertHandler
}\label{wxrichtextbufferinserthandler
}
483 \func{void
}{InsertHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
485 Inserts a handler at the front of the list.
487 \membersection{wxRichTextBuffer::InsertImageWithUndo
}\label{wxrichtextbufferinsertimagewithundo
}
489 \func{bool
}{InsertImageWithUndo
}{\param{long
}{pos
},
\param{const wxRichTextImageBlock\&
}{imageBlock
},
\param{wxRichTextCtrl*
}{ctrl
}}
491 Submits a command to insert the given image.
493 \membersection{wxRichTextBuffer::InsertNewlineWithUndo
}\label{wxrichtextbufferinsertnewlinewithundo
}
495 \func{bool
}{InsertNewlineWithUndo
}{\param{long
}{pos
},
\param{wxRichTextCtrl*
}{ctrl
}}
497 Submits a command to insert a newline.
499 \membersection{wxRichTextBuffer::InsertTextWithUndo
}\label{wxrichtextbufferinserttextwithundo
}
501 \func{bool
}{InsertTextWithUndo
}{\param{long
}{pos
},
\param{const wxString\&
}{text
},
\param{wxRichTextCtrl*
}{ctrl
}}
503 Submits a command to insert the given text.
505 \membersection{wxRichTextBuffer::IsModified
}\label{wxrichtextbufferismodified
}
507 \constfunc{bool
}{IsModified
}{\void}
509 Returns
\true if the buffer has been modified.
511 \membersection{wxRichTextBuffer::LoadFile
}\label{wxrichtextbufferloadfile
}
513 \func{bool
}{LoadFile
}{\param{wxInputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
515 Loads content from a stream.
517 \func{bool
}{LoadFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
519 Loads content from a file.
521 \membersection{wxRichTextBuffer::Modify
}\label{wxrichtextbuffermodify
}
523 \func{void
}{Modify
}{\param{bool
}{modify = true
}}
525 Marks the buffer as modified or unmodified.
527 \membersection{wxRichTextBuffer::PasteFromClipboard
}\label{wxrichtextbufferpastefromclipboard
}
529 \func{bool
}{PasteFromClipboard
}{\param{long
}{position
}}
531 Pastes the clipboard content to the buffer at the given position.
533 \membersection{wxRichTextBuffer::RemoveHandler
}\label{wxrichtextbufferremovehandler
}
535 \func{bool
}{RemoveHandler
}{\param{const wxString\&
}{name
}}
539 \membersection{wxRichTextBuffer::Reset
}\label{wxrichtextbufferreset
}
541 \func{void
}{Reset
}{\void}
543 The same as
\helpref{Clear
}{wxrichtextbufferclear
}, plus an empty paragraph is added.
545 \membersection{wxRichTextBuffer::SaveFile
}\label{wxrichtextbuffersavefile
}
547 \func{bool
}{SaveFile
}{\param{wxOutputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
549 Saves content to a stream.
551 \func{bool
}{SaveFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
553 Saves content to a file.
555 \membersection{wxRichTextBuffer::SetStyleSheet
}\label{wxrichtextbuffersetstylesheet
}
557 \func{void
}{SetStyleSheet
}{\param{wxRichTextStyleSheet*
}{styleSheet
}}
559 Sets the current style sheet, if any. This will allow the application to use
560 named character and paragraph styles found in the style sheet.
562 \membersection{wxRichTextBuffer::SubmitAction
}\label{wxrichtextbuffersubmitaction
}
564 \func{bool
}{SubmitAction
}{\param{wxRichTextAction*
}{action
}}
566 Submit an action immediately, or delay it according to whether collapsing is on.
568 \membersection{wxRichTextBuffer::SuppressingUndo
}\label{wxrichtextbuffersuppressingundo
}
570 \constfunc{bool
}{SuppressingUndo
}{\void}
572 Returns
\true if undo suppression is currently on.