]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/richtextbuffer.tex
Always draw the selection of selected items, not just when they have
[wxWidgets.git] / docs / latex / wx / richtextbuffer.tex
1 \section{\class{wxRichTextBuffer}}\label{wxrichtextbuffer}
2
3 This class represents the whole buffer associated with a \helpref{wxRichTextCtrl}{wxrichtextctrl}.
4
5 \wxheading{Derived from}
6
7 wxRichTextParagraphLayoutBox
8
9 \wxheading{Include files}
10
11 <wx/richtext/richtextbuffer.h>
12
13 \wxheading{Data structures}
14
15 \wxheading{See also}
16
17 \helpref{wxTextAttr}{wxtextattr}, \helpref{wxTextAttrEx}{wxtextattrex}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
18
19 \latexignore{\rtfignore{\wxheading{Members}}}
20
21 \membersection{wxRichTextBuffer::wxRichTextBuffer}\label{wxrichtextbufferwxrichtextbuffer}
22
23 \func{}{wxRichTextBuffer}{\param{const wxRichTextBuffer\& }{obj}}
24
25 Copy constructor.
26
27 \func{}{wxRichTextBuffer}{\void}
28
29 Default constructors.
30
31 \membersection{wxRichTextBuffer::\destruct{wxRichTextBuffer}}\label{wxrichtextbufferdtor}
32
33 \func{}{\destruct{wxRichTextBuffer}}{\void}
34
35 Destructor.
36
37 \membersection{wxRichTextBuffer::AddEventHandler}\label{wxrichtextbufferaddeventhandler}
38
39 \func{bool}{AddEventHandler}{\param{wxEvtHandler* }{handler}}
40
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.
48
49 \membersection{wxRichTextBuffer::AddHandler}\label{wxrichtextbufferaddhandler}
50
51 \func{void}{AddHandler}{\param{wxRichTextFileHandler* }{handler}}
52
53 Adds a file handler.
54
55 \membersection{wxRichTextBuffer::AddParagraph}\label{wxrichtextbufferaddparagraph}
56
57 \func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}
58
59 Adds a paragraph of text.
60
61 \membersection{wxRichTextBuffer::BatchingUndo}\label{wxrichtextbufferbatchingundo}
62
63 \constfunc{bool}{BatchingUndo}{\void}
64
65 Returns \true if the buffer is currently collapsing commands into a single notional command.
66
67 \membersection{wxRichTextBuffer::BeginAlignment}\label{wxrichtextbufferbeginalignment}
68
69 \func{bool}{BeginAlignment}{\param{wxTextAttrAlignment }{alignment}}
70
71 Begins using alignment.
72
73 \membersection{wxRichTextBuffer::BeginBatchUndo}\label{wxrichtextbufferbeginbatchundo}
74
75 \func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}
76
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
79 subsequent actions.
80
81 {\it cmdName} should be the name of the combined command that will appear
82 next to Undo and Redo in the edit menu.
83
84 \membersection{wxRichTextBuffer::BeginBold}\label{wxrichtextbufferbeginbold}
85
86 \func{bool}{BeginBold}{\void}
87
88 Begin applying bold.
89
90 \membersection{wxRichTextBuffer::BeginCharacterStyle}\label{wxrichtextbufferbegincharacterstyle}
91
92 \func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}
93
94 Begins applying the named character style.
95
96 \membersection{wxRichTextBuffer::BeginFont}\label{wxrichtextbufferbeginfont}
97
98 \func{bool}{BeginFont}{\param{const wxFont\& }{font}}
99
100 Begins using this font.
101
102 \membersection{wxRichTextBuffer::BeginFontSize}\label{wxrichtextbufferbeginfontsize}
103
104 \func{bool}{BeginFontSize}{\param{int }{pointSize}}
105
106 Begins using the given point size.
107
108 \membersection{wxRichTextBuffer::BeginItalic}\label{wxrichtextbufferbeginitalic}
109
110 \func{bool}{BeginItalic}{\void}
111
112 Begins using italic.
113
114 \membersection{wxRichTextBuffer::BeginLeftIndent}\label{wxrichtextbufferbeginleftindent}
115
116 \func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}}
117
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.
120
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.
125
126 \membersection{wxRichTextBuffer::BeginLineSpacing}\label{wxrichtextbufferbeginlinespacing}
127
128 \func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}
129
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:
133
134 {\small
135 \begin{verbatim}
136 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
137 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
138 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
139 \end{verbatim}
140 }
141
142 \membersection{wxRichTextBuffer::BeginListStyle}\label{wxrichtextbufferbeginliststyle}
143
144 \func{bool}{BeginListStyle}{\param{const wxString\&}{ listStyle}, \param{int}{ level=1}, \param{int}{ number=1}}
145
146 Begins using a specified list style. Optionally, you can also pass a level and a number.
147
148 \membersection{wxRichTextBuffer::BeginNumberedBullet}\label{wxrichtextbufferbeginnumberedbullet}
149
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}}
151
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.
154
155 {\it bulletNumber} is a number, usually starting with 1.
156
157 {\it leftIndent} and {\it leftSubIndent} are values in tenths of a millimetre.
158
159 {\it bulletStyle} is a bitlist of the following values:
160
161 {\small
162 \begin{verbatim}
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
179 \end{verbatim}
180 }
181
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.
186
187 \membersection{wxRichTextBuffer::BeginParagraphSpacing}\label{wxrichtextbufferbeginparagraphspacing}
188
189 \func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}
190
191 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
192 a millimetre.
193
194 \membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle}
195
196 \func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
197
198 Begins applying the named paragraph style.
199
200 \membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent}
201
202 \func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
203
204 Begins a right indent, specified in tenths of a millimetre.
205
206 \membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle}
207
208 \func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}
209
210 Begins using a specified style.
211
212 \membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo}
213
214 \func{bool}{BeginSuppressUndo}{\void}
215
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.
220
221 \membersection{wxRichTextBuffer::BeginStandardBullet}\label{wxrichtextbufferbeginstandardbullet}
222
223 \func{bool}{BeginStandardBullet}{\param{const wxString\&}{ bulletName}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD}}
224
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.
227
228 \membersection{wxRichTextBuffer::BeginSymbolBullet}\label{wxrichtextbufferbeginsymbolbullet}
229
230 \func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}
231
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.
234
235 \membersection{wxRichTextBuffer::BeginTextColour}\label{wxrichtextbufferbegintextcolour}
236
237 \func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}
238
239 Begins using the specified text foreground colour.
240
241 \membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline}
242
243 \func{bool}{BeginUnderline}{\void}
244
245 Begins using underline.
246
247 \membersection{wxRichTextBuffer::BeginURL}\label{wxrichtextbufferbeginurl}
248
249 \func{bool}{BeginURL}{\param{const wxString\&}{ url}, \param{const wxString\&}{ characterStyle = wxEmptyString}}
250
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.
253
254 \membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard}
255
256 \constfunc{bool}{CanPasteFromClipboard}{\void}
257
258 Returns \true if content can be pasted from the clipboard.
259
260 \membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers}
261
262 \func{void}{CleanUpHandlers}{\void}
263
264 Cleans up the file handlers.
265
266 \membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear}
267
268 \func{void}{Clear}{\void}
269
270 Clears the buffer.
271
272 \membersection{wxRichTextBuffer::ClearListStyle}\label{wxrichtextbufferclearliststyle}
273
274 \func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
275
276 \func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
277
278 Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
279
280 {\it flags} is a bit list of the following:
281
282 \begin{itemize}\itemsep=0pt
283 \item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
284 \end{itemize}
285
286 See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::NumberList}{wxrichtextbuffernumberlist}.
287
288 \membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack}
289
290 \func{void}{ClearStyleStack}{\void}
291
292 Clears the style stack.
293
294 \membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone}
295
296 \constfunc{wxRichTextObject*}{Clone}{\void}
297
298 Clones the object.
299
300 \membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy}
301
302 \func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}}
303
304 Copies the given buffer.
305
306 \membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard}
307
308 \func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}}
309
310 Copy the given range to the clipboard.
311
312 \membersection{wxRichTextBuffer::DeleteRangeWithUndo}\label{wxrichtextbufferdeleterangewithundo}
313
314 \func{bool}{DeleteRangeWithUndo}{\param{const wxRichTextRange\& }{range}, \param{long }{initialCaretPosition}, \param{long }{newCaretPositon}, \param{wxRichTextCtrl* }{ctrl}}
315
316 Submits a command to delete the given range.
317
318 \membersection{wxRichTextBuffer::Dump}\label{wxrichtextbufferdump}
319
320 \func{void}{Dump}{\void}
321
322 \func{void}{Dump}{\param{wxTextOutputStream\& }{stream}}
323
324 Dumps the contents of the buffer for debugging purposes.
325
326 \membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment}
327
328 \func{bool}{EndAlignment}{\void}
329
330 Ends alignment.
331
332 \membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles}
333
334 \func{bool}{EndAllStyles}{\void}
335
336 Ends all styles that have been started with a Begin... command.
337
338 \membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo}
339
340 \func{bool}{EndBatchUndo}{\void}
341
342 Ends collapsing undo/redo commands, and submits the combined command.
343
344 \membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold}
345
346 \func{bool}{EndBold}{\void}
347
348 Ends using bold.
349
350 \membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle}
351
352 \func{bool}{EndCharacterStyle}{\void}
353
354 Ends using the named character style.
355
356 \membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont}
357
358 \func{bool}{EndFont}{\void}
359
360 Ends using a font.
361
362 \membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize}
363
364 \func{bool}{EndFontSize}{\void}
365
366 Ends using a point size.
367
368 \membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic}
369
370 \func{bool}{EndItalic}{\void}
371
372 Ends using italic.
373
374 \membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent}
375
376 \func{bool}{EndLeftIndent}{\void}
377
378 Ends using a left indent.
379
380 \membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing}
381
382 \func{bool}{EndLineSpacing}{\void}
383
384 Ends using a line spacing.
385
386 \membersection{wxRichTextBuffer::EndListStyle}\label{wxrichtextbufferendliststyle}
387
388 \func{bool}{EndListStyle}{\void}
389
390 Ends using a specified list style.
391
392 \membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet}
393
394 \func{bool}{EndNumberedBullet}{\void}
395
396 Ends a numbered bullet.
397
398 \membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing}
399
400 \func{bool}{EndParagraphSpacing}{\void}
401
402 Ends paragraph spacing.
403
404 \membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle}
405
406 \func{bool}{EndParagraphStyle}{\void}
407
408 Ends applying a named character style.
409
410 \membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent}
411
412 \func{bool}{EndRightIndent}{\void}
413
414 Ends using a right indent.
415
416 \membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle}
417
418 \func{bool}{EndStyle}{\void}
419
420 Ends the current style.
421
422 \membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo}
423
424 \func{bool}{EndSuppressUndo}{\void}
425
426 Ends suppressing undo/redo commands.
427
428 \membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet}
429
430 \func{bool}{EndSymbolBullet}{\void}
431
432 Ends using a symbol bullet.
433
434 \membersection{wxRichTextBuffer::EndStandardBullet}\label{wxrichtextbufferendstandardbullet}
435
436 \func{bool}{EndStandardBullet}{\void}
437
438 Ends using a standard bullet.
439
440 \membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour}
441
442 \func{bool}{EndTextColour}{\void}
443
444 Ends using a text foreground colour.
445
446 \membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline}
447
448 \func{bool}{EndUnderline}{\void}
449
450 Ends using underline.
451
452 \membersection{wxRichTextBuffer::EndURL}\label{wxrichtextbufferendurl}
453
454 \func{bool}{EndURL}{\void}
455
456 Ends applying a URL.
457
458 \membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler}
459
460 \func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}}
461
462 Finds a handler by type.
463
464 \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}}
465
466 Finds a handler by extension and type.
467
468 \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}}
469
470 Finds a handler by name.
471
472 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype}
473
474 \func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}}
475
476 Finds a handler by filename or, if supplied, type.
477
478 \membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle}
479
480 \constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void}
481
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).
486
487 \membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand}
488
489 \constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void}
490
491 Gets the collapsed command.
492
493 \membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor}
494
495 \constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
496
497 Gets the command processor. A text buffer always creates its own command processor when it is
498 initialized.
499
500 \membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle}
501
502 \constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void}
503
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).
506
507 \membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard}
508
509 \func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}}
510
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.
514
515 \membersection{wxRichTextBuffer::GetHandlers}\label{wxrichtextbuffergethandlers}
516
517 \func{wxList\&}{GetHandlers}{\void}
518
519 Returns the list of file handlers.
520
521 \membersection{wxRichTextBuffer::GetRenderer}\label{wxrichtextbuffergetrenderer}
522
523 \func{static wxRichTextRenderer*}{GetRenderer}{\void}
524
525 Returns the object to be used to render certain aspects of the content, such as bullets.
526
527 \membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle}
528
529 \func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
530
531 \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
532
533 Gets the attributes at the given position.
534
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}.
538
539 \membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange}
540
541 \func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}}
542
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
545 flags.
546
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.
550
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
560 show red.
561
562 \membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet}
563
564 \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
565
566 Returns the current style sheet associated with the buffer, if any.
567
568 \membersection{wxRichTextBuffer::GetStyleStackSize}\label{wxrichtextbuffergetstylestacksize}
569
570 \constfunc{size\_t}{GetStyleStackSize}{\void}
571
572 Get the size of the style stack, for example to check correct nesting.
573
574 \membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle}
575
576 \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
577
578 \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
579
580 Gets the attributes at the given position.
581
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}.
585
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.
588
589 \membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest}
590
591 \func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}}
592
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).
596
597 The function returns one of the following values:
598
599 {\small
600 \begin{verbatim}
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 \end{verbatim}
610 }
611
612 \membersection{wxRichTextBuffer::Init}\label{wxrichtextbufferinit}
613
614 \func{void}{Init}{\void}
615
616 Initialisation.
617
618 \membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers}
619
620 \func{void}{InitStandardHandlers}{\void}
621
622 Initialises the standard handlers. Currently, only the plain text loading/saving handler
623 is initialised by default.
624
625 \membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler}
626
627 \func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}}
628
629 Inserts a handler at the front of the list.
630
631 \membersection{wxRichTextBuffer::InsertImageWithUndo}\label{wxrichtextbufferinsertimagewithundo}
632
633 \func{bool}{InsertImageWithUndo}{\param{long }{pos}, \param{const wxRichTextImageBlock\& }{imageBlock}, \param{wxRichTextCtrl* }{ctrl}}
634
635 Submits a command to insert the given image.
636
637 \membersection{wxRichTextBuffer::InsertNewlineWithUndo}\label{wxrichtextbufferinsertnewlinewithundo}
638
639 \func{bool}{InsertNewlineWithUndo}{\param{long }{pos}, \param{wxRichTextCtrl* }{ctrl}}
640
641 Submits a command to insert a newline.
642
643 \membersection{wxRichTextBuffer::InsertTextWithUndo}\label{wxrichtextbufferinserttextwithundo}
644
645 \func{bool}{InsertTextWithUndo}{\param{long }{pos}, \param{const wxString\& }{text}, \param{wxRichTextCtrl* }{ctrl}}
646
647 Submits a command to insert the given text.
648
649 \membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified}
650
651 \constfunc{bool}{IsModified}{\void}
652
653 Returns \true if the buffer has been modified.
654
655 \membersection{wxRichTextBuffer::LoadFile}\label{wxrichtextbufferloadfile}
656
657 \func{bool}{LoadFile}{\param{wxInputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
658
659 Loads content from a stream.
660
661 \func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
662
663 Loads content from a file.
664
665 \membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify}
666
667 \func{void}{Modify}{\param{bool }{modify = true}}
668
669 Marks the buffer as modified or unmodified.
670
671 \membersection{wxRichTextBuffer::NumberList}\label{wxrichtextbuffernumberlist}
672
673 \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}}
674
675 \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}}
676
677 Numbers the paragraphs in the given range. Pass flags to determine how the attributes are set.
678 Either the style definition or the name of the style definition (in the current sheet) can be passed.
679
680 {\it flags} is a bit list of the following:
681
682 \begin{itemize}\itemsep=0pt
683 \item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
684 \item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
685 \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.
686 \end{itemize}
687
688 See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
689
690 \membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard}
691
692 \func{bool}{PasteFromClipboard}{\param{long }{position}}
693
694 Pastes the clipboard content to the buffer at the given position.
695
696 \membersection{wxRichTextBuffer::PromoteList}\label{wxrichtextbufferpromotelist}
697
698 \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}}
699
700 \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}}
701
702 Promotes or demotes the paragraphs in the given range. A positive {\it promoteBy} produces a smaller indent, and a negative number
703 produces a larger indent. Pass flags to determine how the attributes are set.
704 Either the style definition or the name of the style definition (in the current sheet) can be passed.
705
706 {\it flags} is a bit list of the following:
707
708 \begin{itemize}\itemsep=0pt
709 \item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
710 \item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
711 \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.
712 \end{itemize}
713
714 See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffernumberlist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
715
716 \membersection{wxRichTextBuffer::RemoveEventHandler}\label{wxrichtextbufferremoveeventhandler}
717
718 \func{bool}{RemoveEventHandler}{\param{wxEvtHandler* }{handler}, \param{bool}{ deleteHandler = false}}
719
720 Removes an event handler from the buffer's list of handlers, deleting the object if {\it deleteHandler} is \true.
721
722 \membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler}
723
724 \func{bool}{RemoveHandler}{\param{const wxString\& }{name}}
725
726 Removes a handler.
727
728 \membersection{wxRichTextBuffer::ResetAndClearCommands}\label{wxrichtextbufferresetandclearcommands}
729
730 \func{void}{ResetAndClearCommands}{\void}
731
732 Clears the buffer, adds a new blank paragraph, and clears the command history.
733
734 \membersection{wxRichTextBuffer::SaveFile}\label{wxrichtextbuffersavefile}
735
736 \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
737
738 Saves content to a stream.
739
740 \func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
741
742 Saves content to a file.
743
744 \membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle}
745
746 \func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}}
747
748 \func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
749
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).
754
755 \membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle}
756
757 \func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}}
758
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).
761
762 This is not cumulative - setting the default style will replace the previous default style.
763
764 \membersection{wxRichTextBuffer::SetListStyle}\label{wxrichtextbuffersetliststyle}
765
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}}
767
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}}
769
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.
772
773 {\it flags} is a bit list of the following:
774
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.
779 \end{itemize}
780
781 See also \helpref{wxRichTextBuffer::NumberList}{wxrichtextbuffernumberlist}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
782
783 \membersection{wxRichTextBuffer::SetRenderer}\label{wxrichtextbuffersetrenderer}
784
785 \func{static void}{SetRenderer}{\param{wxRichTextRenderer* }{renderer}}
786
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.
790
791 \membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle}
792
793 \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
794
795 \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
796
797 Sets the attributes for the given range. Pass flags to determine how the attributes are set.
798
799 The end point of range is specified as the last character position of the span of text.
800 So, for example, to set the style for a character at position 5, use the range (5,5).
801 This differs from the wxRichTextCtrl API, where you would specify (5,6).
802
803 {\it flags} may contain a bit list of the following values:
804
805 \begin{itemize}\itemsep=0pt
806 \item wxRICHTEXT\_SETSTYLE\_NONE: no style flag.
807 \item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this operation should be undoable.
808 \item wxRICHTEXT\_SETSTYLE\_OPTIMIZE: specifies that the style should not be applied if the
809 combined style at this point is already the style in question.
810 \item define wxRICHTEXT\_SETSTYLE\_PARAGRAPHS\_ONLY: specifies that the style should only be applied to paragraphs,
811 and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
812 \item wxRICHTEXT\_SETSTYLE\_CHARACTERS\_ONLY: specifies that the style should only be applied to characters,
813 and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
814 \end{itemize}
815
816 \membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet}
817
818 \func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
819
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.
822
823 \membersection{wxRichTextBuffer::SubmitAction}\label{wxrichtextbuffersubmitaction}
824
825 \func{bool}{SubmitAction}{\param{wxRichTextAction* }{action}}
826
827 Submit an action immediately, or delay it according to whether collapsing is on.
828
829 \membersection{wxRichTextBuffer::SuppressingUndo}\label{wxrichtextbuffersuppressingundo}
830
831 \constfunc{bool}{SuppressingUndo}{\void}
832
833 Returns \true if undo suppression is currently on.
834