]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/richtextbuffer.tex
wxAnimationCtrl cleanup
[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
37\membersection{wxRichTextBuffer::AddHandler}\label{wxrichtextbufferaddhandler}
38
39\func{void}{AddHandler}{\param{wxRichTextFileHandler* }{handler}}
40
41Adds a file handler.
42
43\membersection{wxRichTextBuffer::AddParagraph}\label{wxrichtextbufferaddparagraph}
44
45\func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}
46
47Adds a paragraph of text.
48
49\membersection{wxRichTextBuffer::BatchingUndo}\label{wxrichtextbufferbatchingundo}
50
51\constfunc{bool}{BatchingUndo}{\void}
52
53Returns \true if the buffer is currently collapsing commands into a single notional command.
54
55\membersection{wxRichTextBuffer::BeginAlignment}\label{wxrichtextbufferbeginalignment}
56
57\func{bool}{BeginAlignment}{\param{wxTextAttrAlignment }{alignment}}
58
59Begins using alignment.
60
61\membersection{wxRichTextBuffer::BeginBatchUndo}\label{wxrichtextbufferbeginbatchundo}
62
63\func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}
64
65Begins collapsing undo/redo commands. Note that this may not work properly
66if combining commands that delete or insert content, changing ranges for
67subsequent actions.
68
69{\it cmdName} should be the name of the combined command that will appear
70next to Undo and Redo in the edit menu.
71
72\membersection{wxRichTextBuffer::BeginBold}\label{wxrichtextbufferbeginbold}
73
74\func{bool}{BeginBold}{\void}
75
76Begin applying bold.
77
78\membersection{wxRichTextBuffer::BeginCharacterStyle}\label{wxrichtextbufferbegincharacterstyle}
79
80\func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}
81
82Begins applying the named character style.
83
84\membersection{wxRichTextBuffer::BeginFont}\label{wxrichtextbufferbeginfont}
85
86\func{bool}{BeginFont}{\param{const wxFont\& }{font}}
87
88Begins using this font.
89
90\membersection{wxRichTextBuffer::BeginFontSize}\label{wxrichtextbufferbeginfontsize}
91
92\func{bool}{BeginFontSize}{\param{int }{pointSize}}
93
94Begins using the given point size.
95
96\membersection{wxRichTextBuffer::BeginItalic}\label{wxrichtextbufferbeginitalic}
97
98\func{bool}{BeginItalic}{\void}
99
100Begins using italic.
101
102\membersection{wxRichTextBuffer::BeginLeftIndent}\label{wxrichtextbufferbeginleftindent}
103
104\func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}}
105
106Begin using {\it leftIndent} for the left indent, and optionally {\it leftSubIndent} for
107the sub-indent. Both are expressed in tenths of a millimetre.
108
109The sub-indent is an offset from the left of the paragraph, and is used for all but the
110first line in a paragraph. A positive value will cause the first line to appear to the left
111of the subsequent lines, and a negative value will cause the first line to be indented
112relative to the subsequent lines.
113
114\membersection{wxRichTextBuffer::BeginLineSpacing}\label{wxrichtextbufferbeginlinespacing}
115
116\func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}
117
118Begins line spacing using the specified value. {\it spacing} is a multiple, where 10 means single-spacing,
11915 means 1.5 spacing, and 20 means double spacing. The following constants are
120defined for convenience:
121
122{\small
123\begin{verbatim}
124#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
125#define wxTEXT_ATTR_LINE_SPACING_HALF 15
126#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
127\end{verbatim}
128}
129
130\membersection{wxRichTextBuffer::BeginNumberedBullet}\label{wxrichtextbufferbeginnumberedbullet}
131
132\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}}
133
134Begins a numbered bullet. This call will be needed for each item in the list, and the
135application should take care of incrementing the numbering.
136
137{\it bulletNumber} is a number, usually starting with 1.
138
139{\it leftIndent} and {\it leftSubIndent} are values in tenths of a millimetre.
140
141{\it bulletStyle} is a bitlist of the following values:
142
143{\small
144\begin{verbatim}
145#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x0000
146#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x0001
147#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x0002
148#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x0004
149#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x0008
150#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x0010
151#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x0020
152#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x0040
153#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x0080
154#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x0100
155\end{verbatim}
156}
157
158wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
159the margin and the bullet. The content of the paragraph, including the first line, starts
160at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
161left of the actual paragraph is leftSubIndent.
162
163\membersection{wxRichTextBuffer::BeginParagraphSpacing}\label{wxrichtextbufferbeginparagraphspacing}
164
165\func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}
166
167Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
168a millimetre.
169
170\membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle}
171
172\func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
173
174Begins applying the named paragraph style.
175
176\membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent}
177
178\func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
179
180Begins a right indent, specified in tenths of a millimetre.
181
182\membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle}
183
184\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}
185
186Begins using a specified style.
187
188\membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo}
189
190\func{bool}{BeginSuppressUndo}{\void}
191
192Begins suppressing undo/redo commands. The way undo is suppressed may be implemented
193differently by each command. If not dealt with by a command implementation, then
194it will be implemented automatically by not storing the command in the undo history
195when the action is submitted to the command processor.
196
197\membersection{wxRichTextBuffer::BeginSymbolBullet}\label{wxrichtextbufferbeginsymbolbullet}
198
199\func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}
200
201Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for
202an explanation of how indentation is used to render the bulleted paragraph.
203
204\membersection{wxRichTextBuffer::BeginTextColour}\label{wxrichtextbufferbegintextcolour}
205
206\func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}
207
208Begins using the specified text foreground colour.
209
210\membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline}
211
212\func{bool}{BeginUnderline}{\void}
213
214Begins using underline.
215
216\membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard}
217
218\constfunc{bool}{CanPasteFromClipboard}{\void}
219
220Returns \true if content can be pasted from the clipboard.
221
222\membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers}
223
224\func{void}{CleanUpHandlers}{\void}
225
226Cleans up the file handlers.
227
228\membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear}
229
230\func{void}{Clear}{\void}
231
232Clears the buffer and resets the command processor.
233
234\membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack}
235
236\func{void}{ClearStyleStack}{\void}
237
238Clears the style stack.
239
240\membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone}
241
242\constfunc{wxRichTextObject*}{Clone}{\void}
243
244Clones the object.
245
246\membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy}
247
248\func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}}
249
250Copies the given buffer.
251
252\membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard}
253
254\func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}}
255
256Copy the given range to the clipboard.
257
258\membersection{wxRichTextBuffer::DeleteRangeWithUndo}\label{wxrichtextbufferdeleterangewithundo}
259
260\func{bool}{DeleteRangeWithUndo}{\param{const wxRichTextRange\& }{range}, \param{long }{initialCaretPosition}, \param{long }{newCaretPositon}, \param{wxRichTextCtrl* }{ctrl}}
261
262Submits a command to delete the given range.
263
264\membersection{wxRichTextBuffer::Dump}\label{wxrichtextbufferdump}
265
266\func{void}{Dump}{\void}
267
268\func{void}{Dump}{\param{wxTextOutputStream\& }{stream}}
269
270Dumps the contents of the buffer for debugging purposes.
271
272\membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment}
273
274\func{bool}{EndAlignment}{\void}
275
276Ends alignment.
277
278\membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles}
279
280\func{bool}{EndAllStyles}{\void}
281
282Ends all styles that have been started with a Begin... command.
283
284\membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo}
285
286\func{bool}{EndBatchUndo}{\void}
287
288Ends collapsing undo/redo commands, and submits the combined command.
289
290\membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold}
291
292\func{bool}{EndBold}{\void}
293
294Ends using bold.
295
296\membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle}
297
298\func{bool}{EndCharacterStyle}{\void}
299
300Ends using the named character style.
301
302\membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont}
303
304\func{bool}{EndFont}{\void}
305
306Ends using a font.
307
308\membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize}
309
310\func{bool}{EndFontSize}{\void}
311
312Ends using a point size.
313
314\membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic}
315
316\func{bool}{EndItalic}{\void}
317
318Ends using italic.
319
320\membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent}
321
322\func{bool}{EndLeftIndent}{\void}
323
324Ends using a left indent.
325
326\membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing}
327
328\func{bool}{EndLineSpacing}{\void}
329
330Ends using a line spacing.
331
332\membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet}
333
334\func{bool}{EndNumberedBullet}{\void}
335
336Ends a numbered bullet.
337
338\membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing}
339
340\func{bool}{EndParagraphSpacing}{\void}
341
342Ends paragraph spacing.
343
344\membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle}
345
346\func{bool}{EndParagraphStyle}{\void}
347
348Ends applying a named character style.
349
350\membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent}
351
352\func{bool}{EndRightIndent}{\void}
353
354Ends using a right indent.
355
356\membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle}
357
358\func{bool}{EndStyle}{\void}
359
360Ends the current style.
361
362\membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo}
363
364\func{bool}{EndSuppressUndo}{\void}
365
366Ends suppressing undo/redo commands.
367
368\membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet}
369
370\func{bool}{EndSymbolBullet}{\void}
371
372Ends using a symbol bullet.
373
374\membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour}
375
376\func{bool}{EndTextColour}{\void}
377
378Ends using a text foreground colour.
379
380\membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline}
381
382\func{bool}{EndUnderline}{\void}
383
384Ends using underline.
385
386\membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler}
387
388\func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}}
389
390Finds a handler by type.
391
392\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}}
393
394Finds a handler by extension and type.
395
396\func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}}
397
398Finds a handler by name.
399
400\membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype}
401
402\func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}}
403
404Finds a handler by filename or, if supplied, type.
405
406\membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand}
407
408\constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void}
409
410Gets the collapsed command.
411
412\membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor}
413
414\constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
415
416Gets the command processor. A text buffer always creates its own command processor when it is
417initialized.
418
419\membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard}
420
421\func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}}
422
423Gets a wildcard incorporating all visible handlers. If {\it types} is present,
424it will be filled with the file type corresponding to each filter. This can be
425used to determine the type to pass to \helpref{LoadFile}{wxrichtextbuffergetextwildcard} given a selected filter.
426
427\membersection{wxRichTextBuffer::GetHandlers}\label{wxrichtextbuffergethandlers}
428
429\func{wxList\&}{GetHandlers}{\void}
430
431Returns the list of file handlers.
432
433\membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet}
434
435\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
436
437Returns the current style sheet associated with the buffer, if any.
438
439\membersection{wxRichTextBuffer::GetStyleStackSize}\label{wxrichtextbuffergetstylestacksize}
440
441\constfunc{size\_t}{GetStyleStackSize}{\void}
442
443Get the size of the style stack, for example to check correct nesting.
444
445\membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest}
446
447\func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}}
448
449Finds the text position for the given position, putting the position in {\it textPosition} if
450one is found. {\it pt} is in logical units (a zero y position is
451at the beginning of the buffer).
452
453The function returns one of the following values:
454
455{\small
456\begin{verbatim}
457// The point was not on this object
458#define wxRICHTEXT_HITTEST_NONE 0x01
459// The point was before the position returned from HitTest
460#define wxRICHTEXT_HITTEST_BEFORE 0x02
461// The point was after the position returned from HitTest
462#define wxRICHTEXT_HITTEST_AFTER 0x04
463// The point was on the position returned from HitTest
464#define wxRICHTEXT_HITTEST_ON 0x08
465\end{verbatim}
466}
467
468\membersection{wxRichTextBuffer::Init}\label{wxrichtextbufferinit}
469
470\func{void}{Init}{\void}
471
472Initialisation.
473
474\membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers}
475
476\func{void}{InitStandardHandlers}{\void}
477
478Initialises the standard handlers. Currently, only the plain text loading/saving handler
479is initialised by default.
480
481\membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler}
482
483\func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}}
484
485Inserts a handler at the front of the list.
486
487\membersection{wxRichTextBuffer::InsertImageWithUndo}\label{wxrichtextbufferinsertimagewithundo}
488
489\func{bool}{InsertImageWithUndo}{\param{long }{pos}, \param{const wxRichTextImageBlock\& }{imageBlock}, \param{wxRichTextCtrl* }{ctrl}}
490
491Submits a command to insert the given image.
492
493\membersection{wxRichTextBuffer::InsertNewlineWithUndo}\label{wxrichtextbufferinsertnewlinewithundo}
494
495\func{bool}{InsertNewlineWithUndo}{\param{long }{pos}, \param{wxRichTextCtrl* }{ctrl}}
496
497Submits a command to insert a newline.
498
499\membersection{wxRichTextBuffer::InsertTextWithUndo}\label{wxrichtextbufferinserttextwithundo}
500
501\func{bool}{InsertTextWithUndo}{\param{long }{pos}, \param{const wxString\& }{text}, \param{wxRichTextCtrl* }{ctrl}}
502
503Submits a command to insert the given text.
504
505\membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified}
506
507\constfunc{bool}{IsModified}{\void}
508
509Returns \true if the buffer has been modified.
510
511\membersection{wxRichTextBuffer::LoadFile}\label{wxrichtextbufferloadfile}
512
513\func{bool}{LoadFile}{\param{wxInputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
514
515Loads content from a stream.
516
517\func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
518
519Loads content from a file.
520
521\membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify}
522
523\func{void}{Modify}{\param{bool }{modify = true}}
524
525Marks the buffer as modified or unmodified.
526
527\membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard}
528
529\func{bool}{PasteFromClipboard}{\param{long }{position}}
530
531Pastes the clipboard content to the buffer at the given position.
532
533\membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler}
534
535\func{bool}{RemoveHandler}{\param{const wxString\& }{name}}
536
537Removes a handler.
538
539\membersection{wxRichTextBuffer::Reset}\label{wxrichtextbufferreset}
540
541\func{void}{Reset}{\void}
542
543The same as \helpref{Clear}{wxrichtextbufferclear}, plus an empty paragraph is added.
544
545\membersection{wxRichTextBuffer::SaveFile}\label{wxrichtextbuffersavefile}
546
547\func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
548
549Saves content to a stream.
550
551\func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
552
553Saves content to a file.
554
555\membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet}
556
557\func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
558
559Sets the current style sheet, if any. This will allow the application to use
560named character and paragraph styles found in the style sheet.
561
562\membersection{wxRichTextBuffer::SubmitAction}\label{wxrichtextbuffersubmitaction}
563
564\func{bool}{SubmitAction}{\param{wxRichTextAction* }{action}}
565
566Submit an action immediately, or delay it according to whether collapsing is on.
567
568\membersection{wxRichTextBuffer::SuppressingUndo}\label{wxrichtextbuffersuppressingundo}
569
570\constfunc{bool}{SuppressingUndo}{\void}
571
572Returns \true if undo suppression is currently on.
573