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
0x0000
164 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC
0x0001
165 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER
0x0002
166 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER
0x0004
167 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER
0x0008
168 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER
0x0010
169 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL
0x0020
170 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP
0x0040
171 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES
0x0080
172 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD
0x0100
176 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
177 the margin and the bullet. The content of the paragraph, including the first line, starts
178 at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
179 left of the actual paragraph is leftSubIndent.
181 \membersection{wxRichTextBuffer::BeginParagraphSpacing
}\label{wxrichtextbufferbeginparagraphspacing
}
183 \func{bool
}{BeginParagraphSpacing
}{\param{int
}{before
},
\param{int
}{after
}}
185 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
188 \membersection{wxRichTextBuffer::BeginParagraphStyle
}\label{wxrichtextbufferbeginparagraphstyle
}
190 \func{bool
}{BeginParagraphStyle
}{\param{const wxString\&
}{paragraphStyle
}}
192 Begins applying the named paragraph style.
194 \membersection{wxRichTextBuffer::BeginRightIndent
}\label{wxrichtextbufferbeginrightindent
}
196 \func{bool
}{BeginRightIndent
}{\param{int
}{rightIndent
}}
198 Begins a right indent, specified in tenths of a millimetre.
200 \membersection{wxRichTextBuffer::BeginStyle
}\label{wxrichtextbufferbeginstyle
}
202 \func{bool
}{BeginStyle
}{\param{const wxTextAttrEx\&
}{style
}}
204 Begins using a specified style.
206 \membersection{wxRichTextBuffer::BeginSuppressUndo
}\label{wxrichtextbufferbeginsuppressundo
}
208 \func{bool
}{BeginSuppressUndo
}{\void}
210 Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
211 differently by each command. If not dealt with by a command implementation, then
212 it will be implemented automatically by not storing the command in the undo history
213 when the action is submitted to the command processor.
215 \membersection{wxRichTextBuffer::BeginStandardBullet
}\label{wxrichtextbufferbeginstandardbullet
}
217 \func{bool
}{BeginStandardBullet
}{\param{const wxString\&
}{ bulletName
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_STANDARD}}
219 Begins applying a standard bullet, using one of the standard bullet names (currently
{\tt standard/circle
} or
{\tt standard/square
}.
220 See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for an explanation of how indentation is used to render the bulleted paragraph.
222 \membersection{wxRichTextBuffer::BeginSymbolBullet
}\label{wxrichtextbufferbeginsymbolbullet
}
224 \func{bool
}{BeginSymbolBullet
}{\param{wxChar
}{symbol
},
\param{int
}{leftIndent
},
\param{int
}{leftSubIndent
},
\param{int
}{bulletStyle = wxTEXT
\_ATTR\_BULLET\_STYLE\_SYMBOL}}
226 Begins applying a symbol bullet, using a character from the current font. See
\helpref{BeginNumberedBullet
}{wxrichtextbufferbeginnumberedbullet
} for
227 an explanation of how indentation is used to render the bulleted paragraph.
229 \membersection{wxRichTextBuffer::BeginTextColour
}\label{wxrichtextbufferbegintextcolour
}
231 \func{bool
}{BeginTextColour
}{\param{const wxColour\&
}{colour
}}
233 Begins using the specified text foreground colour.
235 \membersection{wxRichTextBuffer::BeginUnderline
}\label{wxrichtextbufferbeginunderline
}
237 \func{bool
}{BeginUnderline
}{\void}
239 Begins using underline.
241 \membersection{wxRichTextBuffer::BeginURL
}\label{wxrichtextbufferbeginurl
}
243 \func{bool
}{BeginURL
}{\param{const wxString\&
}{ url
},
\param{const wxString\&
}{ characterStyle = wxEmptyString
}}
245 Begins applying wxTEXT
\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
246 since it is common to mark a URL with a familiar style such as blue text with underlining.
248 \membersection{wxRichTextBuffer::CanPasteFromClipboard
}\label{wxrichtextbuffercanpastefromclipboard
}
250 \constfunc{bool
}{CanPasteFromClipboard
}{\void}
252 Returns
\true if content can be pasted from the clipboard.
254 \membersection{wxRichTextBuffer::CleanUpHandlers
}\label{wxrichtextbuffercleanuphandlers
}
256 \func{void
}{CleanUpHandlers
}{\void}
258 Cleans up the file handlers.
260 \membersection{wxRichTextBuffer::Clear
}\label{wxrichtextbufferclear
}
262 \func{void
}{Clear
}{\void}
264 Clears the buffer and resets the command processor.
266 \membersection{wxRichTextBuffer::ClearStyleStack
}\label{wxrichtextbufferclearstylestack
}
268 \func{void
}{ClearStyleStack
}{\void}
270 Clears the style stack.
272 \membersection{wxRichTextBuffer::Clone
}\label{wxrichtextbufferclone
}
274 \constfunc{wxRichTextObject*
}{Clone
}{\void}
278 \membersection{wxRichTextBuffer::Copy
}\label{wxrichtextbuffercopy
}
280 \func{void
}{Copy
}{\param{const wxRichTextBuffer\&
}{obj
}}
282 Copies the given buffer.
284 \membersection{wxRichTextBuffer::CopyToClipboard
}\label{wxrichtextbuffercopytoclipboard
}
286 \func{bool
}{CopyToClipboard
}{\param{const wxRichTextRange\&
}{range
}}
288 Copy the given range to the clipboard.
290 \membersection{wxRichTextBuffer::DeleteRangeWithUndo
}\label{wxrichtextbufferdeleterangewithundo
}
292 \func{bool
}{DeleteRangeWithUndo
}{\param{const wxRichTextRange\&
}{range
},
\param{long
}{initialCaretPosition
},
\param{long
}{newCaretPositon
},
\param{wxRichTextCtrl*
}{ctrl
}}
294 Submits a command to delete the given range.
296 \membersection{wxRichTextBuffer::Dump
}\label{wxrichtextbufferdump
}
298 \func{void
}{Dump
}{\void}
300 \func{void
}{Dump
}{\param{wxTextOutputStream\&
}{stream
}}
302 Dumps the contents of the buffer for debugging purposes.
304 \membersection{wxRichTextBuffer::EndAlignment
}\label{wxrichtextbufferendalignment
}
306 \func{bool
}{EndAlignment
}{\void}
310 \membersection{wxRichTextBuffer::EndAllStyles
}\label{wxrichtextbufferendallstyles
}
312 \func{bool
}{EndAllStyles
}{\void}
314 Ends all styles that have been started with a Begin... command.
316 \membersection{wxRichTextBuffer::EndBatchUndo
}\label{wxrichtextbufferendbatchundo
}
318 \func{bool
}{EndBatchUndo
}{\void}
320 Ends collapsing undo/redo commands, and submits the combined command.
322 \membersection{wxRichTextBuffer::EndBold
}\label{wxrichtextbufferendbold
}
324 \func{bool
}{EndBold
}{\void}
328 \membersection{wxRichTextBuffer::EndCharacterStyle
}\label{wxrichtextbufferendcharacterstyle
}
330 \func{bool
}{EndCharacterStyle
}{\void}
332 Ends using the named character style.
334 \membersection{wxRichTextBuffer::EndFont
}\label{wxrichtextbufferendfont
}
336 \func{bool
}{EndFont
}{\void}
340 \membersection{wxRichTextBuffer::EndFontSize
}\label{wxrichtextbufferendfontsize
}
342 \func{bool
}{EndFontSize
}{\void}
344 Ends using a point size.
346 \membersection{wxRichTextBuffer::EndItalic
}\label{wxrichtextbufferenditalic
}
348 \func{bool
}{EndItalic
}{\void}
352 \membersection{wxRichTextBuffer::EndLeftIndent
}\label{wxrichtextbufferendleftindent
}
354 \func{bool
}{EndLeftIndent
}{\void}
356 Ends using a left indent.
358 \membersection{wxRichTextBuffer::EndLineSpacing
}\label{wxrichtextbufferendlinespacing
}
360 \func{bool
}{EndLineSpacing
}{\void}
362 Ends using a line spacing.
364 \membersection{wxRichTextBuffer::EndListStyle
}\label{wxrichtextbufferendliststyle
}
366 \func{bool
}{EndListStyle
}{\void}
368 Ends using a specified list style.
370 \membersection{wxRichTextBuffer::EndNumberedBullet
}\label{wxrichtextbufferendnumberedbullet
}
372 \func{bool
}{EndNumberedBullet
}{\void}
374 Ends a numbered bullet.
376 \membersection{wxRichTextBuffer::EndParagraphSpacing
}\label{wxrichtextbufferendparagraphspacing
}
378 \func{bool
}{EndParagraphSpacing
}{\void}
380 Ends paragraph spacing.
382 \membersection{wxRichTextBuffer::EndParagraphStyle
}\label{wxrichtextbufferendparagraphstyle
}
384 \func{bool
}{EndParagraphStyle
}{\void}
386 Ends applying a named character style.
388 \membersection{wxRichTextBuffer::EndRightIndent
}\label{wxrichtextbufferendrightindent
}
390 \func{bool
}{EndRightIndent
}{\void}
392 Ends using a right indent.
394 \membersection{wxRichTextBuffer::EndStyle
}\label{wxrichtextbufferendstyle
}
396 \func{bool
}{EndStyle
}{\void}
398 Ends the current style.
400 \membersection{wxRichTextBuffer::EndSuppressUndo
}\label{wxrichtextbufferendsuppressundo
}
402 \func{bool
}{EndSuppressUndo
}{\void}
404 Ends suppressing undo/redo commands.
406 \membersection{wxRichTextBuffer::EndSymbolBullet
}\label{wxrichtextbufferendsymbolbullet
}
408 \func{bool
}{EndSymbolBullet
}{\void}
410 Ends using a symbol bullet.
412 \membersection{wxRichTextBuffer::EndStandardBullet
}\label{wxrichtextbufferendstandardbullet
}
414 \func{bool
}{EndStandardBullet
}{\void}
416 Ends using a standard bullet.
418 \membersection{wxRichTextBuffer::EndTextColour
}\label{wxrichtextbufferendtextcolour
}
420 \func{bool
}{EndTextColour
}{\void}
422 Ends using a text foreground colour.
424 \membersection{wxRichTextBuffer::EndUnderline
}\label{wxrichtextbufferendunderline
}
426 \func{bool
}{EndUnderline
}{\void}
428 Ends using underline.
430 \membersection{wxRichTextBuffer::EndURL
}\label{wxrichtextbufferendurl
}
432 \func{bool
}{EndURL
}{\void}
436 \membersection{wxRichTextBuffer::FindHandler
}\label{wxrichtextbufferfindhandler
}
438 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{int
}{imageType
}}
440 Finds a handler by type.
442 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{extension
},
\param{int
}{imageType
}}
444 Finds a handler by extension and type.
446 \func{wxRichTextFileHandler*
}{FindHandler
}{\param{const wxString\&
}{name
}}
448 Finds a handler by name.
450 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType
}\label{wxrichtextbufferfindhandlerfilenameortype
}
452 \func{wxRichTextFileHandler*
}{FindHandlerFilenameOrType
}{\param{const wxString\&
}{filename
},
\param{int
}{imageType
}}
454 Finds a handler by filename or, if supplied, type.
456 \membersection{wxRichTextBuffer::GetBasicStyle
}\label{wxrichtextbuffergetbasicstyle
}
458 \constfunc{const wxTextAttrEx\&
}{GetBasicStyle
}{\void}
460 Gets the basic (overall) style. This is the style of the whole
461 buffer before further styles are applied, unlike the default style, which
462 only affects the style currently being applied (for example, setting the default
463 style to bold will cause subsequently inserted text to be bold).
465 \membersection{wxRichTextBuffer::GetBatchedCommand
}\label{wxrichtextbuffergetbatchedcommand
}
467 \constfunc{wxRichTextCommand*
}{GetBatchedCommand
}{\void}
469 Gets the collapsed command.
471 \membersection{wxRichTextBuffer::GetCommandProcessor
}\label{wxrichtextbuffergetcommandprocessor
}
473 \constfunc{wxCommandProcessor*
}{GetCommandProcessor
}{\void}
475 Gets the command processor. A text buffer always creates its own command processor when it is
478 \membersection{wxRichTextBuffer::GetDefaultStyle
}\label{wxrichtextbuffergetdefaultstyle
}
480 \constfunc{const wxTextAttrEx\&
}{GetDefaultStyle
}{\void}
482 Returns the current default style, affecting the style currently being applied (for example, setting the default
483 style to bold will cause subsequently inserted text to be bold).
485 \membersection{wxRichTextBuffer::GetExtWildcard
}\label{wxrichtextbuffergetextwildcard
}
487 \func{wxString
}{GetExtWildcard
}{\param{bool
}{combine = false
},
\param{bool
}{save = false
},
\param{wxArrayInt*
}{types = NULL
}}
489 Gets a wildcard incorporating all visible handlers. If
{\it types
} is present,
490 it will be filled with the file type corresponding to each filter. This can be
491 used to determine the type to pass to
\helpref{LoadFile
}{wxrichtextbuffergetextwildcard
} given a selected filter.
493 \membersection{wxRichTextBuffer::GetHandlers
}\label{wxrichtextbuffergethandlers
}
495 \func{wxList\&
}{GetHandlers
}{\void}
497 Returns the list of file handlers.
499 \membersection{wxRichTextBuffer::GetRenderer
}\label{wxrichtextbuffergetrenderer
}
501 \func{static wxRichTextRenderer*
}{GetRenderer
}{\void}
503 Returns the object to be used to render certain aspects of the content, such as bullets.
505 \membersection{wxRichTextBuffer::GetStyle
}\label{wxrichtextbuffergetstyle
}
507 \func{bool
}{GetStyle
}{\param{long
}{position
},
\param{wxRichTextAttr\&
}{style
}}
509 \func{bool
}{GetStyle
}{\param{long
}{position
},
\param{wxTextAttrEx\&
}{style
}}
511 Gets the attributes at the given position.
513 This function gets the combined style - that is, the style you see on the screen as a result
514 of combining base style, paragraph style and character style attributes. To get the character
515 or paragraph style alone, use
\helpref{GetUncombinedStyle
}{wxrichtextbuffergetuncombinedstyle
}.
517 \membersection{wxRichTextBuffer::GetStyleForRange
}\label{wxrichtextbuffergetstyleforrange
}
519 \func{bool
}{GetStyleForRange
}{\param{const wxRichTextRange\&
}{ range
},
\param{wxTextAttrEx\&
}{style
}}
521 This function gets a style representing the common, combined attributes in the given range.
522 Attributes which have different values within the specified range will not be included the style
525 The function is used to get the attributes to display in the formatting dialog: the user
526 can edit the attributes common to the selection, and optionally specify the values of further
527 attributes to be applied uniformly.
529 To apply the edited attributes, you can use
\helpref{SetStyle
}{wxrichtextbuffersetstyle
} specifying
530 the wxRICHTEXT
\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different
531 from the
{\it combined
} attributes within the range. So, the user edits the effective, displayed attributes
532 for the range, but his choice won't be applied unnecessarily to content. As an example,
533 say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The
534 combined style is bold, and this is what the user will see on-screen and in the formatting
535 dialog. The user now specifies red text, in addition to bold. When applying with
536 SetStyle, the content font weight attributes won't be changed to bold because this is already specified
537 by the paragraph. However the text colour attributes
{\it will
} be changed to
540 \membersection{wxRichTextBuffer::GetStyleSheet
}\label{wxrichtextbuffergetstylesheet
}
542 \constfunc{wxRichTextStyleSheet*
}{GetStyleSheet
}{\void}
544 Returns the current style sheet associated with the buffer, if any.
546 \membersection{wxRichTextBuffer::GetStyleStackSize
}\label{wxrichtextbuffergetstylestacksize
}
548 \constfunc{size
\_t}{GetStyleStackSize
}{\void}
550 Get the size of the style stack, for example to check correct nesting.
552 \membersection{wxRichTextBuffer::GetUncombinedStyle
}\label{wxrichtextbuffergetuncombinedstyle
}
554 \func{bool
}{GetUncombinedStyle
}{\param{long
}{position
},
\param{wxRichTextAttr\&
}{style
}}
556 \func{bool
}{GetUncombinedStyle
}{\param{long
}{position
},
\param{wxTextAttrEx\&
}{style
}}
558 Gets the attributes at the given position.
560 This function gets the
{\it uncombined style
} - that is, the attributes associated with the
561 paragraph or character content, and not necessarily the combined attributes you see on the
562 screen. To get the combined attributes, use
\helpref{GetStyle
}{wxrichtextbuffergetstyle
}.
564 If you specify (any) paragraph attribute in
{\it style
}'s flags, this function will fetch
565 the paragraph attributes. Otherwise, it will return the character attributes.
567 \membersection{wxRichTextBuffer::HitTest
}\label{wxrichtextbufferhittest
}
569 \func{int
}{HitTest
}{\param{wxDC\&
}{dc
},
\param{const wxPoint\&
}{pt
},
\param{long\&
}{textPosition
}}
571 Finds the text position for the given position, putting the position in
{\it textPosition
} if
572 one is found.
{\it pt
} is in logical units (a zero y position is
573 at the beginning of the buffer).
575 The function returns one of the following values:
579 // The point was not on this object
580 #define wxRICHTEXT_HITTEST_NONE
0x01
581 // The point was before the position returned from HitTest
582 #define wxRICHTEXT_HITTEST_BEFORE
0x02
583 // The point was after the position returned from HitTest
584 #define wxRICHTEXT_HITTEST_AFTER
0x04
585 // The point was on the position returned from HitTest
586 #define wxRICHTEXT_HITTEST_ON
0x08
590 \membersection{wxRichTextBuffer::Init
}\label{wxrichtextbufferinit
}
592 \func{void
}{Init
}{\void}
596 \membersection{wxRichTextBuffer::InitStandardHandlers
}\label{wxrichtextbufferinitstandardhandlers
}
598 \func{void
}{InitStandardHandlers
}{\void}
600 Initialises the standard handlers. Currently, only the plain text loading/saving handler
601 is initialised by default.
603 \membersection{wxRichTextBuffer::InsertHandler
}\label{wxrichtextbufferinserthandler
}
605 \func{void
}{InsertHandler
}{\param{wxRichTextFileHandler*
}{handler
}}
607 Inserts a handler at the front of the list.
609 \membersection{wxRichTextBuffer::InsertImageWithUndo
}\label{wxrichtextbufferinsertimagewithundo
}
611 \func{bool
}{InsertImageWithUndo
}{\param{long
}{pos
},
\param{const wxRichTextImageBlock\&
}{imageBlock
},
\param{wxRichTextCtrl*
}{ctrl
}}
613 Submits a command to insert the given image.
615 \membersection{wxRichTextBuffer::InsertNewlineWithUndo
}\label{wxrichtextbufferinsertnewlinewithundo
}
617 \func{bool
}{InsertNewlineWithUndo
}{\param{long
}{pos
},
\param{wxRichTextCtrl*
}{ctrl
}}
619 Submits a command to insert a newline.
621 \membersection{wxRichTextBuffer::InsertTextWithUndo
}\label{wxrichtextbufferinserttextwithundo
}
623 \func{bool
}{InsertTextWithUndo
}{\param{long
}{pos
},
\param{const wxString\&
}{text
},
\param{wxRichTextCtrl*
}{ctrl
}}
625 Submits a command to insert the given text.
627 \membersection{wxRichTextBuffer::IsModified
}\label{wxrichtextbufferismodified
}
629 \constfunc{bool
}{IsModified
}{\void}
631 Returns
\true if the buffer has been modified.
633 \membersection{wxRichTextBuffer::LoadFile
}\label{wxrichtextbufferloadfile
}
635 \func{bool
}{LoadFile
}{\param{wxInputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
637 Loads content from a stream.
639 \func{bool
}{LoadFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
641 Loads content from a file.
643 \membersection{wxRichTextBuffer::Modify
}\label{wxrichtextbuffermodify
}
645 \func{void
}{Modify
}{\param{bool
}{modify = true
}}
647 Marks the buffer as modified or unmodified.
649 \membersection{wxRichTextBuffer::PasteFromClipboard
}\label{wxrichtextbufferpastefromclipboard
}
651 \func{bool
}{PasteFromClipboard
}{\param{long
}{position
}}
653 Pastes the clipboard content to the buffer at the given position.
655 \membersection{wxRichTextBuffer::RemoveEventHandler
}\label{wxrichtextbufferremoveeventhandler
}
657 \func{bool
}{RemoveEventHandler
}{\param{wxEvtHandler*
}{handler
},
\param{bool
}{ deleteHandler = false
}}
659 Removes an event handler from the buffer's list of handlers, deleting the object if
{\it deleteHandler
} is
\true.
661 \membersection{wxRichTextBuffer::RemoveHandler
}\label{wxrichtextbufferremovehandler
}
663 \func{bool
}{RemoveHandler
}{\param{const wxString\&
}{name
}}
667 \membersection{wxRichTextBuffer::Reset
}\label{wxrichtextbufferreset
}
669 \func{void
}{Reset
}{\void}
671 The same as
\helpref{Clear
}{wxrichtextbufferclear
}, plus an empty paragraph is added.
673 \membersection{wxRichTextBuffer::SaveFile
}\label{wxrichtextbuffersavefile
}
675 \func{bool
}{SaveFile
}{\param{wxOutputStream\&
}{stream
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
677 Saves content to a stream.
679 \func{bool
}{SaveFile
}{\param{const wxString\&
}{filename
},
\param{int
}{type = wxRICHTEXT
\_TYPE\_ANY}}
681 Saves content to a file.
683 \membersection{wxRichTextBuffer::SetBasicStyle
}\label{wxrichtextbuffersetbasicstyle
}
685 \func{void
}{SetBasicStyle
}{\param{const wxRichTextAttr\&
}{style
}}
687 \func{void
}{SetBasicStyle
}{\param{const wxTextAttrEx\&
}{style
}}
689 Sets the basic (overall) style. This is the style of the whole
690 buffer before further styles are applied, unlike the default style, which
691 only affects the style currently being applied (for example, setting the default
692 style to bold will cause subsequently inserted text to be bold).
694 \membersection{wxRichTextBuffer::SetDefaultStyle
}\label{wxrichtextbuffersetdefaultstyle
}
696 \func{void
}{SetDefaultStyle
}{\param{const wxTextAttrEx\&
}{style
}}
698 Sets the default style, affecting the style currently being applied (for example, setting the default
699 style to bold will cause subsequently inserted text to be bold).
701 This is not cumulative - setting the default style will replace the previous default style.
703 \membersection{wxRichTextBuffer::SetRenderer
}\label{wxrichtextbuffersetrenderer
}
705 \func{static void
}{SetRenderer
}{\param{wxRichTextRenderer*
}{renderer
}}
707 Sets
{\it renderer
} as the object to be used to render certain aspects of the content, such as bullets.
708 You can override default rendering by deriving a new class from wxRichTextRenderer or wxRichTextStdRenderer,
709 overriding one or more virtual functions, and setting an instance of the class using this function.
711 \membersection{wxRichTextBuffer::SetStyle
}\label{wxrichtextbuffersetstyle
}
713 \func{bool
}{SetStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxRichTextAttr\&
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
715 \func{bool
}{SetStyle
}{\param{const wxRichTextRange\&
}{range
},
\param{const wxTextAttrEx\&
}{style
},
\param{int
}{flags $=$ wxRICHTEXT
\_SETSTYLE\_WITH\_UNDO}}
717 Sets the attributes for the given range, passing flags to determine how the attributes are set.
719 The end point of range is specified as the last character position of the span of text.
720 So, for example, to set the style for a character at position
5, use the range (
5,
5).
721 This differs from the wxRichTextCtrl API, where you would specify (
5,
6).
723 {\it flags
} may contain a bit list of the following values:
726 #define wxRICHTEXT_SETSTYLE_NONE
0x00
728 // Specifies that this operation should be undoable
729 #define wxRICHTEXT_SETSTYLE_WITH_UNDO
0x01
731 // Specifies that the style should not be applied if the
732 // combined style at this point is already the style in question.
733 #define wxRICHTEXT_SETSTYLE_OPTIMIZE
0x02
735 // Specifies that the style should only be applied to paragraphs,
736 // and not the content. This allows content styling to be
737 // preserved independently from that of e.g. a named paragraph style.
738 #define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY
0x04
740 // Specifies that the style should only be applied to characters,
741 // and not the paragraph. This allows content styling to be
742 // preserved independently from that of e.g. a named paragraph style.
743 #define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY
0x08
746 \membersection{wxRichTextBuffer::SetStyleSheet
}\label{wxrichtextbuffersetstylesheet
}
748 \func{void
}{SetStyleSheet
}{\param{wxRichTextStyleSheet*
}{styleSheet
}}
750 Sets the current style sheet, if any. This will allow the application to use
751 named character and paragraph styles found in the style sheet.
753 \membersection{wxRichTextBuffer::SubmitAction
}\label{wxrichtextbuffersubmitaction
}
755 \func{bool
}{SubmitAction
}{\param{wxRichTextAction*
}{action
}}
757 Submit an action immediately, or delay it according to whether collapsing is on.
759 \membersection{wxRichTextBuffer::SuppressingUndo
}\label{wxrichtextbuffersuppressingundo
}
761 \constfunc{bool
}{SuppressingUndo
}{\void}
763 Returns
\true if undo suppression is currently on.