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>
15 \helpref{wxRichtext
}{librarieslist
}
17 \wxheading{Data structures
}
21 \helpref{wxTextAttr
}{wxtextattr
},
\helpref{wxRichTextCtrl
}{wxrichtextctrl
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxRichTextBuffer::wxRichTextBuffer
}\label{wxrichtextbufferwxrichtextbuffer
}
27 \func{}{wxRichTextBuffer
}{\param{const wxRichTextBuffer\&
}{obj
}}
31 \func{}{wxRichTextBuffer
}{\void}
35 \membersection{wxRichTextBuffer::
\destruct{wxRichTextBuffer
}}\label{wxrichtextbufferdtor
}
37 \func{}{\destruct{wxRichTextBuffer
}}{\void}
41 \membersection{wxRichTextBuffer::AddEventHandler
}\label{wxrichtextbufferaddeventhandler
}
43 \func{bool
}{AddEventHandler
}{\param{wxEvtHandler*
}{handler
}}
45 Adds an event handler to the buffer's list of handlers. A buffer associated with
46 a contol has the control as the only event handler, but the application is free
47 to add more if further notification is required. All handlers are notified
48 of an event originating from the buffer, such as the replacement of a style sheet
49 during loading. The buffer never deletes any of the event handlers, unless
50 \helpref{wxRichTextBuffer::RemoveEventHandler
}{wxrichtextbufferremoveeventhandler
} is
51 called with
\true as the second argument.
53 \membersection{wxRichTextBuffer::AddHandler
}\label{wxrichtextbufferaddhandler
}
55 \func{void
}{AddHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
59 \membersection{wxRichTextBuffer::AddParagraph
}\label{wxrichtextbufferaddparagraph
}
61 \func{wxRichTextRange
}{AddParagraph
}{\param{const wxString\&
}{text
}}
63 Adds a paragraph of text.
65 \membersection{wxRichTextBuffer::BatchingUndo
}\label{wxrichtextbufferbatchingundo
}
67 \constfunc{bool
}{BatchingUndo
}{\void}
69 Returns
\true if the buffer is currently collapsing commands into a single notional command.
71 \membersection{wxRichTextBuffer::BeginAlignment
}\label{wxrichtextbufferbeginalignment
}
73 \func{bool
}{BeginAlignment
}{\param{wxTextAttrAlignment
}{alignment
}}
75 Begins using alignment.
77 \membersection{wxRichTextBuffer::BeginBatchUndo
}\label{wxrichtextbufferbeginbatchundo
}
79 \func{bool
}{BeginBatchUndo
}{\param{const wxString\&
}{cmdName
}}
81 Begins collapsing undo/redo commands. Note that this may not work properly
82 if combining commands that delete or insert content, changing ranges for
85 {\it cmdName
} should be the name of the combined command that will appear
86 next to Undo and Redo in the edit menu.
88 \membersection{wxRichTextBuffer::BeginBold
}\label{wxrichtextbufferbeginbold
}
90 \func{bool
}{BeginBold
}{\void}
94 \membersection{wxRichTextBuffer::BeginCharacterStyle
}\label{wxrichtextbufferbegincharacterstyle
}
96 \func{bool
}{BeginCharacterStyle
}{\param{const wxString\&
}{characterStyle
}}
98 Begins applying the named character style.
100 \membersection{wxRichTextBuffer::BeginFont
}\label{wxrichtextbufferbeginfont
}
102 \func{bool
}{BeginFont
}{\param{const wxFont\&
}{font
}}
104 Begins using this font.
106 \membersection{wxRichTextBuffer::BeginFontSize
}\label{wxrichtextbufferbeginfontsize
}
108 \func{bool
}{BeginFontSize
}{\param{int
}{pointSize
}}
110 Begins using the given point size.
112 \membersection{wxRichTextBuffer::BeginItalic
}\label{wxrichtextbufferbeginitalic
}
114 \func{bool
}{BeginItalic
}{\void}
118 \membersection{wxRichTextBuffer::BeginLeftIndent
}\label{wxrichtextbufferbeginleftindent
}
120 \func{bool
}{BeginLeftIndent
}{\param{int
}{leftIndent
},
\param{int
}{leftSubIndent =
0}}
122 Begin using
{\it leftIndent
} for the left indent, and optionally
{\it leftSubIndent
} for
123 the sub-indent. Both are expressed in tenths of a millimetre.
125 The sub-indent is an offset from the left of the paragraph, and is used for all but the
126 first line in a paragraph. A positive value will cause the first line to appear to the left
127 of the subsequent lines, and a negative value will cause the first line to be indented
128 relative to the subsequent lines.
130 \membersection{wxRichTextBuffer::BeginLineSpacing
}\label{wxrichtextbufferbeginlinespacing
}
132 \func{bool
}{BeginLineSpacing
}{\param{int
}{lineSpacing
}}
134 Begins line spacing using the specified value.
{\it spacing
} is a multiple, where
10 means single-spacing,
135 15 means
1.5 spacing, and
20 means double spacing. The following constants are
136 defined for convenience:
140 #define wxTEXT_ATTR_LINE_SPACING_NORMAL
10
141 #define wxTEXT_ATTR_LINE_SPACING_HALF
15
142 #define wxTEXT_ATTR_LINE_SPACING_TWICE
20
146 \membersection{wxRichTextBuffer::BeginListStyle
}\label{wxrichtextbufferbeginliststyle
}
148 \func{bool
}{BeginListStyle
}{\param{const wxString\&
}{ listStyle
},
\param{int
}{ level=
1},
\param{int
}{ number=
1}}
150 Begins using a specified list style. Optionally, you can also pass a level and a number.
152 \membersection{wxRichTextBuffer::BeginNumberedBullet
}\label{wxrichtextbufferbeginnumberedbullet
}
154 \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}}
156 Begins a numbered bullet. This call will be needed for each item in the list, and the
157 application should take care of incrementing the numbering.
159 {\it bulletNumber
} is a number, usually starting with
1.
161 {\it leftIndent
} and
{\it leftSubIndent
} are values in tenths of a millimetre.
163 {\it bulletStyle
} is a bitlist of the following values:
167 #define wxTEXT_ATTR_BULLET_STYLE_NONE
0x00000000
168 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC
0x00000001
169 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
0x00000002
170 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
0x00000004
171 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
0x00000008
172 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
0x00000010
173 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL
0x00000020
174 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP
0x00000040
175 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
0x00000080
176 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD
0x00000100
177 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD
0x00000200
178 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS
0x00000400
179 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE
0x00000800
180 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT
0x00000000
181 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT
0x00001000
182 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE
0x00002000
186 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
187 the margin and the bullet. The content of the paragraph, including the first line, starts
188 at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
189 left of the actual paragraph is leftSubIndent.
191 \membersection{wxRichTextBuffer::BeginParagraphSpacing
}\label{wxrichtextbufferbeginparagraphspacing
}
193 \func{bool
}{BeginParagraphSpacing
}{\param{int
}{before
},
\param{int
}{after
}}
195 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
198 \membersection{wxRichTextBuffer::BeginParagraphStyle
}\label{wxrichtextbufferbeginparagraphstyle
}
200 \func{bool
}{BeginParagraphStyle
}{\param{const wxString\&
}{paragraphStyle
}}
202 Begins applying the named paragraph style.
204 \membersection{wxRichTextBuffer::BeginRightIndent
}\label{wxrichtextbufferbeginrightindent
}
206 \func{bool
}{BeginRightIndent
}{\param{int
}{rightIndent
}}
208 Begins a right indent, specified in tenths of a millimetre.
210 \membersection{wxRichTextBuffer::BeginStyle
}\label{wxrichtextbufferbeginstyle
}
212 \func{bool
}{BeginStyle
}{\param{const wxTextAttr\&
}{style
}}
214 Begins using a specified style.
216 \membersection{wxRichTextBuffer::BeginSuppressUndo
}\label{wxrichtextbufferbeginsuppressundo
}
218 \func{bool
}{BeginSuppressUndo
}{\void}
220 Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
221 differently by each command. If not dealt with by a command implementation, then
222 it will be implemented automatically by not storing the command in the undo history
223 when the action is submitted to the command processor.
225 \membersection{wxRichTextBuffer::BeginStandardBullet
}\label{wxrichtextbufferbeginstandardbullet
}
227 \func{bool
}{BeginStandardBullet
}{\param{const wxString\&
}{ bulletName
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_STANDARD}}
229 Begins applying a standard bullet, using one of the standard bullet names (currently
{\tt standard/circle
} or
{\tt standard/square
}.
230 See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for an explanation of how indentation is used to render the bulleted paragraph.
232 \membersection{wxRichTextBuffer::BeginSymbolBullet
}\label{wxrichtextbufferbeginsymbolbullet
}
234 \func{bool
}{BeginSymbolBullet
}{\param{wxChar
}{symbol
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_SYMBOL}}
236 Begins applying a symbol bullet, using a character from the current font. See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for
237 an explanation of how indentation is used to render the bulleted paragraph.
239 \membersection{wxRichTextBuffer::BeginTextColour
}\label{wxrichtextbufferbegintextcolour
}
241 \func{bool
}{BeginTextColour
}{\param{const wxColour\&
}{colour
}}
243 Begins using the specified text foreground colour.
245 \membersection{wxRichTextBuffer::BeginUnderline
}\label{wxrichtextbufferbeginunderline
}
247 \func{bool
}{BeginUnderline
}{\void}
249 Begins using underline.
251 \membersection{wxRichTextBuffer::BeginURL
}\label{wxrichtextbufferbeginurl
}
253 \func{bool
}{BeginURL
}{\param{const wxString\&
}{ url
},
\param{const wxString\&
}{ characterStyle = wxEmptyString
}}
255 Begins applying wxTEXT
\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
256 since it is common to mark a URL with a familiar style such as blue text with underlining.
258 \membersection{wxRichTextBuffer::CanPasteFromClipboard
}\label{wxrichtextbuffercanpastefromclipboard
}
260 \constfunc{bool
}{CanPasteFromClipboard
}{\void}
262 Returns
\true if content can be pasted from the clipboard.
264 \membersection{wxRichTextBuffer::CleanUpHandlers
}\label{wxrichtextbuffercleanuphandlers
}
266 \func{void
}{CleanUpHandlers
}{\void}
268 Cleans up the file handlers.
270 \membersection{wxRichTextBuffer::Clear
}\label{wxrichtextbufferclear
}
272 \func{void
}{Clear
}{\void}
276 \membersection{wxRichTextBuffer::ClearListStyle
}\label{wxrichtextbufferclearliststyle
}
278 \func{bool
}{ClearListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
280 \func{bool
}{ClearListStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
282 Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
284 {\it flags
} is a bit list of the following:
286 \begin{itemize
}\itemsep=
0pt
287 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
290 See also
\helpref{wxRichTextBuffer::SetListStyle
}{wxrichtextbuffersetliststyle
},
\helpref{wxRichTextBuffer::PromoteList
}{wxrichtextbufferpromotelist
},
\helpref{wxRichTextBuffer::NumberList
}{wxrichtextbuffernumberlist
}.
292 \membersection{wxRichTextBuffer::ClearStyleStack
}\label{wxrichtextbufferclearstylestack
}
294 \func{void
}{ClearStyleStack
}{\void}
296 Clears the style stack.
298 \membersection{wxRichTextBuffer::Clone
}\label{wxrichtextbufferclone
}
300 \constfunc{wxRichTextObject*
}{Clone
}{\void}
304 \membersection{wxRichTextBuffer::Copy
}\label{wxrichtextbuffercopy
}
306 \func{void
}{Copy
}{\param{const wxRichTextBuffer\&
}{obj
}}
308 Copies the given buffer.
310 \membersection{wxRichTextBuffer::CopyToClipboard
}\label{wxrichtextbuffercopytoclipboard
}
312 \func{bool
}{CopyToClipboard
}{\param{const wxRichTextRange\&
}{range
}}
314 Copy the given range to the clipboard.
316 \membersection{wxRichTextBuffer::DeleteRangeWithUndo
}\label{wxrichtextbufferdeleterangewithundo
}
318 \func{bool
}{DeleteRangeWithUndo
}{\param{const wxRichTextRange\&
}{range
},
\param{wxRichTextCtrl*
}{ctrl
}}
320 Submits a command to delete the given range.
322 \membersection{wxRichTextBuffer::Dump
}\label{wxrichtextbufferdump
}
324 \func{void
}{Dump
}{\void}
326 \func{void
}{Dump
}{\param{wxTextOutputStream\&
}{stream
}}
328 Dumps the contents of the buffer for debugging purposes.
330 \membersection{wxRichTextBuffer::EndAlignment
}\label{wxrichtextbufferendalignment
}
332 \func{bool
}{EndAlignment
}{\void}
336 \membersection{wxRichTextBuffer::EndAllStyles
}\label{wxrichtextbufferendallstyles
}
338 \func{bool
}{EndAllStyles
}{\void}
340 Ends all styles that have been started with a Begin... command.
342 \membersection{wxRichTextBuffer::EndBatchUndo
}\label{wxrichtextbufferendbatchundo
}
344 \func{bool
}{EndBatchUndo
}{\void}
346 Ends collapsing undo/redo commands, and submits the combined command.
348 \membersection{wxRichTextBuffer::EndBold
}\label{wxrichtextbufferendbold
}
350 \func{bool
}{EndBold
}{\void}
354 \membersection{wxRichTextBuffer::EndCharacterStyle
}\label{wxrichtextbufferendcharacterstyle
}
356 \func{bool
}{EndCharacterStyle
}{\void}
358 Ends using the named character style.
360 \membersection{wxRichTextBuffer::EndFont
}\label{wxrichtextbufferendfont
}
362 \func{bool
}{EndFont
}{\void}
366 \membersection{wxRichTextBuffer::EndFontSize
}\label{wxrichtextbufferendfontsize
}
368 \func{bool
}{EndFontSize
}{\void}
370 Ends using a point size.
372 \membersection{wxRichTextBuffer::EndItalic
}\label{wxrichtextbufferenditalic
}
374 \func{bool
}{EndItalic
}{\void}
378 \membersection{wxRichTextBuffer::EndLeftIndent
}\label{wxrichtextbufferendleftindent
}
380 \func{bool
}{EndLeftIndent
}{\void}
382 Ends using a left indent.
384 \membersection{wxRichTextBuffer::EndLineSpacing
}\label{wxrichtextbufferendlinespacing
}
386 \func{bool
}{EndLineSpacing
}{\void}
388 Ends using a line spacing.
390 \membersection{wxRichTextBuffer::EndListStyle
}\label{wxrichtextbufferendliststyle
}
392 \func{bool
}{EndListStyle
}{\void}
394 Ends using a specified list style.
396 \membersection{wxRichTextBuffer::EndNumberedBullet
}\label{wxrichtextbufferendnumberedbullet
}
398 \func{bool
}{EndNumberedBullet
}{\void}
400 Ends a numbered bullet.
402 \membersection{wxRichTextBuffer::EndParagraphSpacing
}\label{wxrichtextbufferendparagraphspacing
}
404 \func{bool
}{EndParagraphSpacing
}{\void}
406 Ends paragraph spacing.
408 \membersection{wxRichTextBuffer::EndParagraphStyle
}\label{wxrichtextbufferendparagraphstyle
}
410 \func{bool
}{EndParagraphStyle
}{\void}
412 Ends applying a named character style.
414 \membersection{wxRichTextBuffer::EndRightIndent
}\label{wxrichtextbufferendrightindent
}
416 \func{bool
}{EndRightIndent
}{\void}
418 Ends using a right indent.
420 \membersection{wxRichTextBuffer::EndStyle
}\label{wxrichtextbufferendstyle
}
422 \func{bool
}{EndStyle
}{\void}
424 Ends the current style.
426 \membersection{wxRichTextBuffer::EndSuppressUndo
}\label{wxrichtextbufferendsuppressundo
}
428 \func{bool
}{EndSuppressUndo
}{\void}
430 Ends suppressing undo/redo commands.
432 \membersection{wxRichTextBuffer::EndSymbolBullet
}\label{wxrichtextbufferendsymbolbullet
}
434 \func{bool
}{EndSymbolBullet
}{\void}
436 Ends using a symbol bullet.
438 \membersection{wxRichTextBuffer::EndStandardBullet
}\label{wxrichtextbufferendstandardbullet
}
440 \func{bool
}{EndStandardBullet
}{\void}
442 Ends using a standard bullet.
444 \membersection{wxRichTextBuffer::EndTextColour
}\label{wxrichtextbufferendtextcolour
}
446 \func{bool
}{EndTextColour
}{\void}
448 Ends using a text foreground colour.
450 \membersection{wxRichTextBuffer::EndUnderline
}\label{wxrichtextbufferendunderline
}
452 \func{bool
}{EndUnderline
}{\void}
454 Ends using underline.
456 \membersection{wxRichTextBuffer::EndURL
}\label{wxrichtextbufferendurl
}
458 \func{bool
}{EndURL
}{\void}
462 \membersection{wxRichTextBuffer::FindHandler
}\label{wxrichtextbufferfindhandler
}
464 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{int
}{imageType
}}
466 Finds a handler by type.
468 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{int
}{imageType
}}
470 Finds a handler by extension and type.
472 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
474 Finds a handler by name.
476 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType
}\label{wxrichtextbufferfindhandlerfilenameortype
}
478 \func{wxRichTextFileHandler*
}{FindHandlerFilenameOrType
}{\param{const wxString\&
}{filename
},
\param{int
}{imageType
}}
480 Finds a handler by filename or, if supplied, type.
482 \membersection{wxRichTextBuffer::GetBasicStyle
}\label{wxrichtextbuffergetbasicstyle
}
484 \constfunc{const wxTextAttr\&
}{GetBasicStyle
}{\void}
486 Gets the basic (overall) style. This is the style of the whole
487 buffer before further styles are applied, unlike the default style, which
488 only affects the style currently being applied (for example, setting the default
489 style to bold will cause subsequently inserted text to be bold).
491 \membersection{wxRichTextBuffer::GetBatchedCommand
}\label{wxrichtextbuffergetbatchedcommand
}
493 \constfunc{wxRichTextCommand*
}{GetBatchedCommand
}{\void}
495 Gets the collapsed command.
497 \membersection{wxRichTextBuffer::GetCommandProcessor
}\label{wxrichtextbuffergetcommandprocessor
}
499 \constfunc{wxCommandProcessor*
}{GetCommandProcessor
}{\void}
501 Gets the command processor. A text buffer always creates its own command processor when it is
504 \membersection{wxRichTextBuffer::GetDefaultStyle
}\label{wxrichtextbuffergetdefaultstyle
}
506 \constfunc{const wxTextAttr\&
}{GetDefaultStyle
}{\void}
508 Returns the current default style, affecting the style currently being applied (for example, setting the default
509 style to bold will cause subsequently inserted text to be bold).
511 \membersection{wxRichTextBuffer::GetExtWildcard
}\label{wxrichtextbuffergetextwildcard
}
513 \func{wxString
}{GetExtWildcard
}{\param{bool
}{combine = false
},
\param{bool
}{save = false
},
\param{wxArrayInt*
}{types = NULL
}}
515 Gets a wildcard incorporating all visible handlers. If
{\it types
} is present,
516 it will be filled with the file type corresponding to each filter. This can be
517 used to determine the type to pass to
\helpref{LoadFile
}{wxrichtextbuffergetextwildcard
} given a selected filter.
519 \membersection{wxRichTextBuffer::GetHandlers
}\label{wxrichtextbuffergethandlers
}
521 \func{wxList\&
}{GetHandlers
}{\void}
523 Returns the list of file handlers.
525 \membersection{wxRichTextBuffer::GetRenderer
}\label{wxrichtextbuffergetrenderer
}
527 \func{static wxRichTextRenderer*
}{GetRenderer
}{\void}
529 Returns the object to be used to render certain aspects of the content, such as bullets.
531 \membersection{wxRichTextBuffer::GetStyle
}\label{wxrichtextbuffergetstyle
}
533 \func{bool
}{GetStyle
}{\param{long
}{position
},
\param{wxTextAttr\&
}{style
}}
535 Gets the attributes at the given position.
537 This function gets the combined style - that is, the style you see on the screen as a result
538 of combining base style, paragraph style and character style attributes. To get the character
539 or paragraph style alone, use
\helpref{GetUncombinedStyle
}{wxrichtextbuffergetuncombinedstyle
}.
541 \membersection{wxRichTextBuffer::GetStyleForRange
}\label{wxrichtextbuffergetstyleforrange
}
543 \func{bool
}{GetStyleForRange
}{\param{const wxRichTextRange\&
}{ range
},
\param{wxTextAttr\&
}{style
}}
545 This function gets a style representing the common, combined attributes in the given range.
546 Attributes which have different values within the specified range will not be included the style
549 The function is used to get the attributes to display in the formatting dialog: the user
550 can edit the attributes common to the selection, and optionally specify the values of further
551 attributes to be applied uniformly.
553 To apply the edited attributes, you can use
\helpref{SetStyle
}{wxrichtextbuffersetstyle
} specifying
554 the wxRICHTEXT
\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different
555 from the
{\it combined
} attributes within the range. So, the user edits the effective, displayed attributes
556 for the range, but his choice won't be applied unnecessarily to content. As an example,
557 say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The
558 combined style is bold, and this is what the user will see on-screen and in the formatting
559 dialog. The user now specifies red text, in addition to bold. When applying with
560 SetStyle, the content font weight attributes won't be changed to bold because this is already specified
561 by the paragraph. However the text colour attributes
{\it will
} be changed to
564 \membersection{wxRichTextBuffer::GetStyleSheet
}\label{wxrichtextbuffergetstylesheet
}
566 \constfunc{wxRichTextStyleSheet*
}{GetStyleSheet
}{\void}
568 Returns the current style sheet associated with the buffer, if any.
570 \membersection{wxRichTextBuffer::GetStyleStackSize
}\label{wxrichtextbuffergetstylestacksize
}
572 \constfunc{size
\_t}{GetStyleStackSize
}{\void}
574 Get the size of the style stack, for example to check correct nesting.
576 \membersection{wxRichTextBuffer::GetUncombinedStyle
}\label{wxrichtextbuffergetuncombinedstyle
}
578 \func{bool
}{GetUncombinedStyle
}{\param{long
}{position
},
\param{wxTextAttr\&
}{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 wxTextAttr\&
}{style
}}
750 Sets the basic (overall) style. This is the style of the whole
751 buffer before further styles are applied, unlike the default style, which
752 only affects the style currently being applied (for example, setting the default
753 style to bold will cause subsequently inserted text to be bold).
755 \membersection{wxRichTextBuffer::SetDefaultStyle
}\label{wxrichtextbuffersetdefaultstyle
}
757 \func{void
}{SetDefaultStyle
}{\param{const wxTextAttr\&
}{style
}}
759 Sets the default style, affecting the style currently being applied (for example, setting the default
760 style to bold will cause subsequently inserted text to be bold).
762 This is not cumulative - setting the default style will replace the previous default style.
764 \membersection{wxRichTextBuffer::SetListStyle
}\label{wxrichtextbuffersetliststyle
}
766 \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}}
768 \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}}
770 Sets the list attributes for the given range, passing flags to determine how the attributes are set.
771 Either the style definition or the name of the style definition (in the current sheet) can be passed.
773 {\it flags
} is a bit list of the following:
775 \begin{itemize
}\itemsep=
0pt
776 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
777 \item wxRICHTEXT
\_SETSTYLE\_RENUMBER: specifies that numbering should start from
{\it startFrom
}, otherwise existing attributes are used.
778 \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.
781 See also
\helpref{wxRichTextBuffer::NumberList
}{wxrichtextbuffernumberlist
},
\helpref{wxRichTextBuffer::PromoteList
}{wxrichtextbufferpromotelist
},
\helpref{wxRichTextBuffer::ClearListStyle
}{wxrichtextbufferclearliststyle
}.
783 \membersection{wxRichTextBuffer::SetRenderer
}\label{wxrichtextbuffersetrenderer
}
785 \func{static void
}{SetRenderer
}{\param{wxRichTextRenderer*
}{renderer
}}
787 Sets
{\it renderer
} as the object to be used to render certain aspects of the content, such as bullets.
788 You can override default rendering by deriving a new class from wxRichTextRenderer or wxRichTextStdRenderer,
789 overriding one or more virtual functions, and setting an instance of the class using this function.
791 \membersection{wxRichTextBuffer::SetStyle
}\label{wxrichtextbuffersetstyle
}
793 \func{bool
}{SetStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxTextAttr\&
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
795 Sets the attributes for the given range. Pass flags to determine how the attributes are set.
797 The end point of range is specified as the last character position of the span of text.
798 So, for example, to set the style for a character at position
5, use the range (
5,
5).
799 This differs from the wxRichTextCtrl API, where you would specify (
5,
6).
801 {\it flags
} may contain a bit list of the following values:
803 \begin{itemize
}\itemsep=
0pt
804 \item wxRICHTEXT
\_SETSTYLE\_NONE: no style flag.
805 \item wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO: specifies that this operation should be undoable.
806 \item wxRICHTEXT
\_SETSTYLE\_OPTIMIZE: specifies that the style should not be applied if the
807 combined style at this point is already the style in question.
808 \item wxRICHTEXT
\_SETSTYLE\_PARAGRAPHS\_ONLY: specifies that the style should only be applied to paragraphs,
809 and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
810 \item wxRICHTEXT
\_SETSTYLE\_CHARACTERS\_ONLY: specifies that the style should only be applied to characters,
811 and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
812 \item wxRICHTEXT
\_SETSTYLE\_RESET: resets (clears) the existing style before applying the new style.
813 \item wxRICHTEXT
\_SETSTYLE\_REMOVE: removes the specified style. Only the style flags are used in this operation.
816 \membersection{wxRichTextBuffer::SetStyleSheet
}\label{wxrichtextbuffersetstylesheet
}
818 \func{void
}{SetStyleSheet
}{\param{wxRichTextStyleSheet*
}{styleSheet
}}
820 Sets the current style sheet, if any. This will allow the application to use
821 named character and paragraph styles found in the style sheet.
823 \membersection{wxRichTextBuffer::SubmitAction
}\label{wxrichtextbuffersubmitaction
}
825 \func{bool
}{SubmitAction
}{\param{wxRichTextAction*
}{action
}}
827 Submit an action immediately, or delay it according to whether collapsing is on.
829 \membersection{wxRichTextBuffer::SuppressingUndo
}\label{wxrichtextbuffersuppressingundo
}
831 \constfunc{bool
}{SuppressingUndo
}{\void}
833 Returns
\true if undo suppression is currently on.