Added URL support to attribute objects and to wxRichTextCtrl,
[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 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
173 \end{verbatim}
174 }
175
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.
180
181 \membersection{wxRichTextBuffer::BeginParagraphSpacing}\label{wxrichtextbufferbeginparagraphspacing}
182
183 \func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}
184
185 Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
186 a millimetre.
187
188 \membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle}
189
190 \func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
191
192 Begins applying the named paragraph style.
193
194 \membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent}
195
196 \func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
197
198 Begins a right indent, specified in tenths of a millimetre.
199
200 \membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle}
201
202 \func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}
203
204 Begins using a specified style.
205
206 \membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo}
207
208 \func{bool}{BeginSuppressUndo}{\void}
209
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.
214
215 \membersection{wxRichTextBuffer::BeginStandardBullet}\label{wxrichtextbufferbeginstandardbullet}
216
217 \func{bool}{BeginStandardBullet}{\param{const wxString\&}{ bulletName}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD}}
218
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.
221
222 \membersection{wxRichTextBuffer::BeginSymbolBullet}\label{wxrichtextbufferbeginsymbolbullet}
223
224 \func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}
225
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.
228
229 \membersection{wxRichTextBuffer::BeginTextColour}\label{wxrichtextbufferbegintextcolour}
230
231 \func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}
232
233 Begins using the specified text foreground colour.
234
235 \membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline}
236
237 \func{bool}{BeginUnderline}{\void}
238
239 Begins using underline.
240
241 \membersection{wxRichTextBuffer::BeginURL}\label{wxrichtextbufferbeginurl}
242
243 \func{bool}{BeginURL}{\param{const wxString\&}{ url}, \param{const wxString\&}{ characterStyle = wxEmptyString}}
244
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.
247
248 \membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard}
249
250 \constfunc{bool}{CanPasteFromClipboard}{\void}
251
252 Returns \true if content can be pasted from the clipboard.
253
254 \membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers}
255
256 \func{void}{CleanUpHandlers}{\void}
257
258 Cleans up the file handlers.
259
260 \membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear}
261
262 \func{void}{Clear}{\void}
263
264 Clears the buffer and resets the command processor.
265
266 \membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack}
267
268 \func{void}{ClearStyleStack}{\void}
269
270 Clears the style stack.
271
272 \membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone}
273
274 \constfunc{wxRichTextObject*}{Clone}{\void}
275
276 Clones the object.
277
278 \membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy}
279
280 \func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}}
281
282 Copies the given buffer.
283
284 \membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard}
285
286 \func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}}
287
288 Copy the given range to the clipboard.
289
290 \membersection{wxRichTextBuffer::DeleteRangeWithUndo}\label{wxrichtextbufferdeleterangewithundo}
291
292 \func{bool}{DeleteRangeWithUndo}{\param{const wxRichTextRange\& }{range}, \param{long }{initialCaretPosition}, \param{long }{newCaretPositon}, \param{wxRichTextCtrl* }{ctrl}}
293
294 Submits a command to delete the given range.
295
296 \membersection{wxRichTextBuffer::Dump}\label{wxrichtextbufferdump}
297
298 \func{void}{Dump}{\void}
299
300 \func{void}{Dump}{\param{wxTextOutputStream\& }{stream}}
301
302 Dumps the contents of the buffer for debugging purposes.
303
304 \membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment}
305
306 \func{bool}{EndAlignment}{\void}
307
308 Ends alignment.
309
310 \membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles}
311
312 \func{bool}{EndAllStyles}{\void}
313
314 Ends all styles that have been started with a Begin... command.
315
316 \membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo}
317
318 \func{bool}{EndBatchUndo}{\void}
319
320 Ends collapsing undo/redo commands, and submits the combined command.
321
322 \membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold}
323
324 \func{bool}{EndBold}{\void}
325
326 Ends using bold.
327
328 \membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle}
329
330 \func{bool}{EndCharacterStyle}{\void}
331
332 Ends using the named character style.
333
334 \membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont}
335
336 \func{bool}{EndFont}{\void}
337
338 Ends using a font.
339
340 \membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize}
341
342 \func{bool}{EndFontSize}{\void}
343
344 Ends using a point size.
345
346 \membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic}
347
348 \func{bool}{EndItalic}{\void}
349
350 Ends using italic.
351
352 \membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent}
353
354 \func{bool}{EndLeftIndent}{\void}
355
356 Ends using a left indent.
357
358 \membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing}
359
360 \func{bool}{EndLineSpacing}{\void}
361
362 Ends using a line spacing.
363
364 \membersection{wxRichTextBuffer::EndListStyle}\label{wxrichtextbufferendliststyle}
365
366 \func{bool}{EndListStyle}{\void}
367
368 Ends using a specified list style.
369
370 \membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet}
371
372 \func{bool}{EndNumberedBullet}{\void}
373
374 Ends a numbered bullet.
375
376 \membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing}
377
378 \func{bool}{EndParagraphSpacing}{\void}
379
380 Ends paragraph spacing.
381
382 \membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle}
383
384 \func{bool}{EndParagraphStyle}{\void}
385
386 Ends applying a named character style.
387
388 \membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent}
389
390 \func{bool}{EndRightIndent}{\void}
391
392 Ends using a right indent.
393
394 \membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle}
395
396 \func{bool}{EndStyle}{\void}
397
398 Ends the current style.
399
400 \membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo}
401
402 \func{bool}{EndSuppressUndo}{\void}
403
404 Ends suppressing undo/redo commands.
405
406 \membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet}
407
408 \func{bool}{EndSymbolBullet}{\void}
409
410 Ends using a symbol bullet.
411
412 \membersection{wxRichTextBuffer::EndStandardBullet}\label{wxrichtextbufferendstandardbullet}
413
414 \func{bool}{EndStandardBullet}{\void}
415
416 Ends using a standard bullet.
417
418 \membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour}
419
420 \func{bool}{EndTextColour}{\void}
421
422 Ends using a text foreground colour.
423
424 \membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline}
425
426 \func{bool}{EndUnderline}{\void}
427
428 Ends using underline.
429
430 \membersection{wxRichTextBuffer::EndURL}\label{wxrichtextbufferendurl}
431
432 \func{bool}{EndURL}{\void}
433
434 Ends applying a URL.
435
436 \membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler}
437
438 \func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}}
439
440 Finds a handler by type.
441
442 \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}}
443
444 Finds a handler by extension and type.
445
446 \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}}
447
448 Finds a handler by name.
449
450 \membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype}
451
452 \func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}}
453
454 Finds a handler by filename or, if supplied, type.
455
456 \membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle}
457
458 \constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void}
459
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).
464
465 \membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand}
466
467 \constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void}
468
469 Gets the collapsed command.
470
471 \membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor}
472
473 \constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
474
475 Gets the command processor. A text buffer always creates its own command processor when it is
476 initialized.
477
478 \membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle}
479
480 \constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void}
481
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).
484
485 \membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard}
486
487 \func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}}
488
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.
492
493 \membersection{wxRichTextBuffer::GetHandlers}\label{wxrichtextbuffergethandlers}
494
495 \func{wxList\&}{GetHandlers}{\void}
496
497 Returns the list of file handlers.
498
499 \membersection{wxRichTextBuffer::GetRenderer}\label{wxrichtextbuffergetrenderer}
500
501 \func{static wxRichTextRenderer*}{GetRenderer}{\void}
502
503 Returns the object to be used to render certain aspects of the content, such as bullets.
504
505 \membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle}
506
507 \func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
508
509 \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
510
511 Gets the attributes at the given position.
512
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}.
516
517 \membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange}
518
519 \func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}}
520
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
523 flags.
524
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.
528
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
538 show red.
539
540 \membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet}
541
542 \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
543
544 Returns the current style sheet associated with the buffer, if any.
545
546 \membersection{wxRichTextBuffer::GetStyleStackSize}\label{wxrichtextbuffergetstylestacksize}
547
548 \constfunc{size\_t}{GetStyleStackSize}{\void}
549
550 Get the size of the style stack, for example to check correct nesting.
551
552 \membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle}
553
554 \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
555
556 \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
557
558 Gets the attributes at the given position.
559
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}.
563
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.
566
567 \membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest}
568
569 \func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}}
570
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).
574
575 The function returns one of the following values:
576
577 {\small
578 \begin{verbatim}
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
587 \end{verbatim}
588 }
589
590 \membersection{wxRichTextBuffer::Init}\label{wxrichtextbufferinit}
591
592 \func{void}{Init}{\void}
593
594 Initialisation.
595
596 \membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers}
597
598 \func{void}{InitStandardHandlers}{\void}
599
600 Initialises the standard handlers. Currently, only the plain text loading/saving handler
601 is initialised by default.
602
603 \membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler}
604
605 \func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}}
606
607 Inserts a handler at the front of the list.
608
609 \membersection{wxRichTextBuffer::InsertImageWithUndo}\label{wxrichtextbufferinsertimagewithundo}
610
611 \func{bool}{InsertImageWithUndo}{\param{long }{pos}, \param{const wxRichTextImageBlock\& }{imageBlock}, \param{wxRichTextCtrl* }{ctrl}}
612
613 Submits a command to insert the given image.
614
615 \membersection{wxRichTextBuffer::InsertNewlineWithUndo}\label{wxrichtextbufferinsertnewlinewithundo}
616
617 \func{bool}{InsertNewlineWithUndo}{\param{long }{pos}, \param{wxRichTextCtrl* }{ctrl}}
618
619 Submits a command to insert a newline.
620
621 \membersection{wxRichTextBuffer::InsertTextWithUndo}\label{wxrichtextbufferinserttextwithundo}
622
623 \func{bool}{InsertTextWithUndo}{\param{long }{pos}, \param{const wxString\& }{text}, \param{wxRichTextCtrl* }{ctrl}}
624
625 Submits a command to insert the given text.
626
627 \membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified}
628
629 \constfunc{bool}{IsModified}{\void}
630
631 Returns \true if the buffer has been modified.
632
633 \membersection{wxRichTextBuffer::LoadFile}\label{wxrichtextbufferloadfile}
634
635 \func{bool}{LoadFile}{\param{wxInputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
636
637 Loads content from a stream.
638
639 \func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
640
641 Loads content from a file.
642
643 \membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify}
644
645 \func{void}{Modify}{\param{bool }{modify = true}}
646
647 Marks the buffer as modified or unmodified.
648
649 \membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard}
650
651 \func{bool}{PasteFromClipboard}{\param{long }{position}}
652
653 Pastes the clipboard content to the buffer at the given position.
654
655 \membersection{wxRichTextBuffer::RemoveEventHandler}\label{wxrichtextbufferremoveeventhandler}
656
657 \func{bool}{RemoveEventHandler}{\param{wxEvtHandler* }{handler}, \param{bool}{ deleteHandler = false}}
658
659 Removes an event handler from the buffer's list of handlers, deleting the object if {\it deleteHandler} is \true.
660
661 \membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler}
662
663 \func{bool}{RemoveHandler}{\param{const wxString\& }{name}}
664
665 Removes a handler.
666
667 \membersection{wxRichTextBuffer::Reset}\label{wxrichtextbufferreset}
668
669 \func{void}{Reset}{\void}
670
671 The same as \helpref{Clear}{wxrichtextbufferclear}, plus an empty paragraph is added.
672
673 \membersection{wxRichTextBuffer::SaveFile}\label{wxrichtextbuffersavefile}
674
675 \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
676
677 Saves content to a stream.
678
679 \func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
680
681 Saves content to a file.
682
683 \membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle}
684
685 \func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}}
686
687 \func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
688
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).
693
694 \membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle}
695
696 \func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}}
697
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).
700
701 This is not cumulative - setting the default style will replace the previous default style.
702
703 \membersection{wxRichTextBuffer::SetRenderer}\label{wxrichtextbuffersetrenderer}
704
705 \func{static void}{SetRenderer}{\param{wxRichTextRenderer* }{renderer}}
706
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.
710
711 \membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle}
712
713 \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
714
715 \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
716
717 Sets the attributes for the given range, passing flags to determine how the attributes are set.
718
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).
722
723 {\it flags} may contain a bit list of the following values:
724
725 \begin{verbatim}
726 #define wxRICHTEXT_SETSTYLE_NONE 0x00
727
728 // Specifies that this operation should be undoable
729 #define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01
730
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
734
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
739
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
744 \end{verbatim}
745
746 \membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet}
747
748 \func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
749
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.
752
753 \membersection{wxRichTextBuffer::SubmitAction}\label{wxrichtextbuffersubmitaction}
754
755 \func{bool}{SubmitAction}{\param{wxRichTextAction* }{action}}
756
757 Submit an action immediately, or delay it according to whether collapsing is on.
758
759 \membersection{wxRichTextBuffer::SuppressingUndo}\label{wxrichtextbuffersuppressingundo}
760
761 \constfunc{bool}{SuppressingUndo}{\void}
762
763 Returns \true if undo suppression is currently on.
764