]>
Commit | Line | Data |
---|---|---|
5f35b46a JS |
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::AddHandler}\label{wxrichtextbufferaddhandler} | |
38 | ||
39 | \func{void}{AddHandler}{\param{wxRichTextFileHandler* }{handler}} | |
40 | ||
41 | Adds a file handler. | |
42 | ||
43 | \membersection{wxRichTextBuffer::AddParagraph}\label{wxrichtextbufferaddparagraph} | |
44 | ||
45 | \func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}} | |
46 | ||
47 | Adds a paragraph of text. | |
48 | ||
49 | \membersection{wxRichTextBuffer::BatchingUndo}\label{wxrichtextbufferbatchingundo} | |
50 | ||
51 | \constfunc{bool}{BatchingUndo}{\void} | |
52 | ||
53 | Returns \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 | ||
59 | Begins using alignment. | |
60 | ||
61 | \membersection{wxRichTextBuffer::BeginBatchUndo}\label{wxrichtextbufferbeginbatchundo} | |
62 | ||
63 | \func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}} | |
64 | ||
65 | Begins collapsing undo/redo commands. Note that this may not work properly | |
66 | if combining commands that delete or insert content, changing ranges for | |
67 | subsequent actions. | |
68 | ||
69 | {\it cmdName} should be the name of the combined command that will appear | |
70 | next to Undo and Redo in the edit menu. | |
71 | ||
72 | \membersection{wxRichTextBuffer::BeginBold}\label{wxrichtextbufferbeginbold} | |
73 | ||
74 | \func{bool}{BeginBold}{\void} | |
75 | ||
76 | Begin applying bold. | |
77 | ||
78 | \membersection{wxRichTextBuffer::BeginCharacterStyle}\label{wxrichtextbufferbegincharacterstyle} | |
79 | ||
80 | \func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}} | |
81 | ||
82 | Begins applying the named character style. | |
83 | ||
84 | \membersection{wxRichTextBuffer::BeginFont}\label{wxrichtextbufferbeginfont} | |
85 | ||
86 | \func{bool}{BeginFont}{\param{const wxFont\& }{font}} | |
87 | ||
88 | Begins using this font. | |
89 | ||
90 | \membersection{wxRichTextBuffer::BeginFontSize}\label{wxrichtextbufferbeginfontsize} | |
91 | ||
92 | \func{bool}{BeginFontSize}{\param{int }{pointSize}} | |
93 | ||
94 | Begins using the given point size. | |
95 | ||
96 | \membersection{wxRichTextBuffer::BeginItalic}\label{wxrichtextbufferbeginitalic} | |
97 | ||
98 | \func{bool}{BeginItalic}{\void} | |
99 | ||
100 | Begins using italic. | |
101 | ||
102 | \membersection{wxRichTextBuffer::BeginLeftIndent}\label{wxrichtextbufferbeginleftindent} | |
103 | ||
104 | \func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}} | |
105 | ||
106 | Begin using {\it leftIndent} for the left indent, and optionally {\it leftSubIndent} for | |
107 | the sub-indent. Both are expressed in tenths of a millimetre. | |
108 | ||
109 | The sub-indent is an offset from the left of the paragraph, and is used for all but the | |
110 | first line in a paragraph. A positive value will cause the first line to appear to the left | |
111 | of the subsequent lines, and a negative value will cause the first line to be indented | |
112 | relative to the subsequent lines. | |
113 | ||
114 | \membersection{wxRichTextBuffer::BeginLineSpacing}\label{wxrichtextbufferbeginlinespacing} | |
115 | ||
116 | \func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}} | |
117 | ||
118 | Begins line spacing using the specified value. {\it spacing} is a multiple, where 10 means single-spacing, | |
119 | 15 means 1.5 spacing, and 20 means double spacing. The following constants are | |
120 | defined 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 | ||
134 | Begins a numbered bullet. This call will be needed for each item in the list, and the | |
135 | application 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 | ||
158 | wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between | |
159 | the margin and the bullet. The content of the paragraph, including the first line, starts | |
160 | at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the | |
161 | left 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 | ||
167 | Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of | |
168 | a millimetre. | |
169 | ||
170 | \membersection{wxRichTextBuffer::BeginParagraphStyle}\label{wxrichtextbufferbeginparagraphstyle} | |
171 | ||
172 | \func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}} | |
173 | ||
174 | Begins applying the named paragraph style. | |
175 | ||
176 | \membersection{wxRichTextBuffer::BeginRightIndent}\label{wxrichtextbufferbeginrightindent} | |
177 | ||
178 | \func{bool}{BeginRightIndent}{\param{int }{rightIndent}} | |
179 | ||
180 | Begins 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 | ||
186 | Begins using a specified style. | |
187 | ||
188 | \membersection{wxRichTextBuffer::BeginSuppressUndo}\label{wxrichtextbufferbeginsuppressundo} | |
189 | ||
190 | \func{bool}{BeginSuppressUndo}{\void} | |
191 | ||
192 | Begins suppressing undo/redo commands. The way undo is suppressed may be implemented | |
193 | differently by each command. If not dealt with by a command implementation, then | |
194 | it will be implemented automatically by not storing the command in the undo history | |
195 | when 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 | ||
201 | Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextbufferbeginnumberedbullet} for | |
202 | an 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 | ||
208 | Begins using the specified text foreground colour. | |
209 | ||
210 | \membersection{wxRichTextBuffer::BeginUnderline}\label{wxrichtextbufferbeginunderline} | |
211 | ||
212 | \func{bool}{BeginUnderline}{\void} | |
213 | ||
214 | Begins using underline. | |
215 | ||
216 | \membersection{wxRichTextBuffer::CanPasteFromClipboard}\label{wxrichtextbuffercanpastefromclipboard} | |
217 | ||
218 | \constfunc{bool}{CanPasteFromClipboard}{\void} | |
219 | ||
220 | Returns \true if content can be pasted from the clipboard. | |
221 | ||
222 | \membersection{wxRichTextBuffer::CleanUpHandlers}\label{wxrichtextbuffercleanuphandlers} | |
223 | ||
224 | \func{void}{CleanUpHandlers}{\void} | |
225 | ||
226 | Cleans up the file handlers. | |
227 | ||
228 | \membersection{wxRichTextBuffer::Clear}\label{wxrichtextbufferclear} | |
229 | ||
230 | \func{void}{Clear}{\void} | |
231 | ||
232 | Clears the buffer and resets the command processor. | |
233 | ||
234 | \membersection{wxRichTextBuffer::ClearStyleStack}\label{wxrichtextbufferclearstylestack} | |
235 | ||
236 | \func{void}{ClearStyleStack}{\void} | |
237 | ||
238 | Clears the style stack. | |
239 | ||
240 | \membersection{wxRichTextBuffer::Clone}\label{wxrichtextbufferclone} | |
241 | ||
242 | \constfunc{wxRichTextObject*}{Clone}{\void} | |
243 | ||
244 | Clones the object. | |
245 | ||
246 | \membersection{wxRichTextBuffer::Copy}\label{wxrichtextbuffercopy} | |
247 | ||
248 | \func{void}{Copy}{\param{const wxRichTextBuffer\& }{obj}} | |
249 | ||
250 | Copies the given buffer. | |
251 | ||
252 | \membersection{wxRichTextBuffer::CopyToClipboard}\label{wxrichtextbuffercopytoclipboard} | |
253 | ||
254 | \func{bool}{CopyToClipboard}{\param{const wxRichTextRange\& }{range}} | |
255 | ||
256 | Copy 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 | ||
262 | Submits 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 | ||
270 | Dumps the contents of the buffer for debugging purposes. | |
271 | ||
272 | \membersection{wxRichTextBuffer::EndAlignment}\label{wxrichtextbufferendalignment} | |
273 | ||
274 | \func{bool}{EndAlignment}{\void} | |
275 | ||
276 | Ends alignment. | |
277 | ||
278 | \membersection{wxRichTextBuffer::EndAllStyles}\label{wxrichtextbufferendallstyles} | |
279 | ||
280 | \func{bool}{EndAllStyles}{\void} | |
281 | ||
282 | Ends all styles that have been started with a Begin... command. | |
283 | ||
284 | \membersection{wxRichTextBuffer::EndBatchUndo}\label{wxrichtextbufferendbatchundo} | |
285 | ||
286 | \func{bool}{EndBatchUndo}{\void} | |
287 | ||
288 | Ends collapsing undo/redo commands, and submits the combined command. | |
289 | ||
290 | \membersection{wxRichTextBuffer::EndBold}\label{wxrichtextbufferendbold} | |
291 | ||
292 | \func{bool}{EndBold}{\void} | |
293 | ||
294 | Ends using bold. | |
295 | ||
296 | \membersection{wxRichTextBuffer::EndCharacterStyle}\label{wxrichtextbufferendcharacterstyle} | |
297 | ||
298 | \func{bool}{EndCharacterStyle}{\void} | |
299 | ||
300 | Ends using the named character style. | |
301 | ||
302 | \membersection{wxRichTextBuffer::EndFont}\label{wxrichtextbufferendfont} | |
303 | ||
304 | \func{bool}{EndFont}{\void} | |
305 | ||
306 | Ends using a font. | |
307 | ||
308 | \membersection{wxRichTextBuffer::EndFontSize}\label{wxrichtextbufferendfontsize} | |
309 | ||
310 | \func{bool}{EndFontSize}{\void} | |
311 | ||
312 | Ends using a point size. | |
313 | ||
314 | \membersection{wxRichTextBuffer::EndItalic}\label{wxrichtextbufferenditalic} | |
315 | ||
316 | \func{bool}{EndItalic}{\void} | |
317 | ||
318 | Ends using italic. | |
319 | ||
320 | \membersection{wxRichTextBuffer::EndLeftIndent}\label{wxrichtextbufferendleftindent} | |
321 | ||
322 | \func{bool}{EndLeftIndent}{\void} | |
323 | ||
324 | Ends using a left indent. | |
325 | ||
326 | \membersection{wxRichTextBuffer::EndLineSpacing}\label{wxrichtextbufferendlinespacing} | |
327 | ||
328 | \func{bool}{EndLineSpacing}{\void} | |
329 | ||
330 | Ends using a line spacing. | |
331 | ||
332 | \membersection{wxRichTextBuffer::EndNumberedBullet}\label{wxrichtextbufferendnumberedbullet} | |
333 | ||
334 | \func{bool}{EndNumberedBullet}{\void} | |
335 | ||
336 | Ends a numbered bullet. | |
337 | ||
338 | \membersection{wxRichTextBuffer::EndParagraphSpacing}\label{wxrichtextbufferendparagraphspacing} | |
339 | ||
340 | \func{bool}{EndParagraphSpacing}{\void} | |
341 | ||
342 | Ends paragraph spacing. | |
343 | ||
344 | \membersection{wxRichTextBuffer::EndParagraphStyle}\label{wxrichtextbufferendparagraphstyle} | |
345 | ||
346 | \func{bool}{EndParagraphStyle}{\void} | |
347 | ||
348 | Ends applying a named character style. | |
349 | ||
350 | \membersection{wxRichTextBuffer::EndRightIndent}\label{wxrichtextbufferendrightindent} | |
351 | ||
352 | \func{bool}{EndRightIndent}{\void} | |
353 | ||
354 | Ends using a right indent. | |
355 | ||
356 | \membersection{wxRichTextBuffer::EndStyle}\label{wxrichtextbufferendstyle} | |
357 | ||
358 | \func{bool}{EndStyle}{\void} | |
359 | ||
360 | Ends the current style. | |
361 | ||
362 | \membersection{wxRichTextBuffer::EndSuppressUndo}\label{wxrichtextbufferendsuppressundo} | |
363 | ||
364 | \func{bool}{EndSuppressUndo}{\void} | |
365 | ||
366 | Ends suppressing undo/redo commands. | |
367 | ||
368 | \membersection{wxRichTextBuffer::EndSymbolBullet}\label{wxrichtextbufferendsymbolbullet} | |
369 | ||
370 | \func{bool}{EndSymbolBullet}{\void} | |
371 | ||
372 | Ends using a symbol bullet. | |
373 | ||
374 | \membersection{wxRichTextBuffer::EndTextColour}\label{wxrichtextbufferendtextcolour} | |
375 | ||
376 | \func{bool}{EndTextColour}{\void} | |
377 | ||
378 | Ends using a text foreground colour. | |
379 | ||
380 | \membersection{wxRichTextBuffer::EndUnderline}\label{wxrichtextbufferendunderline} | |
381 | ||
382 | \func{bool}{EndUnderline}{\void} | |
383 | ||
384 | Ends using underline. | |
385 | ||
386 | \membersection{wxRichTextBuffer::FindHandler}\label{wxrichtextbufferfindhandler} | |
387 | ||
388 | \func{wxRichTextFileHandler*}{FindHandler}{\param{int }{imageType}} | |
389 | ||
390 | Finds a handler by type. | |
391 | ||
392 | \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{extension}, \param{int }{imageType}} | |
393 | ||
394 | Finds a handler by extension and type. | |
395 | ||
396 | \func{wxRichTextFileHandler*}{FindHandler}{\param{const wxString\& }{name}} | |
397 | ||
398 | Finds a handler by name. | |
399 | ||
400 | \membersection{wxRichTextBuffer::FindHandlerFilenameOrType}\label{wxrichtextbufferfindhandlerfilenameortype} | |
401 | ||
402 | \func{wxRichTextFileHandler*}{FindHandlerFilenameOrType}{\param{const wxString\& }{filename}, \param{int }{imageType}} | |
403 | ||
404 | Finds a handler by filename or, if supplied, type. | |
405 | ||
62a268cc JS |
406 | \membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle} |
407 | ||
408 | \constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void} | |
409 | ||
410 | Gets the basic (overall) style. This is the style of the whole | |
411 | buffer before further styles are applied, unlike the default style, which | |
412 | only affects the style currently being applied (for example, setting the default | |
413 | style to bold will cause subsequently inserted text to be bold). | |
414 | ||
5f35b46a JS |
415 | \membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand} |
416 | ||
417 | \constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void} | |
418 | ||
419 | Gets the collapsed command. | |
420 | ||
421 | \membersection{wxRichTextBuffer::GetCommandProcessor}\label{wxrichtextbuffergetcommandprocessor} | |
422 | ||
423 | \constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void} | |
424 | ||
425 | Gets the command processor. A text buffer always creates its own command processor when it is | |
426 | initialized. | |
427 | ||
62a268cc JS |
428 | \membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle} |
429 | ||
430 | \constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void} | |
431 | ||
432 | Returns the current default style, affecting the style currently being applied (for example, setting the default | |
433 | style to bold will cause subsequently inserted text to be bold). | |
434 | ||
5f35b46a JS |
435 | \membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard} |
436 | ||
437 | \func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}} | |
438 | ||
439 | Gets a wildcard incorporating all visible handlers. If {\it types} is present, | |
440 | it will be filled with the file type corresponding to each filter. This can be | |
441 | used to determine the type to pass to \helpref{LoadFile}{wxrichtextbuffergetextwildcard} given a selected filter. | |
442 | ||
443 | \membersection{wxRichTextBuffer::GetHandlers}\label{wxrichtextbuffergethandlers} | |
444 | ||
445 | \func{wxList\&}{GetHandlers}{\void} | |
446 | ||
447 | Returns the list of file handlers. | |
448 | ||
62a268cc JS |
449 | \membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle} |
450 | ||
451 | \func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} | |
452 | ||
453 | \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} | |
454 | ||
455 | Gets the attributes at the given position. | |
456 | ||
457 | This function gets the combined style - that is, the style you see on the screen as a result | |
458 | of combining base style, paragraph style and character style attributes. To get the character | |
459 | or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextbuffergetuncombinedstyle}. | |
460 | ||
461 | \membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange} | |
462 | ||
463 | \func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}} | |
464 | ||
465 | This function gets a style representing the common, combined attributes in the given range. | |
466 | Attributes which have different values within the specified range will not be included the style | |
467 | flags. | |
468 | ||
469 | The function is used to get the attributes to display in the formatting dialog: the user | |
470 | can edit the attributes common to the selection, and optionally specify the values of further | |
471 | attributes to be applied uniformly. | |
472 | ||
473 | To apply the edited attributes, you can use \helpref{SetStyle}{wxrichtextbuffersetstyle} specifying | |
474 | the wxRICHTEXT\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different | |
475 | from the {\it combined} attributes within the range. So, the user edits the effective, displayed attributes | |
476 | for the range, but his choice won't be applied unnecessarily to content. As an example, | |
477 | say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The | |
478 | combined style is bold, and this is what the user will see on-screen and in the formatting | |
479 | dialog. The user now specifies red text, in addition to bold. When applying with | |
480 | SetStyle, the content font weight attributes won't be changed to bold because this is already specified | |
481 | by the paragraph. However the text colour attributes {\it will} be changed to | |
482 | show red. | |
483 | ||
5f35b46a JS |
484 | \membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet} |
485 | ||
486 | \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} | |
487 | ||
488 | Returns the current style sheet associated with the buffer, if any. | |
489 | ||
490 | \membersection{wxRichTextBuffer::GetStyleStackSize}\label{wxrichtextbuffergetstylestacksize} | |
491 | ||
492 | \constfunc{size\_t}{GetStyleStackSize}{\void} | |
493 | ||
494 | Get the size of the style stack, for example to check correct nesting. | |
495 | ||
62a268cc JS |
496 | \membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle} |
497 | ||
498 | \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} | |
499 | ||
500 | \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} | |
501 | ||
502 | Gets the attributes at the given position. | |
503 | ||
504 | This function gets the {\it uncombined style} - that is, the attributes associated with the | |
505 | paragraph or character content, and not necessarily the combined attributes you see on the | |
506 | screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextbuffergetstyle}. | |
507 | ||
508 | If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch | |
509 | the paragraph attributes. Otherwise, it will return the character attributes. | |
510 | ||
5f35b46a JS |
511 | \membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest} |
512 | ||
513 | \func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}} | |
514 | ||
515 | Finds the text position for the given position, putting the position in {\it textPosition} if | |
516 | one is found. {\it pt} is in logical units (a zero y position is | |
517 | at the beginning of the buffer). | |
518 | ||
519 | The function returns one of the following values: | |
520 | ||
521 | {\small | |
522 | \begin{verbatim} | |
523 | // The point was not on this object | |
524 | #define wxRICHTEXT_HITTEST_NONE 0x01 | |
525 | // The point was before the position returned from HitTest | |
526 | #define wxRICHTEXT_HITTEST_BEFORE 0x02 | |
527 | // The point was after the position returned from HitTest | |
528 | #define wxRICHTEXT_HITTEST_AFTER 0x04 | |
529 | // The point was on the position returned from HitTest | |
530 | #define wxRICHTEXT_HITTEST_ON 0x08 | |
531 | \end{verbatim} | |
532 | } | |
533 | ||
534 | \membersection{wxRichTextBuffer::Init}\label{wxrichtextbufferinit} | |
535 | ||
536 | \func{void}{Init}{\void} | |
537 | ||
538 | Initialisation. | |
539 | ||
540 | \membersection{wxRichTextBuffer::InitStandardHandlers}\label{wxrichtextbufferinitstandardhandlers} | |
541 | ||
542 | \func{void}{InitStandardHandlers}{\void} | |
543 | ||
544 | Initialises the standard handlers. Currently, only the plain text loading/saving handler | |
545 | is initialised by default. | |
546 | ||
547 | \membersection{wxRichTextBuffer::InsertHandler}\label{wxrichtextbufferinserthandler} | |
548 | ||
549 | \func{void}{InsertHandler}{\param{wxRichTextFileHandler* }{handler}} | |
550 | ||
551 | Inserts a handler at the front of the list. | |
552 | ||
553 | \membersection{wxRichTextBuffer::InsertImageWithUndo}\label{wxrichtextbufferinsertimagewithundo} | |
554 | ||
555 | \func{bool}{InsertImageWithUndo}{\param{long }{pos}, \param{const wxRichTextImageBlock\& }{imageBlock}, \param{wxRichTextCtrl* }{ctrl}} | |
556 | ||
557 | Submits a command to insert the given image. | |
558 | ||
559 | \membersection{wxRichTextBuffer::InsertNewlineWithUndo}\label{wxrichtextbufferinsertnewlinewithundo} | |
560 | ||
561 | \func{bool}{InsertNewlineWithUndo}{\param{long }{pos}, \param{wxRichTextCtrl* }{ctrl}} | |
562 | ||
563 | Submits a command to insert a newline. | |
564 | ||
565 | \membersection{wxRichTextBuffer::InsertTextWithUndo}\label{wxrichtextbufferinserttextwithundo} | |
566 | ||
567 | \func{bool}{InsertTextWithUndo}{\param{long }{pos}, \param{const wxString\& }{text}, \param{wxRichTextCtrl* }{ctrl}} | |
568 | ||
569 | Submits a command to insert the given text. | |
570 | ||
571 | \membersection{wxRichTextBuffer::IsModified}\label{wxrichtextbufferismodified} | |
572 | ||
573 | \constfunc{bool}{IsModified}{\void} | |
574 | ||
575 | Returns \true if the buffer has been modified. | |
576 | ||
577 | \membersection{wxRichTextBuffer::LoadFile}\label{wxrichtextbufferloadfile} | |
578 | ||
579 | \func{bool}{LoadFile}{\param{wxInputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}} | |
580 | ||
581 | Loads content from a stream. | |
582 | ||
583 | \func{bool}{LoadFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}} | |
584 | ||
585 | Loads content from a file. | |
586 | ||
587 | \membersection{wxRichTextBuffer::Modify}\label{wxrichtextbuffermodify} | |
588 | ||
589 | \func{void}{Modify}{\param{bool }{modify = true}} | |
590 | ||
591 | Marks the buffer as modified or unmodified. | |
592 | ||
593 | \membersection{wxRichTextBuffer::PasteFromClipboard}\label{wxrichtextbufferpastefromclipboard} | |
594 | ||
595 | \func{bool}{PasteFromClipboard}{\param{long }{position}} | |
596 | ||
597 | Pastes the clipboard content to the buffer at the given position. | |
598 | ||
599 | \membersection{wxRichTextBuffer::RemoveHandler}\label{wxrichtextbufferremovehandler} | |
600 | ||
601 | \func{bool}{RemoveHandler}{\param{const wxString\& }{name}} | |
602 | ||
603 | Removes a handler. | |
604 | ||
605 | \membersection{wxRichTextBuffer::Reset}\label{wxrichtextbufferreset} | |
606 | ||
607 | \func{void}{Reset}{\void} | |
608 | ||
609 | The same as \helpref{Clear}{wxrichtextbufferclear}, plus an empty paragraph is added. | |
610 | ||
611 | \membersection{wxRichTextBuffer::SaveFile}\label{wxrichtextbuffersavefile} | |
612 | ||
613 | \func{bool}{SaveFile}{\param{wxOutputStream\& }{stream}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}} | |
614 | ||
615 | Saves content to a stream. | |
616 | ||
617 | \func{bool}{SaveFile}{\param{const wxString\& }{filename}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}} | |
618 | ||
619 | Saves content to a file. | |
620 | ||
62a268cc JS |
621 | \membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle} |
622 | ||
623 | \func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} | |
624 | ||
625 | \func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}} | |
626 | ||
627 | Sets the basic (overall) style. This is the style of the whole | |
628 | buffer before further styles are applied, unlike the default style, which | |
629 | only affects the style currently being applied (for example, setting the default | |
630 | style to bold will cause subsequently inserted text to be bold). | |
631 | ||
632 | \membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle} | |
633 | ||
634 | \func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}} | |
635 | ||
636 | Sets the default style, affecting the style currently being applied (for example, setting the default | |
637 | style to bold will cause subsequently inserted text to be bold). | |
638 | ||
639 | This is not cumulative - setting the default style will replace the previous default style. | |
640 | ||
641 | \membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle} | |
642 | ||
643 | \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} | |
644 | ||
645 | \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} | |
646 | ||
647 | Sets the attributes for the given range, passing flags to determine how the attributes are set. | |
648 | ||
649 | The end point of range is specified as the last character position of the span of text. | |
650 | So, for example, to set the style for a character at position 5, use the range (5,5). | |
651 | This differs from the wxRichTextCtrl API, where you would specify (5,6). | |
652 | ||
653 | {\it flags} may contain a bit list of the following values: | |
654 | ||
655 | \begin{verbatim} | |
656 | #define wxRICHTEXT_SETSTYLE_NONE 0x00 | |
657 | ||
658 | // Specifies that this operation should be undoable | |
659 | #define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 | |
660 | ||
661 | // Specifies that the style should not be applied if the | |
662 | // combined style at this point is already the style in question. | |
663 | #define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 | |
664 | ||
665 | // Specifies that the style should only be applied to paragraphs, | |
666 | // and not the content. This allows content styling to be | |
667 | // preserved independently from that of e.g. a named paragraph style. | |
668 | #define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 | |
669 | ||
670 | // Specifies that the style should only be applied to characters, | |
671 | // and not the paragraph. This allows content styling to be | |
672 | // preserved independently from that of e.g. a named paragraph style. | |
673 | #define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 | |
674 | \end{verbatim} | |
675 | ||
5f35b46a JS |
676 | \membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet} |
677 | ||
678 | \func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}} | |
679 | ||
680 | Sets the current style sheet, if any. This will allow the application to use | |
681 | named character and paragraph styles found in the style sheet. | |
682 | ||
683 | \membersection{wxRichTextBuffer::SubmitAction}\label{wxrichtextbuffersubmitaction} | |
684 | ||
685 | \func{bool}{SubmitAction}{\param{wxRichTextAction* }{action}} | |
686 | ||
687 | Submit an action immediately, or delay it according to whether collapsing is on. | |
688 | ||
689 | \membersection{wxRichTextBuffer::SuppressingUndo}\label{wxrichtextbuffersuppressingundo} | |
690 | ||
691 | \constfunc{bool}{SuppressingUndo}{\void} | |
692 | ||
693 | Returns \true if undo suppression is currently on. | |
694 |