]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/richtextbuffer.tex
Add empty EnableCloseButton() into wxTLW base class.
[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
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
25Copy constructor.
26
27\func{}{wxRichTextBuffer}{\void}
28
29Default constructors.
30
31\membersection{wxRichTextBuffer::\destruct{wxRichTextBuffer}}\label{wxrichtextbufferdtor}
32
33\func{}{\destruct{wxRichTextBuffer}}{\void}
34
35Destructor.
36
d2d0adc7
JS
37\membersection{wxRichTextBuffer::AddEventHandler}\label{wxrichtextbufferaddeventhandler}
38
39\func{bool}{AddEventHandler}{\param{wxEvtHandler* }{handler}}
40
41Adds an event handler to the buffer's list of handlers. A buffer associated with
42a contol has the control as the only event handler, but the application is free
43to add more if further notification is required. All handlers are notified
44of an event originating from the buffer, such as the replacement of a style sheet
45during loading. The buffer never deletes any of the event handlers, unless
46\helpref{wxRichTextBuffer::RemoveEventHandler}{wxrichtextbufferremoveeventhandler} is
47called with \true as the second argument.
48
5f35b46a
JS
49\membersection{wxRichTextBuffer::AddHandler}\label{wxrichtextbufferaddhandler}
50
51\func{void}{AddHandler}{\param{wxRichTextFileHandler* }{handler}}
52
53Adds a file handler.
54
55\membersection{wxRichTextBuffer::AddParagraph}\label{wxrichtextbufferaddparagraph}
56
57\func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}
58
59Adds a paragraph of text.
60
61\membersection{wxRichTextBuffer::BatchingUndo}\label{wxrichtextbufferbatchingundo}
62
63\constfunc{bool}{BatchingUndo}{\void}
64
65Returns \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
71Begins using alignment.
72
73\membersection{wxRichTextBuffer::BeginBatchUndo}\label{wxrichtextbufferbeginbatchundo}
74
75\func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}
76
77Begins collapsing undo/redo commands. Note that this may not work properly
78if combining commands that delete or insert content, changing ranges for
79subsequent actions.
80
81{\it cmdName} should be the name of the combined command that will appear
82next to Undo and Redo in the edit menu.
83
84\membersection{wxRichTextBuffer::BeginBold}\label{wxrichtextbufferbeginbold}
85
86\func{bool}{BeginBold}{\void}
87
88Begin applying bold.
89
90\membersection{wxRichTextBuffer::BeginCharacterStyle}\label{wxrichtextbufferbegincharacterstyle}
91
92\func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}
93
94Begins applying the named character style.
95
96\membersection{wxRichTextBuffer::BeginFont}\label{wxrichtextbufferbeginfont}
97
98\func{bool}{BeginFont}{\param{const wxFont\& }{font}}
99
100Begins using this font.
101
102\membersection{wxRichTextBuffer::BeginFontSize}\label{wxrichtextbufferbeginfontsize}
103
104\func{bool}{BeginFontSize}{\param{int }{pointSize}}
105
106Begins using the given point size.
107
108\membersection{wxRichTextBuffer::BeginItalic}\label{wxrichtextbufferbeginitalic}
109
110\func{bool}{BeginItalic}{\void}
111
112Begins using italic.
113
114\membersection{wxRichTextBuffer::BeginLeftIndent}\label{wxrichtextbufferbeginleftindent}
115
116\func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}}
117
118Begin using {\it leftIndent} for the left indent, and optionally {\it leftSubIndent} for
119the sub-indent. Both are expressed in tenths of a millimetre.
120
121The sub-indent is an offset from the left of the paragraph, and is used for all but the
122first line in a paragraph. A positive value will cause the first line to appear to the left
123of the subsequent lines, and a negative value will cause the first line to be indented
124relative to the subsequent lines.
125
126\membersection{wxRichTextBuffer::BeginLineSpacing}\label{wxrichtextbufferbeginlinespacing}
127
128\func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}
129
130Begins line spacing using the specified value. {\it spacing} is a multiple, where 10 means single-spacing,
13115 means 1.5 spacing, and 20 means double spacing. The following constants are
132defined 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
d2d0adc7
JS
142\membersection{wxRichTextBuffer::BeginListStyle}\label{wxrichtextbufferbeginliststyle}
143
144\func{bool}{BeginListStyle}{\param{const wxString\&}{ listStyle}, \param{int}{ level=1}, \param{int}{ number=1}}
145
146Begins using a specified list style. Optionally, you can also pass a level and a number.
147
5f35b46a
JS
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
152Begins a numbered bullet. This call will be needed for each item in the list, and the
153application 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
176wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
177the margin and the bullet. The content of the paragraph, including the first line, starts
178at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
179left 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
185Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
186a millimetre.
187
188\membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle}
189
190\func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
191
192Begins applying the named paragraph style.
193
194\membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent}
195
196\func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
197
198Begins 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
204Begins using a specified style.
205
206\membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo}
207
208\func{bool}{BeginSuppressUndo}{\void}
209
210Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
211differently by each command. If not dealt with by a command implementation, then
212it will be implemented automatically by not storing the command in the undo history
213when the action is submitted to the command processor.
214
d2d0adc7
JS
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
219Begins applying a standard bullet, using one of the standard bullet names (currently {\tt standard/circle} or {\tt standard/square}.
220See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for an explanation of how indentation is used to render the bulleted paragraph.
221
5f35b46a
JS
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
226Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for
227an 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
233Begins using the specified text foreground colour.
234
235\membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline}
236
237\func{bool}{BeginUnderline}{\void}
238
239Begins using underline.
240
d2d0adc7
JS
241\membersection{wxRichTextBuffer::BeginURL}\label{wxrichtextbufferbeginurl}
242
243\func{bool}{BeginURL}{\param{const wxString\&}{ url}, \param{const wxString\&}{ characterStyle = wxEmptyString}}
244
245Begins applying wxTEXT\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
246since it is common to mark a URL with a familiar style such as blue text with underlining.
247
5f35b46a
JS
248\membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard}
249
250\constfunc{bool}{CanPasteFromClipboard}{\void}
251
252Returns \true if content can be pasted from the clipboard.
253
254\membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers}
255
256\func{void}{CleanUpHandlers}{\void}
257
258Cleans up the file handlers.
259
260\membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear}
261
262\func{void}{Clear}{\void}
263
264Clears the buffer and resets the command processor.
265
266\membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack}
267
268\func{void}{ClearStyleStack}{\void}
269
270Clears the style stack.
271
272\membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone}
273
274\constfunc{wxRichTextObject*}{Clone}{\void}
275
276Clones the object.
277
278\membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy}
279
280\func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}}
281
282Copies the given buffer.
283
284\membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard}
285
286\func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}}
287
288Copy 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
294Submits 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
302Dumps the contents of the buffer for debugging purposes.
303
304\membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment}
305
306\func{bool}{EndAlignment}{\void}
307
308Ends alignment.
309
310\membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles}
311
312\func{bool}{EndAllStyles}{\void}
313
314Ends all styles that have been started with a Begin... command.
315
316\membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo}
317
318\func{bool}{EndBatchUndo}{\void}
319
320Ends collapsing undo/redo commands, and submits the combined command.
321
322\membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold}
323
324\func{bool}{EndBold}{\void}
325
326Ends using bold.
327
328\membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle}
329
330\func{bool}{EndCharacterStyle}{\void}
331
332Ends using the named character style.
333
334\membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont}
335
336\func{bool}{EndFont}{\void}
337
338Ends using a font.
339
340\membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize}
341
342\func{bool}{EndFontSize}{\void}
343
344Ends using a point size.
345
346\membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic}
347
348\func{bool}{EndItalic}{\void}
349
350Ends using italic.
351
352\membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent}
353
354\func{bool}{EndLeftIndent}{\void}
355
356Ends using a left indent.
357
358\membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing}
359
360\func{bool}{EndLineSpacing}{\void}
361
362Ends using a line spacing.
363
d2d0adc7
JS
364\membersection{wxRichTextBuffer::EndListStyle}\label{wxrichtextbufferendliststyle}
365
366\func{bool}{EndListStyle}{\void}
367
368Ends using a specified list style.
369
5f35b46a
JS
370\membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet}
371
372\func{bool}{EndNumberedBullet}{\void}
373
374Ends a numbered bullet.
375
376\membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing}
377
378\func{bool}{EndParagraphSpacing}{\void}
379
380Ends paragraph spacing.
381
382\membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle}
383
384\func{bool}{EndParagraphStyle}{\void}
385
386Ends applying a named character style.
387
388\membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent}
389
390\func{bool}{EndRightIndent}{\void}
391
392Ends using a right indent.
393
394\membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle}
395
396\func{bool}{EndStyle}{\void}
397
398Ends the current style.
399
400\membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo}
401
402\func{bool}{EndSuppressUndo}{\void}
403
404Ends suppressing undo/redo commands.
405
406\membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet}
407
408\func{bool}{EndSymbolBullet}{\void}
409
410Ends using a symbol bullet.
411
d2d0adc7
JS
412\membersection{wxRichTextBuffer::EndStandardBullet}\label{wxrichtextbufferendstandardbullet}
413
414\func{bool}{EndStandardBullet}{\void}
415
416Ends using a standard bullet.
417
5f35b46a
JS
418\membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour}
419
420\func{bool}{EndTextColour}{\void}
421
422Ends using a text foreground colour.
423
424\membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline}
425
426\func{bool}{EndUnderline}{\void}
427
428Ends using underline.
429
d2d0adc7
JS
430\membersection{wxRichTextBuffer::EndURL}\label{wxrichtextbufferendurl}
431
432\func{bool}{EndURL}{\void}
433
434Ends applying a URL.
435
5f35b46a
JS
436\membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler}
437
438\func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}}
439
440Finds a handler by type.
441
442\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}}
443
444Finds a handler by extension and type.
445
446\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}}
447
448Finds a handler by name.
449
450\membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype}
451
452\func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}}
453
454Finds a handler by filename or, if supplied, type.
455
62a268cc
JS
456\membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle}
457
458\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void}
459
460Gets the basic (overall) style. This is the style of the whole
461buffer before further styles are applied, unlike the default style, which
462only affects the style currently being applied (for example, setting the default
463style to bold will cause subsequently inserted text to be bold).
464
5f35b46a
JS
465\membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand}
466
467\constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void}
468
469Gets the collapsed command.
470
471\membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor}
472
473\constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
474
475Gets the command processor. A text buffer always creates its own command processor when it is
476initialized.
477
62a268cc
JS
478\membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle}
479
480\constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void}
481
482Returns the current default style, affecting the style currently being applied (for example, setting the default
483style to bold will cause subsequently inserted text to be bold).
484
5f35b46a
JS
485\membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard}
486
487\func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}}
488
489Gets a wildcard incorporating all visible handlers. If {\it types} is present,
490it will be filled with the file type corresponding to each filter. This can be
491used 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
497Returns the list of file handlers.
498
d2d0adc7
JS
499\membersection{wxRichTextBuffer::GetRenderer}\label{wxrichtextbuffergetrenderer}
500
501\func{static wxRichTextRenderer*}{GetRenderer}{\void}
502
503Returns the object to be used to render certain aspects of the content, such as bullets.
504
62a268cc
JS
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
511Gets the attributes at the given position.
512
513This function gets the combined style - that is, the style you see on the screen as a result
514of combining base style, paragraph style and character style attributes. To get the character
515or 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
521This function gets a style representing the common, combined attributes in the given range.
522Attributes which have different values within the specified range will not be included the style
523flags.
524
525The function is used to get the attributes to display in the formatting dialog: the user
526can edit the attributes common to the selection, and optionally specify the values of further
527attributes to be applied uniformly.
528
529To apply the edited attributes, you can use \helpref{SetStyle}{wxrichtextbuffersetstyle} specifying
530the wxRICHTEXT\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different
531from the {\it combined} attributes within the range. So, the user edits the effective, displayed attributes
532for the range, but his choice won't be applied unnecessarily to content. As an example,
533say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The
534combined style is bold, and this is what the user will see on-screen and in the formatting
535dialog. The user now specifies red text, in addition to bold. When applying with
536SetStyle, the content font weight attributes won't be changed to bold because this is already specified
537by the paragraph. However the text colour attributes {\it will} be changed to
538show red.
539
5f35b46a
JS
540\membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet}
541
542\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
543
544Returns 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
550Get the size of the style stack, for example to check correct nesting.
551
62a268cc
JS
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
558Gets the attributes at the given position.
559
560This function gets the {\it uncombined style} - that is, the attributes associated with the
561paragraph or character content, and not necessarily the combined attributes you see on the
562screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextbuffergetstyle}.
563
564If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch
565the paragraph attributes. Otherwise, it will return the character attributes.
566
5f35b46a
JS
567\membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest}
568
569\func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}}
570
571Finds the text position for the given position, putting the position in {\it textPosition} if
572one is found. {\it pt} is in logical units (a zero y position is
573at the beginning of the buffer).
574
575The 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
594Initialisation.
595
596\membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers}
597
598\func{void}{InitStandardHandlers}{\void}
599
600Initialises the standard handlers. Currently, only the plain text loading/saving handler
601is initialised by default.
602
603\membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler}
604
605\func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}}
606
607Inserts 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
613Submits 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
619Submits 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
625Submits a command to insert the given text.
626
627\membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified}
628
629\constfunc{bool}{IsModified}{\void}
630
631Returns \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
637Loads content from a stream.
638
639\func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
640
641Loads content from a file.
642
643\membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify}
644
645\func{void}{Modify}{\param{bool }{modify = true}}
646
647Marks the buffer as modified or unmodified.
648
649\membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard}
650
651\func{bool}{PasteFromClipboard}{\param{long }{position}}
652
653Pastes the clipboard content to the buffer at the given position.
654
d2d0adc7
JS
655\membersection{wxRichTextBuffer::RemoveEventHandler}\label{wxrichtextbufferremoveeventhandler}
656
657\func{bool}{RemoveEventHandler}{\param{wxEvtHandler* }{handler}, \param{bool}{ deleteHandler = false}}
658
659Removes an event handler from the buffer's list of handlers, deleting the object if {\it deleteHandler} is \true.
660
5f35b46a
JS
661\membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler}
662
663\func{bool}{RemoveHandler}{\param{const wxString\& }{name}}
664
665Removes a handler.
666
667\membersection{wxRichTextBuffer::Reset}\label{wxrichtextbufferreset}
668
669\func{void}{Reset}{\void}
670
671The 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
677Saves content to a stream.
678
679\func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
680
681Saves content to a file.
682
62a268cc
JS
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
689Sets the basic (overall) style. This is the style of the whole
690buffer before further styles are applied, unlike the default style, which
691only affects the style currently being applied (for example, setting the default
692style 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
698Sets the default style, affecting the style currently being applied (for example, setting the default
699style to bold will cause subsequently inserted text to be bold).
700
701This is not cumulative - setting the default style will replace the previous default style.
702
d2d0adc7
JS
703\membersection{wxRichTextBuffer::SetRenderer}\label{wxrichtextbuffersetrenderer}
704
705\func{static void}{SetRenderer}{\param{wxRichTextRenderer* }{renderer}}
706
707Sets {\it renderer} as the object to be used to render certain aspects of the content, such as bullets.
708You can override default rendering by deriving a new class from wxRichTextRenderer or wxRichTextStdRenderer,
709overriding one or more virtual functions, and setting an instance of the class using this function.
710
62a268cc
JS
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
717Sets the attributes for the given range, passing flags to determine how the attributes are set.
718
719The end point of range is specified as the last character position of the span of text.
720So, for example, to set the style for a character at position 5, use the range (5,5).
721This 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
5f35b46a
JS
746\membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet}
747
748\func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
749
750Sets the current style sheet, if any. This will allow the application to use
751named 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
757Submit 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
763Returns \true if undo suppression is currently on.
764