]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/richtextbuffer.tex
Use const
[wxWidgets.git] / docs / latex / wx / richtextbuffer.tex
CommitLineData
5f35b46a
JS
1\section{\class{wxRichTextBuffer}}\label{wxrichtextbuffer}
2
3This class represents the whole buffer associated with a \helpref{wxRichTextCtrl}{wxrichtextctrl}.
4
5\wxheading{Derived from}
6
7wxRichTextParagraphLayoutBox
8
9\wxheading{Include files}
10
11<wx/richtext/richtextbuffer.h>
12
a7af285d
VZ
13\wxheading{Library}
14
15\helpref{wxRichtext}{librarieslist}
16
5f35b46a
JS
17\wxheading{Data structures}
18
19\wxheading{See also}
20
21\helpref{wxTextAttr}{wxtextattr}, \helpref{wxTextAttrEx}{wxtextattrex}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
22
23\latexignore{\rtfignore{\wxheading{Members}}}
24
25\membersection{wxRichTextBuffer::wxRichTextBuffer}\label{wxrichtextbufferwxrichtextbuffer}
26
27\func{}{wxRichTextBuffer}{\param{const wxRichTextBuffer\& }{obj}}
28
29Copy constructor.
30
31\func{}{wxRichTextBuffer}{\void}
32
33Default constructors.
34
35\membersection{wxRichTextBuffer::\destruct{wxRichTextBuffer}}\label{wxrichtextbufferdtor}
36
37\func{}{\destruct{wxRichTextBuffer}}{\void}
38
39Destructor.
40
d2d0adc7
JS
41\membersection{wxRichTextBuffer::AddEventHandler}\label{wxrichtextbufferaddeventhandler}
42
43\func{bool}{AddEventHandler}{\param{wxEvtHandler* }{handler}}
44
45Adds an event handler to the buffer's list of handlers. A buffer associated with
46a contol has the control as the only event handler, but the application is free
47to add more if further notification is required. All handlers are notified
48of an event originating from the buffer, such as the replacement of a style sheet
49during loading. The buffer never deletes any of the event handlers, unless
50\helpref{wxRichTextBuffer::RemoveEventHandler}{wxrichtextbufferremoveeventhandler} is
51called with \true as the second argument.
52
5f35b46a
JS
53\membersection{wxRichTextBuffer::AddHandler}\label{wxrichtextbufferaddhandler}
54
55\func{void}{AddHandler}{\param{wxRichTextFileHandler* }{handler}}
56
57Adds a file handler.
58
59\membersection{wxRichTextBuffer::AddParagraph}\label{wxrichtextbufferaddparagraph}
60
61\func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}
62
63Adds a paragraph of text.
64
65\membersection{wxRichTextBuffer::BatchingUndo}\label{wxrichtextbufferbatchingundo}
66
67\constfunc{bool}{BatchingUndo}{\void}
68
69Returns \true if the buffer is currently collapsing commands into a single notional command.
70
71\membersection{wxRichTextBuffer::BeginAlignment}\label{wxrichtextbufferbeginalignment}
72
73\func{bool}{BeginAlignment}{\param{wxTextAttrAlignment }{alignment}}
74
75Begins using alignment.
76
77\membersection{wxRichTextBuffer::BeginBatchUndo}\label{wxrichtextbufferbeginbatchundo}
78
79\func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}
80
81Begins collapsing undo/redo commands. Note that this may not work properly
82if combining commands that delete or insert content, changing ranges for
83subsequent actions.
84
85{\it cmdName} should be the name of the combined command that will appear
86next to Undo and Redo in the edit menu.
87
88\membersection{wxRichTextBuffer::BeginBold}\label{wxrichtextbufferbeginbold}
89
90\func{bool}{BeginBold}{\void}
91
92Begin applying bold.
93
94\membersection{wxRichTextBuffer::BeginCharacterStyle}\label{wxrichtextbufferbegincharacterstyle}
95
96\func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}
97
98Begins applying the named character style.
99
100\membersection{wxRichTextBuffer::BeginFont}\label{wxrichtextbufferbeginfont}
101
102\func{bool}{BeginFont}{\param{const wxFont\& }{font}}
103
104Begins using this font.
105
106\membersection{wxRichTextBuffer::BeginFontSize}\label{wxrichtextbufferbeginfontsize}
107
108\func{bool}{BeginFontSize}{\param{int }{pointSize}}
109
110Begins using the given point size.
111
112\membersection{wxRichTextBuffer::BeginItalic}\label{wxrichtextbufferbeginitalic}
113
114\func{bool}{BeginItalic}{\void}
115
116Begins using italic.
117
118\membersection{wxRichTextBuffer::BeginLeftIndent}\label{wxrichtextbufferbeginleftindent}
119
120\func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}}
121
122Begin using {\it leftIndent} for the left indent, and optionally {\it leftSubIndent} for
123the sub-indent. Both are expressed in tenths of a millimetre.
124
125The sub-indent is an offset from the left of the paragraph, and is used for all but the
126first line in a paragraph. A positive value will cause the first line to appear to the left
127of the subsequent lines, and a negative value will cause the first line to be indented
128relative to the subsequent lines.
129
130\membersection{wxRichTextBuffer::BeginLineSpacing}\label{wxrichtextbufferbeginlinespacing}
131
132\func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}
133
134Begins line spacing using the specified value. {\it spacing} is a multiple, where 10 means single-spacing,
13515 means 1.5 spacing, and 20 means double spacing. The following constants are
136defined for convenience:
137
138{\small
139\begin{verbatim}
140#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
141#define wxTEXT_ATTR_LINE_SPACING_HALF 15
142#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
143\end{verbatim}
144}
145
d2d0adc7
JS
146\membersection{wxRichTextBuffer::BeginListStyle}\label{wxrichtextbufferbeginliststyle}
147
148\func{bool}{BeginListStyle}{\param{const wxString\&}{ listStyle}, \param{int}{ level=1}, \param{int}{ number=1}}
149
150Begins using a specified list style. Optionally, you can also pass a level and a number.
151
5f35b46a
JS
152\membersection{wxRichTextBuffer::BeginNumberedBullet}\label{wxrichtextbufferbeginnumberedbullet}
153
154\func{bool}{BeginNumberedBullet}{\param{int }{bulletNumber}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_ARABIC|wxTEXT\_ATTR\_BULLET\_STYLE\_PERIOD}}
155
156Begins a numbered bullet. This call will be needed for each item in the list, and the
157application should take care of incrementing the numbering.
158
159{\it bulletNumber} is a number, usually starting with 1.
160
161{\it leftIndent} and {\it leftSubIndent} are values in tenths of a millimetre.
162
163{\it bulletStyle} is a bitlist of the following values:
164
165{\small
166\begin{verbatim}
62f4313b
JS
167#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
168#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
169#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
170#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
171#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
172#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
173#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
174#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
175#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
176#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
177#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
178#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
179#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
180#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
181#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
182#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
5f35b46a
JS
183\end{verbatim}
184}
185
186wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
187the margin and the bullet. The content of the paragraph, including the first line, starts
188at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
189left of the actual paragraph is leftSubIndent.
190
191\membersection{wxRichTextBuffer::BeginParagraphSpacing}\label{wxrichtextbufferbeginparagraphspacing}
192
193\func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}
194
195Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
196a millimetre.
197
198\membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle}
199
200\func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
201
202Begins applying the named paragraph style.
203
204\membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent}
205
206\func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
207
208Begins a right indent, specified in tenths of a millimetre.
209
210\membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle}
211
212\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}
213
214Begins using a specified style.
215
216\membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo}
217
218\func{bool}{BeginSuppressUndo}{\void}
219
220Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
221differently by each command. If not dealt with by a command implementation, then
222it will be implemented automatically by not storing the command in the undo history
223when the action is submitted to the command processor.
224
d2d0adc7
JS
225\membersection{wxRichTextBuffer::BeginStandardBullet}\label{wxrichtextbufferbeginstandardbullet}
226
227\func{bool}{BeginStandardBullet}{\param{const wxString\&}{ bulletName}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD}}
228
229Begins applying a standard bullet, using one of the standard bullet names (currently {\tt standard/circle} or {\tt standard/square}.
230See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for an explanation of how indentation is used to render the bulleted paragraph.
231
5f35b46a
JS
232\membersection{wxRichTextBuffer::BeginSymbolBullet}\label{wxrichtextbufferbeginsymbolbullet}
233
234\func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}
235
236Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for
237an explanation of how indentation is used to render the bulleted paragraph.
238
239\membersection{wxRichTextBuffer::BeginTextColour}\label{wxrichtextbufferbegintextcolour}
240
241\func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}
242
243Begins using the specified text foreground colour.
244
245\membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline}
246
247\func{bool}{BeginUnderline}{\void}
248
249Begins using underline.
250
d2d0adc7
JS
251\membersection{wxRichTextBuffer::BeginURL}\label{wxrichtextbufferbeginurl}
252
253\func{bool}{BeginURL}{\param{const wxString\&}{ url}, \param{const wxString\&}{ characterStyle = wxEmptyString}}
254
255Begins applying wxTEXT\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
256since it is common to mark a URL with a familiar style such as blue text with underlining.
257
5f35b46a
JS
258\membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard}
259
260\constfunc{bool}{CanPasteFromClipboard}{\void}
261
262Returns \true if content can be pasted from the clipboard.
263
264\membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers}
265
266\func{void}{CleanUpHandlers}{\void}
267
268Cleans up the file handlers.
269
270\membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear}
271
272\func{void}{Clear}{\void}
273
62f4313b
JS
274Clears the buffer.
275
276\membersection{wxRichTextBuffer::ClearListStyle}\label{wxrichtextbufferclearliststyle}
277
278\func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
279
280\func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
281
282Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
283
284{\it flags} is a bit list of the following:
285
286\begin{itemize}\itemsep=0pt
287\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
288\end{itemize}
289
290See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::NumberList}{wxrichtextbuffernumberlist}.
5f35b46a
JS
291
292\membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack}
293
294\func{void}{ClearStyleStack}{\void}
295
296Clears the style stack.
297
298\membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone}
299
300\constfunc{wxRichTextObject*}{Clone}{\void}
301
302Clones the object.
303
304\membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy}
305
306\func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}}
307
308Copies the given buffer.
309
310\membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard}
311
312\func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}}
313
314Copy the given range to the clipboard.
315
316\membersection{wxRichTextBuffer::DeleteRangeWithUndo}\label{wxrichtextbufferdeleterangewithundo}
317
21fae46d 318\func{bool}{DeleteRangeWithUndo}{\param{const wxRichTextRange\& }{range}, \param{wxRichTextCtrl* }{ctrl}}
5f35b46a
JS
319
320Submits a command to delete the given range.
321
322\membersection{wxRichTextBuffer::Dump}\label{wxrichtextbufferdump}
323
324\func{void}{Dump}{\void}
325
326\func{void}{Dump}{\param{wxTextOutputStream\& }{stream}}
327
328Dumps the contents of the buffer for debugging purposes.
329
330\membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment}
331
332\func{bool}{EndAlignment}{\void}
333
334Ends alignment.
335
336\membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles}
337
338\func{bool}{EndAllStyles}{\void}
339
340Ends all styles that have been started with a Begin... command.
341
342\membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo}
343
344\func{bool}{EndBatchUndo}{\void}
345
346Ends collapsing undo/redo commands, and submits the combined command.
347
348\membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold}
349
350\func{bool}{EndBold}{\void}
351
352Ends using bold.
353
354\membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle}
355
356\func{bool}{EndCharacterStyle}{\void}
357
358Ends using the named character style.
359
360\membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont}
361
362\func{bool}{EndFont}{\void}
363
364Ends using a font.
365
366\membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize}
367
368\func{bool}{EndFontSize}{\void}
369
370Ends using a point size.
371
372\membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic}
373
374\func{bool}{EndItalic}{\void}
375
376Ends using italic.
377
378\membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent}
379
380\func{bool}{EndLeftIndent}{\void}
381
382Ends using a left indent.
383
384\membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing}
385
386\func{bool}{EndLineSpacing}{\void}
387
388Ends using a line spacing.
389
d2d0adc7
JS
390\membersection{wxRichTextBuffer::EndListStyle}\label{wxrichtextbufferendliststyle}
391
392\func{bool}{EndListStyle}{\void}
393
394Ends using a specified list style.
395
5f35b46a
JS
396\membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet}
397
398\func{bool}{EndNumberedBullet}{\void}
399
400Ends a numbered bullet.
401
402\membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing}
403
404\func{bool}{EndParagraphSpacing}{\void}
405
406Ends paragraph spacing.
407
408\membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle}
409
410\func{bool}{EndParagraphStyle}{\void}
411
412Ends applying a named character style.
413
414\membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent}
415
416\func{bool}{EndRightIndent}{\void}
417
418Ends using a right indent.
419
420\membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle}
421
422\func{bool}{EndStyle}{\void}
423
424Ends the current style.
425
426\membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo}
427
428\func{bool}{EndSuppressUndo}{\void}
429
430Ends suppressing undo/redo commands.
431
432\membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet}
433
434\func{bool}{EndSymbolBullet}{\void}
435
436Ends using a symbol bullet.
437
d2d0adc7
JS
438\membersection{wxRichTextBuffer::EndStandardBullet}\label{wxrichtextbufferendstandardbullet}
439
440\func{bool}{EndStandardBullet}{\void}
441
442Ends using a standard bullet.
443
5f35b46a
JS
444\membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour}
445
446\func{bool}{EndTextColour}{\void}
447
448Ends using a text foreground colour.
449
450\membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline}
451
452\func{bool}{EndUnderline}{\void}
453
454Ends using underline.
455
d2d0adc7
JS
456\membersection{wxRichTextBuffer::EndURL}\label{wxrichtextbufferendurl}
457
458\func{bool}{EndURL}{\void}
459
460Ends applying a URL.
461
5f35b46a
JS
462\membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler}
463
464\func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}}
465
466Finds a handler by type.
467
468\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}}
469
470Finds a handler by extension and type.
471
472\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}}
473
474Finds a handler by name.
475
476\membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype}
477
478\func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}}
479
480Finds a handler by filename or, if supplied, type.
481
62a268cc
JS
482\membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle}
483
484\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void}
485
486Gets the basic (overall) style. This is the style of the whole
487buffer before further styles are applied, unlike the default style, which
488only affects the style currently being applied (for example, setting the default
489style to bold will cause subsequently inserted text to be bold).
490
5f35b46a
JS
491\membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand}
492
493\constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void}
494
495Gets the collapsed command.
496
497\membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor}
498
499\constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
500
501Gets the command processor. A text buffer always creates its own command processor when it is
502initialized.
503
62a268cc
JS
504\membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle}
505
506\constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void}
507
508Returns the current default style, affecting the style currently being applied (for example, setting the default
509style to bold will cause subsequently inserted text to be bold).
510
5f35b46a
JS
511\membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard}
512
513\func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}}
514
515Gets a wildcard incorporating all visible handlers. If {\it types} is present,
516it will be filled with the file type corresponding to each filter. This can be
517used to determine the type to pass to \helpref{LoadFile}{wxrichtextbuffergetextwildcard} given a selected filter.
518
519\membersection{wxRichTextBuffer::GetHandlers}\label{wxrichtextbuffergethandlers}
520
521\func{wxList\&}{GetHandlers}{\void}
522
523Returns the list of file handlers.
524
d2d0adc7
JS
525\membersection{wxRichTextBuffer::GetRenderer}\label{wxrichtextbuffergetrenderer}
526
527\func{static wxRichTextRenderer*}{GetRenderer}{\void}
528
529Returns the object to be used to render certain aspects of the content, such as bullets.
530
62a268cc
JS
531\membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle}
532
533\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
534
535\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
536
537Gets the attributes at the given position.
538
539This function gets the combined style - that is, the style you see on the screen as a result
540of combining base style, paragraph style and character style attributes. To get the character
541or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextbuffergetuncombinedstyle}.
542
543\membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange}
544
545\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}}
546
547This function gets a style representing the common, combined attributes in the given range.
548Attributes which have different values within the specified range will not be included the style
549flags.
550
551The function is used to get the attributes to display in the formatting dialog: the user
552can edit the attributes common to the selection, and optionally specify the values of further
553attributes to be applied uniformly.
554
555To apply the edited attributes, you can use \helpref{SetStyle}{wxrichtextbuffersetstyle} specifying
556the wxRICHTEXT\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different
557from the {\it combined} attributes within the range. So, the user edits the effective, displayed attributes
558for the range, but his choice won't be applied unnecessarily to content. As an example,
559say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The
560combined style is bold, and this is what the user will see on-screen and in the formatting
561dialog. The user now specifies red text, in addition to bold. When applying with
562SetStyle, the content font weight attributes won't be changed to bold because this is already specified
563by the paragraph. However the text colour attributes {\it will} be changed to
564show red.
565
5f35b46a
JS
566\membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet}
567
568\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
569
570Returns the current style sheet associated with the buffer, if any.
571
572\membersection{wxRichTextBuffer::GetStyleStackSize}\label{wxrichtextbuffergetstylestacksize}
573
574\constfunc{size\_t}{GetStyleStackSize}{\void}
575
576Get the size of the style stack, for example to check correct nesting.
577
62a268cc
JS
578\membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle}
579
580\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
581
582\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
583
584Gets the attributes at the given position.
585
586This function gets the {\it uncombined style} - that is, the attributes associated with the
587paragraph or character content, and not necessarily the combined attributes you see on the
588screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextbuffergetstyle}.
589
590If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch
591the paragraph attributes. Otherwise, it will return the character attributes.
592
5f35b46a
JS
593\membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest}
594
595\func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}}
596
597Finds the text position for the given position, putting the position in {\it textPosition} if
598one is found. {\it pt} is in logical units (a zero y position is
599at the beginning of the buffer).
600
601The function returns one of the following values:
602
603{\small
604\begin{verbatim}
605// The point was not on this object
606#define wxRICHTEXT_HITTEST_NONE 0x01
607// The point was before the position returned from HitTest
608#define wxRICHTEXT_HITTEST_BEFORE 0x02
609// The point was after the position returned from HitTest
610#define wxRICHTEXT_HITTEST_AFTER 0x04
611// The point was on the position returned from HitTest
612#define wxRICHTEXT_HITTEST_ON 0x08
f262b25c
JS
613// The point was on space outside content
614#define wxRICHTEXT_HITTEST_OUTSIDE 0x10
5f35b46a
JS
615\end{verbatim}
616}
617
618\membersection{wxRichTextBuffer::Init}\label{wxrichtextbufferinit}
619
620\func{void}{Init}{\void}
621
622Initialisation.
623
624\membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers}
625
626\func{void}{InitStandardHandlers}{\void}
627
628Initialises the standard handlers. Currently, only the plain text loading/saving handler
629is initialised by default.
630
631\membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler}
632
633\func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}}
634
635Inserts a handler at the front of the list.
636
637\membersection{wxRichTextBuffer::InsertImageWithUndo}\label{wxrichtextbufferinsertimagewithundo}
638
639\func{bool}{InsertImageWithUndo}{\param{long }{pos}, \param{const wxRichTextImageBlock\& }{imageBlock}, \param{wxRichTextCtrl* }{ctrl}}
640
641Submits a command to insert the given image.
642
643\membersection{wxRichTextBuffer::InsertNewlineWithUndo}\label{wxrichtextbufferinsertnewlinewithundo}
644
645\func{bool}{InsertNewlineWithUndo}{\param{long }{pos}, \param{wxRichTextCtrl* }{ctrl}}
646
647Submits a command to insert a newline.
648
649\membersection{wxRichTextBuffer::InsertTextWithUndo}\label{wxrichtextbufferinserttextwithundo}
650
651\func{bool}{InsertTextWithUndo}{\param{long }{pos}, \param{const wxString\& }{text}, \param{wxRichTextCtrl* }{ctrl}}
652
653Submits a command to insert the given text.
654
655\membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified}
656
657\constfunc{bool}{IsModified}{\void}
658
659Returns \true if the buffer has been modified.
660
661\membersection{wxRichTextBuffer::LoadFile}\label{wxrichtextbufferloadfile}
662
663\func{bool}{LoadFile}{\param{wxInputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
664
665Loads content from a stream.
666
667\func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
668
669Loads content from a file.
670
671\membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify}
672
673\func{void}{Modify}{\param{bool }{modify = true}}
674
675Marks the buffer as modified or unmodified.
676
62f4313b
JS
677\membersection{wxRichTextBuffer::NumberList}\label{wxrichtextbuffernumberlist}
678
679\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}}
680
681\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}}
682
683Numbers the paragraphs in the given range. Pass flags to determine how the attributes are set.
684Either the style definition or the name of the style definition (in the current sheet) can be passed.
685
686{\it flags} is a bit list of the following:
687
688\begin{itemize}\itemsep=0pt
689\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
690\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
691\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.
692\end{itemize}
693
694See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
695
5f35b46a
JS
696\membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard}
697
698\func{bool}{PasteFromClipboard}{\param{long }{position}}
699
700Pastes the clipboard content to the buffer at the given position.
701
62f4313b
JS
702\membersection{wxRichTextBuffer::PromoteList}\label{wxrichtextbufferpromotelist}
703
704\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}}
705
706\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}}
707
708Promotes or demotes the paragraphs in the given range. A positive {\it promoteBy} produces a smaller indent, and a negative number
709produces a larger indent. Pass flags to determine how the attributes are set.
710Either the style definition or the name of the style definition (in the current sheet) can be passed.
711
712{\it flags} is a bit list of the following:
713
714\begin{itemize}\itemsep=0pt
715\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
716\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
717\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.
718\end{itemize}
719
720See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffersetliststyle}, See also \helpref{wxRichTextBuffer::SetListStyle}{wxrichtextbuffernumberlist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
721
d2d0adc7
JS
722\membersection{wxRichTextBuffer::RemoveEventHandler}\label{wxrichtextbufferremoveeventhandler}
723
724\func{bool}{RemoveEventHandler}{\param{wxEvtHandler* }{handler}, \param{bool}{ deleteHandler = false}}
725
726Removes an event handler from the buffer's list of handlers, deleting the object if {\it deleteHandler} is \true.
727
5f35b46a
JS
728\membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler}
729
730\func{bool}{RemoveHandler}{\param{const wxString\& }{name}}
731
732Removes a handler.
733
62f4313b 734\membersection{wxRichTextBuffer::ResetAndClearCommands}\label{wxrichtextbufferresetandclearcommands}
5f35b46a 735
62f4313b 736\func{void}{ResetAndClearCommands}{\void}
5f35b46a 737
62f4313b 738Clears the buffer, adds a new blank paragraph, and clears the command history.
5f35b46a
JS
739
740\membersection{wxRichTextBuffer::SaveFile}\label{wxrichtextbuffersavefile}
741
742\func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
743
744Saves content to a stream.
745
746\func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
747
748Saves content to a file.
749
62a268cc
JS
750\membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle}
751
752\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}}
753
754\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
755
756Sets the basic (overall) style. This is the style of the whole
757buffer before further styles are applied, unlike the default style, which
758only affects the style currently being applied (for example, setting the default
759style to bold will cause subsequently inserted text to be bold).
760
761\membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle}
762
763\func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}}
764
765Sets the default style, affecting the style currently being applied (for example, setting the default
766style to bold will cause subsequently inserted text to be bold).
767
768This is not cumulative - setting the default style will replace the previous default style.
769
62f4313b
JS
770\membersection{wxRichTextBuffer::SetListStyle}\label{wxrichtextbuffersetliststyle}
771
772\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}}
773
774\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}}
775
776Sets the list attributes for the given range, passing flags to determine how the attributes are set.
777Either the style definition or the name of the style definition (in the current sheet) can be passed.
778
779{\it flags} is a bit list of the following:
780
781\begin{itemize}\itemsep=0pt
782\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
783\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
784\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.
785\end{itemize}
786
787See also \helpref{wxRichTextBuffer::NumberList}{wxrichtextbuffernumberlist}, \helpref{wxRichTextBuffer::PromoteList}{wxrichtextbufferpromotelist}, \helpref{wxRichTextBuffer::ClearListStyle}{wxrichtextbufferclearliststyle}.
788
d2d0adc7
JS
789\membersection{wxRichTextBuffer::SetRenderer}\label{wxrichtextbuffersetrenderer}
790
791\func{static void}{SetRenderer}{\param{wxRichTextRenderer* }{renderer}}
792
793Sets {\it renderer} as the object to be used to render certain aspects of the content, such as bullets.
794You can override default rendering by deriving a new class from wxRichTextRenderer or wxRichTextStdRenderer,
795overriding one or more virtual functions, and setting an instance of the class using this function.
796
62a268cc
JS
797\membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle}
798
799\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
800
801\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
802
62f4313b 803Sets the attributes for the given range. Pass flags to determine how the attributes are set.
62a268cc
JS
804
805The end point of range is specified as the last character position of the span of text.
806So, for example, to set the style for a character at position 5, use the range (5,5).
807This differs from the wxRichTextCtrl API, where you would specify (5,6).
808
809{\it flags} may contain a bit list of the following values:
810
62f4313b
JS
811\begin{itemize}\itemsep=0pt
812\item wxRICHTEXT\_SETSTYLE\_NONE: no style flag.
813\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this operation should be undoable.
814\item wxRICHTEXT\_SETSTYLE\_OPTIMIZE: specifies that the style should not be applied if the
815combined style at this point is already the style in question.
523d2f14 816\item wxRICHTEXT\_SETSTYLE\_PARAGRAPHS\_ONLY: specifies that the style should only be applied to paragraphs,
62f4313b
JS
817and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
818\item wxRICHTEXT\_SETSTYLE\_CHARACTERS\_ONLY: specifies that the style should only be applied to characters,
819and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
523d2f14 820\item wxRICHTEXT\_SETSTYLE\_RESET: resets (clears) the existing style before applying the new style.
aeb6ebe2 821\item wxRICHTEXT\_SETSTYLE\_REMOVE: removes the specified style. Only the style flags are used in this operation.
62f4313b 822\end{itemize}
62a268cc 823
5f35b46a
JS
824\membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet}
825
826\func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
827
828Sets the current style sheet, if any. This will allow the application to use
829named character and paragraph styles found in the style sheet.
830
831\membersection{wxRichTextBuffer::SubmitAction}\label{wxrichtextbuffersubmitaction}
832
833\func{bool}{SubmitAction}{\param{wxRichTextAction* }{action}}
834
835Submit an action immediately, or delay it according to whether collapsing is on.
836
837\membersection{wxRichTextBuffer::SuppressingUndo}\label{wxrichtextbuffersuppressingundo}
838
839\constfunc{bool}{SuppressingUndo}{\void}
840
841Returns \true if undo suppression is currently on.
842