]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/richtextctrl.tex
On Mac, when selection is drawn in grey (i.e. unfocused), text color needs to be...
[wxWidgets.git] / docs / latex / wx / richtextctrl.tex
CommitLineData
5f35b46a
JS
1\section{\class{wxRichTextCtrl}}\label{wxrichtextctrl}
2
3wxRichTextCtrl provides a generic, ground-up implementation of a text control
4capable of showing multiple styles and images.
5
6\wxheading{Derived from}
7
8wxTextCtrlBase
9
10\wxheading{Include files}
11
12<wx/richtext/richtextctrl.h>
13
14\wxheading{Data structures}
15
16\latexignore{\rtfignore{\wxheading{Members}}}
17
18\membersection{wxRichTextCtrl::wxRichTextCtrl}\label{wxrichtextctrlwxrichtextctrl}
19
20\func{}{wxRichTextCtrl}{\void}
21
27b12131 22\func{}{wxRichTextCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{value = wxEmptyString}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxRE\_MULTILINE}}
5f35b46a
JS
23
24Constructors.
25
26\membersection{wxRichTextCtrl::\destruct{wxRichTextCtrl}}\label{wxrichtextctrldtor}
27
28\func{}{\destruct{wxRichTextCtrl}}{\void}
29
30Destructor.
31
32\membersection{wxRichTextCtrl::AddImage}\label{wxrichtextctrladdimage}
33
34\func{wxRichTextRange}{AddImage}{\param{const wxImage\& }{image}}
35
36Adds an image to the control's buffer.
37
38\membersection{wxRichTextCtrl::AddParagraph}\label{wxrichtextctrladdparagraph}
39
40\func{wxRichTextRange}{AddParagraph}{\param{const wxString\& }{text}}
41
42Adds a new paragraph of text to the end of the buffer.
43
44\membersection{wxRichTextCtrl::AppendText}\label{wxrichtextctrlappendtext}
45
46\func{void}{AppendText}{\param{const wxString\& }{text}}
47
48Sets the insertion point to the end of the buffer and writes the text.
49
50\membersection{wxRichTextCtrl::ApplyAlignmentToSelection}\label{wxrichtextctrlapplyalignmenttoselection}
51
52\func{bool}{ApplyAlignmentToSelection}{\param{wxTextAttrAlignment }{alignment}}
53
54Applies the given alignment to the selection (undoable).
55
56For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}.
57
58\membersection{wxRichTextCtrl::ApplyBoldToSelection}\label{wxrichtextctrlapplyboldtoselection}
59
60\func{bool}{ApplyBoldToSelection}{\void}
61
62Apples bold to the selection (undoable).
63
64\membersection{wxRichTextCtrl::ApplyItalicToSelection}\label{wxrichtextctrlapplyitalictoselection}
65
66\func{bool}{ApplyItalicToSelection}{\void}
67
68Applies italic to the selection (undoable).
69
62a268cc
JS
70\membersection{wxRichTextCtrl::ApplyStyle}\label{wxrichtextctrlapplystyle}
71
72\func{bool}{ApplyStyle}{\param{wxRichTextStyleDefinition*}{ def}}
73
74Applies the given style to the selection.
75
76\membersection{wxRichTextCtrl::ApplyStyleSheet}\label{wxrichtextctrlapplystylesheet}
77
78\func{bool}{ApplyStyleSheet}{\param{wxRichTextStyleSheet*}{ sheet $=$ NULL}}
79
80Applies the style sheet to the buffer, matching paragraph styles in the sheet against named styles
81in the buffer. This might be useful if the styles have changed. If {\it sheet} is NULL, the
82sheet set with SetStyleSheet is used.
83
84Currently this applies paragraph styles only.
85
5f35b46a
JS
86\membersection{wxRichTextCtrl::ApplyUnderlineToSelection}\label{wxrichtextctrlapplyunderlinetoselection}
87
88\func{bool}{ApplyUnderlineToSelection}{\void}
89
90Applies underline to the selection (undoable).
91
92\membersection{wxRichTextCtrl::BatchingUndo}\label{wxrichtextctrlbatchingundo}
93
94\constfunc{bool}{BatchingUndo}{\void}
95
96Returns \true if undo commands are being batched.
97
98\membersection{wxRichTextCtrl::BeginAlignment}\label{wxrichtextctrlbeginalignment}
99
100\func{bool}{BeginAlignment}{\param{wxTextAttrAlignment }{alignment}}
101
102Begins using alignment
103
104For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}.
105
106\membersection{wxRichTextCtrl::BeginBatchUndo}\label{wxrichtextctrlbeginbatchundo}
107
108\func{bool}{BeginBatchUndo}{\param{const wxString\& }{cmdName}}
109
110Starts batching undo history for commands.
111
112\membersection{wxRichTextCtrl::BeginBold}\label{wxrichtextctrlbeginbold}
113
114\func{bool}{BeginBold}{\void}
115
116Begins using bold.
117
118\membersection{wxRichTextCtrl::BeginCharacterStyle}\label{wxrichtextctrlbegincharacterstyle}
119
120\func{bool}{BeginCharacterStyle}{\param{const wxString\& }{characterStyle}}
121
122Begins using the named character style.
123
124\membersection{wxRichTextCtrl::BeginFont}\label{wxrichtextctrlbeginfont}
125
126\func{bool}{BeginFont}{\param{const wxFont\& }{font}}
127
128Begins using this font.
129
130\membersection{wxRichTextCtrl::BeginFontSize}\label{wxrichtextctrlbeginfontsize}
131
132\func{bool}{BeginFontSize}{\param{int }{pointSize}}
133
134Begins using the given point size.
135
136\membersection{wxRichTextCtrl::BeginItalic}\label{wxrichtextctrlbeginitalic}
137
138\func{bool}{BeginItalic}{\void}
139
140Begins using italic.
141
142\membersection{wxRichTextCtrl::BeginLeftIndent}\label{wxrichtextctrlbeginleftindent}
143
144\func{bool}{BeginLeftIndent}{\param{int }{leftIndent}, \param{int }{leftSubIndent = 0}}
145
146Begins applying a left indent and subindent in tenths of a millimetre.
147
148The sub-indent is an offset from the left of the paragraph, and is used for all but the
149first line in a paragraph. A positive value will cause the first line to appear to the left
150of the subsequent lines, and a negative value will cause the first line to be indented
151relative to the subsequent lines.
152
153wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
154the margin and the bullet. The content of the paragraph, including the first line, starts
155at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
156left of the actual paragraph is leftSubIndent.
157
158\membersection{wxRichTextCtrl::BeginLineSpacing}\label{wxrichtextctrlbeginlinespacing}
159
160\func{bool}{BeginLineSpacing}{\param{int }{lineSpacing}}
161
162Begins appling line spacing. {\it spacing} is a multiple, where 10 means single-spacing,
16315 means 1.5 spacing, and 20 means double spacing. The following constants are
164defined for convenience:
165
5f35b46a
JS
166{\small
167\begin{verbatim}
168#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
169#define wxTEXT_ATTR_LINE_SPACING_HALF 15
170#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
171\end{verbatim}
172}
173
d2d0adc7
JS
174\membersection{wxRichTextCtrl::BeginListStyle}\label{wxrichtextctrlbeginliststyle}
175
176\func{bool}{BeginListStyle}{\param{const wxString\&}{ listStyle}, \param{int}{ level=1}, \param{int}{ number=1}}
177
178Begins using a specified list style. Optionally, you can also pass a level and a number.
179
5f35b46a
JS
180\membersection{wxRichTextCtrl::BeginNumberedBullet}\label{wxrichtextctrlbeginnumberedbullet}
181
182\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}}
183
184Begins a numbered bullet. This call will be needed for each item in the list, and the
185application should take care of incrementing the numbering.
186
187{\it bulletNumber} is a number, usually starting with 1.
188
189{\it leftIndent} and {\it leftSubIndent} are values in tenths of a millimetre.
190
191{\it bulletStyle} is a bitlist of the following values:
192
193{\small
194\begin{verbatim}
62f4313b
JS
195#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
196#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
197#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
198#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
199#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
200#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
201#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
202#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
203#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
204#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
205#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
206#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
207#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
208#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
209#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
210#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
5f35b46a
JS
211\end{verbatim}
212}
213
214wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
215the margin and the bullet. The content of the paragraph, including the first line, starts
216at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
217left of the actual paragraph is leftSubIndent.
218
219\membersection{wxRichTextCtrl::BeginParagraphSpacing}\label{wxrichtextctrlbeginparagraphspacing}
220
221\func{bool}{BeginParagraphSpacing}{\param{int }{before}, \param{int }{after}}
222
223Begins paragraph spacing; pass the before-paragraph and after-paragraph spacing in tenths of
224a millimetre.
225
226\membersection{wxRichTextCtrl::BeginParagraphStyle}\label{wxrichtextctrlbeginparagraphstyle}
227
228\func{bool}{BeginParagraphStyle}{\param{const wxString\& }{paragraphStyle}}
229
230Begins applying the named paragraph style.
231
232\membersection{wxRichTextCtrl::BeginRightIndent}\label{wxrichtextctrlbeginrightindent}
233
234\func{bool}{BeginRightIndent}{\param{int }{rightIndent}}
235
236Begins a right indent, specified in tenths of a millimetre.
237
238\membersection{wxRichTextCtrl::BeginStyle}\label{wxrichtextctrlbeginstyle}
239
240\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}}
241
242Begins applying a style.
243
244\membersection{wxRichTextCtrl::BeginSuppressUndo}\label{wxrichtextctrlbeginsuppressundo}
245
246\func{bool}{BeginSuppressUndo}{\void}
247
248Starts suppressing undo history for commands.
249
250\membersection{wxRichTextCtrl::BeginSymbolBullet}\label{wxrichtextctrlbeginsymbolbullet}
251
252\func{bool}{BeginSymbolBullet}{\param{wxChar }{symbol}, \param{int }{leftIndent}, \param{int }{leftSubIndent}, \param{int }{bulletStyle = wxTEXT\_ATTR\_BULLET\_STYLE\_SYMBOL}}
253
254Begins applying a symbol bullet, using a character from the current font. See \helpref{BeginNumberedBullet}{wxrichtextctrlbeginnumberedbullet} for
255an explanation of how indentation is used to render the bulleted paragraph.
256
257\membersection{wxRichTextCtrl::BeginTextColour}\label{wxrichtextctrlbegintextcolour}
258
259\func{bool}{BeginTextColour}{\param{const wxColour\& }{colour}}
260
261Begins using this colour.
262
263\membersection{wxRichTextCtrl::BeginUnderline}\label{wxrichtextctrlbeginunderline}
264
265\func{bool}{BeginUnderline}{\void}
266
267Begins using underlining.
268
d2d0adc7
JS
269\membersection{wxRichTextCtrl::BeginURL}\label{wxrichtextctrlbeginurl}
270
271\func{bool}{BeginURL}{\param{const wxString\&}{ url}, \param{const wxString\&}{ characterStyle = wxEmptyString}}
272
273Begins applying wxTEXT\_ATTR\_URL to the content. Pass a URL and optionally, a character style to apply,
274since it is common to mark a URL with a familiar style such as blue text with underlining.
275
5f35b46a
JS
276\membersection{wxRichTextCtrl::CanCopy}\label{wxrichtextctrlcancopy}
277
278\constfunc{bool}{CanCopy}{\void}
279
280Returns \true if selected content can be copied to the clipboard.
281
282\membersection{wxRichTextCtrl::CanCut}\label{wxrichtextctrlcancut}
283
284\constfunc{bool}{CanCut}{\void}
285
286Returns \true if selected content can be copied to the clipboard and deleted.
287
288\membersection{wxRichTextCtrl::CanDeleteSelection}\label{wxrichtextctrlcandeleteselection}
289
290\constfunc{bool}{CanDeleteSelection}{\void}
291
292Returns \true if selected content can be deleted.
293
294\membersection{wxRichTextCtrl::CanPaste}\label{wxrichtextctrlcanpaste}
295
296\constfunc{bool}{CanPaste}{\void}
297
298Returns \true if the clipboard content can be pasted to the buffer.
299
300\membersection{wxRichTextCtrl::CanRedo}\label{wxrichtextctrlcanredo}
301
302\constfunc{bool}{CanRedo}{\void}
303
304Returns \true if there is a command in the command history that can be redone.
305
306\membersection{wxRichTextCtrl::CanUndo}\label{wxrichtextctrlcanundo}
307
308\constfunc{bool}{CanUndo}{\void}
309
310Returns \true if there is a command in the command history that can be undone.
311
312\membersection{wxRichTextCtrl::Clear}\label{wxrichtextctrlclear}
313
314\func{void}{Clear}{\void}
315
316Clears the buffer content, leaving a single empty paragraph. Cannot be undone.
317
62f4313b
JS
318\membersection{wxRichTextCtrl::ClearListStyle}\label{wxrichtextctrlclearliststyle}
319
320\func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
321
322\func{bool}{ClearListStyle}{\param{const wxRichTextRange\& }{range}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
323
324Clears the list style from the given range, clearing list-related attributes and applying any named paragraph style associated with each paragraph.
325
326{\it flags} is a bit list of the following:
327
328\begin{itemize}\itemsep=0pt
329\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
330\end{itemize}
331
332See also \helpref{wxRichTextCtrl::SetListStyle}{wxrichtextctrlsetliststyle}, \helpref{wxRichTextCtrl::PromoteList}{wxrichtextctrlpromotelist}, \helpref{wxRichTextCtrl::NumberList}{wxrichtextctrlnumberlist}.
333
5f35b46a
JS
334\membersection{wxRichTextCtrl::Command}\label{wxrichtextctrlcommand}
335
336\func{void}{Command}{\param{wxCommandEvent\& }{event}}
337
338Sends the event to the control.
339
340\membersection{wxRichTextCtrl::Copy}\label{wxrichtextctrlcopy}
341
342\func{void}{Copy}{\void}
343
344Copies the selected content (if any) to the clipboard.
345
346\membersection{wxRichTextCtrl::Create}\label{wxrichtextctrlcreate}
347
27b12131 348\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{value = wxEmptyString}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxRE\_MULTILINE}}
5f35b46a
JS
349
350Creates the underlying window.
351
352\membersection{wxRichTextCtrl::Cut}\label{wxrichtextctrlcut}
353
354\func{void}{Cut}{\void}
355
356Copies the selected content (if any) to the clipboard and deletes the selection.
357This is undoable.
358
359\membersection{wxRichTextCtrl::DeleteSelectedContent}\label{wxrichtextctrldeleteselectedcontent}
360
361\func{bool}{DeleteSelectedContent}{\param{long* }{newPos = NULL}}
362
363Deletes content if there is a selection, e.g. when pressing a key.
364Returns the new caret position in {\it newPos}, or leaves it if there
365was no action. This is undoable.
366
367\membersection{wxRichTextCtrl::DeleteSelection}\label{wxrichtextctrldeleteselection}
368
369\func{void}{DeleteSelection}{\void}
370
371Deletes the content in the selection, if any. This is undoable.
372
373\membersection{wxRichTextCtrl::DiscardEdits}\label{wxrichtextctrldiscardedits}
374
375\func{void}{DiscardEdits}{\void}
376
377Sets the buffer's modified status to \false, and clears the buffer's command history.
378
379\membersection{wxRichTextCtrl::DoGetBestSize}\label{wxrichtextctrldogetbestsize}
380
381\constfunc{wxSize}{DoGetBestSize}{\void}
382
383Currently this simply returns {\tt wxSize(10, 10)}.
384
385\membersection{wxRichTextCtrl::EndAlignment}\label{wxrichtextctrlendalignment}
386
387\func{bool}{EndAlignment}{\void}
388
389Ends alignment.
390
391\membersection{wxRichTextCtrl::EndAllStyles}\label{wxrichtextctrlendallstyles}
392
393\func{bool}{EndAllStyles}{\void}
394
395Ends application of all styles in the current style stack.
396
397\membersection{wxRichTextCtrl::EndBatchUndo}\label{wxrichtextctrlendbatchundo}
398
399\func{bool}{EndBatchUndo}{\void}
400
401Ends batching undo command history.
402
403\membersection{wxRichTextCtrl::EndBold}\label{wxrichtextctrlendbold}
404
405\func{bool}{EndBold}{\void}
406
407Ends using bold.
408
409\membersection{wxRichTextCtrl::EndCharacterStyle}\label{wxrichtextctrlendcharacterstyle}
410
411\func{bool}{EndCharacterStyle}{\void}
412
413Ends application of a named character style.
414
415\membersection{wxRichTextCtrl::EndFont}\label{wxrichtextctrlendfont}
416
417\func{bool}{EndFont}{\void}
418
419Ends using a font.
420
421\membersection{wxRichTextCtrl::EndFontSize}\label{wxrichtextctrlendfontsize}
422
423\func{bool}{EndFontSize}{\void}
424
425Ends using a point size.
426
427\membersection{wxRichTextCtrl::EndItalic}\label{wxrichtextctrlenditalic}
428
429\func{bool}{EndItalic}{\void}
430
431Ends using italic.
432
433\membersection{wxRichTextCtrl::EndLeftIndent}\label{wxrichtextctrlendleftindent}
434
435\func{bool}{EndLeftIndent}{\void}
436
437Ends left indent.
438
439\membersection{wxRichTextCtrl::EndLineSpacing}\label{wxrichtextctrlendlinespacing}
440
441\func{bool}{EndLineSpacing}{\void}
442
443Ends line spacing.
444
d2d0adc7
JS
445\membersection{wxRichTextCtrl::EndListStyle}\label{wxrichtextctrlendliststyle}
446
447\func{bool}{EndListStyle}{\void}
448
449Ends using a specified list style.
450
5f35b46a
JS
451\membersection{wxRichTextCtrl::EndNumberedBullet}\label{wxrichtextctrlendnumberedbullet}
452
453\func{bool}{EndNumberedBullet}{\void}
454
455Ends application of a numbered bullet.
456
457\membersection{wxRichTextCtrl::EndParagraphSpacing}\label{wxrichtextctrlendparagraphspacing}
458
459\func{bool}{EndParagraphSpacing}{\void}
460
461Ends paragraph spacing.
462
463\membersection{wxRichTextCtrl::EndParagraphStyle}\label{wxrichtextctrlendparagraphstyle}
464
465\func{bool}{EndParagraphStyle}{\void}
466
467Ends application of a named character style.
468
469\membersection{wxRichTextCtrl::EndRightIndent}\label{wxrichtextctrlendrightindent}
470
471\func{bool}{EndRightIndent}{\void}
472
473Ends right indent.
474
475\membersection{wxRichTextCtrl::EndStyle}\label{wxrichtextctrlendstyle}
476
477\func{bool}{EndStyle}{\void}
478
479Ends the current style.
480
481\membersection{wxRichTextCtrl::EndSuppressUndo}\label{wxrichtextctrlendsuppressundo}
482
483\func{bool}{EndSuppressUndo}{\void}
484
485Ends suppressing undo command history.
486
487\membersection{wxRichTextCtrl::EndSymbolBullet}\label{wxrichtextctrlendsymbolbullet}
488
489\func{bool}{EndSymbolBullet}{\void}
490
491Ends applying a symbol bullet.
492
493\membersection{wxRichTextCtrl::EndTextColour}\label{wxrichtextctrlendtextcolour}
494
495\func{bool}{EndTextColour}{\void}
496
497Ends applying a text colour.
498
499\membersection{wxRichTextCtrl::EndUnderline}\label{wxrichtextctrlendunderline}
500
501\func{bool}{EndUnderline}{\void}
502
503End applying underlining.
504
d2d0adc7
JS
505\membersection{wxRichTextCtrl::EndURL}\label{wxrichtextctrlendurl}
506
507\func{bool}{EndURL}{\void}
508
509Ends applying a URL.
510
5f35b46a
JS
511\membersection{wxRichTextCtrl::ExtendSelection}\label{wxrichtextctrlextendselection}
512
513\func{bool}{ExtendSelection}{\param{long }{oldPosition}, \param{long }{newPosition}, \param{int }{flags}}
514
515Helper function for extending the selection, returning \true if the selection was
516changed. Selections are in caret positions.
517
518\membersection{wxRichTextCtrl::FindNextWordPosition}\label{wxrichtextctrlfindnextwordposition}
519
520\constfunc{long}{FindNextWordPosition}{\param{int }{direction = 1}}
521
522Helper function for finding the caret position for the next word. Direction
523is 1 (forward) or -1 (backwards).
524
525\membersection{wxRichTextCtrl::Freeze}\label{wxrichtextctrlfreeze}
526
527\func{void}{Freeze}{\void}
528
529Call this function to prevent refresh and allow fast updates, and then \helpref{Thaw}{wxrichtextctrlthaw} to
530refresh the control.
531
532\membersection{wxRichTextCtrl::GetBasicStyle}\label{wxrichtextctrlgetbasicstyle}
533
534\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void}
535
536Gets the basic (overall) style. This is the style of the whole
537buffer before further styles are applied, unlike the default style, which
538only affects the style currently being applied (for example, setting the default
539style to bold will cause subsequently inserted text to be bold).
540
541\membersection{wxRichTextCtrl::GetBuffer}\label{wxrichtextctrlgetbuffer}
542
543\constfunc{const wxRichTextBuffer\&}{GetBuffer}{\void}
544
545\func{wxRichTextBuffer\&}{GetBuffer}{\void}
546
547Returns the buffer associated with the control.
548
549\membersection{wxRichTextCtrl::GetCaretPosition}\label{wxrichtextctrlgetcaretposition}
550
551\constfunc{long}{GetCaretPosition}{\void}
552
553Returns the current caret position.
554
555\membersection{wxRichTextCtrl::GetCaretPositionForIndex}\label{wxrichtextctrlgetcaretpositionforindex}
556
557\func{bool}{GetCaretPositionForIndex}{\param{long }{position}, \param{wxRect\& }{rect}}
558
559Returns the caret height and position for the given character position
560
561\membersection{wxRichTextCtrl::GetCommandProcessor}\label{wxrichtextctrlgetcommandprocessor}
562
563\constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}
564
565Gets the command processor associated with the control's buffer.
566
567\membersection{wxRichTextCtrl::GetDefaultStyleEx}\label{wxrichtextctrlgetdefaultstyleex}
568
569\constfunc{const wxTextAttrEx\&}{GetDefaultStyleEx}{\void}
570
571Returns the current default style, which can be used to change how subsequently inserted
572text is displayed. When wxTextAttrEx is merged with wxTextAttr, this function
573will become GetDefaultStyle.
574
575\membersection{wxRichTextCtrl::GetDelayedLayoutThreshold}\label{wxrichtextctrlgetdelayedlayoutthreshold}
576
577\constfunc{long}{GetDelayedLayoutThreshold}{\void}
578
579Gets the size of the buffer beyond which layout is delayed during resizing.
580This optimizes sizing for large buffers. The default is 20000.
581
582\membersection{wxRichTextCtrl::GetFilename}\label{wxrichtextctrlgetfilename}
583
584\constfunc{wxString}{GetFilename}{\void}
585
586Gets the current filename associated with the control.
587
588\membersection{wxRichTextCtrl::GetFirstVisiblePosition}\label{wxrichtextctrlgetfirstvisibleposition}
589
590\constfunc{long}{GetFirstVisiblePosition}{\void}
591
592Returns the first visible position in the current view.
593
594\membersection{wxRichTextCtrl::GetInsertionPoint}\label{wxrichtextctrlgetinsertionpoint}
595
596\constfunc{long}{GetInsertionPoint}{\void}
597
598Returns the current insertion point.
599
600\membersection{wxRichTextCtrl::GetLastPosition}\label{wxrichtextctrlgetlastposition}
601
602\constfunc{wxTextPos}{GetLastPosition}{\void}
603
604Returns the last position in the buffer.
605
606\membersection{wxRichTextCtrl::GetLineLength}\label{wxrichtextctrlgetlinelength}
607
608\constfunc{int}{GetLineLength}{\param{long }{lineNo}}
609
610Returns the length of the specified line in characters.
611
612\membersection{wxRichTextCtrl::GetLineText}\label{wxrichtextctrlgetlinetext}
613
614\constfunc{wxString}{GetLineText}{\param{long }{lineNo}}
615
616Returns the text for the given line.
617
618\membersection{wxRichTextCtrl::GetLogicalPoint}\label{wxrichtextctrlgetlogicalpoint}
619
620\constfunc{wxPoint}{GetLogicalPoint}{\param{const wxPoint\& }{ptPhysical}}
621
622Transforms physical window position to logical (unscrolled) position.
623
624\membersection{wxRichTextCtrl::GetNumberOfLines}\label{wxrichtextctrlgetnumberoflines}
625
626\constfunc{int}{GetNumberOfLines}{\void}
627
628Returns the number of lines in the buffer.
629
630\membersection{wxRichTextCtrl::GetPhysicalPoint}\label{wxrichtextctrlgetphysicalpoint}
631
632\constfunc{wxPoint}{GetPhysicalPoint}{\param{const wxPoint\& }{ptLogical}}
633
634Transforms logical (unscrolled) position to physical window position.
635
636\membersection{wxRichTextCtrl::GetRange}\label{wxrichtextctrlgetrange}
637
638\constfunc{wxString}{GetRange}{\param{long }{from}, \param{long }{to}}
639
640Gets the text for the given range.
641
62a268cc
JS
642The end point of range is specified as the last character position of the span of text, plus one.
643
5f35b46a
JS
644\membersection{wxRichTextCtrl::GetSelection}\label{wxrichtextctrlgetselection}
645
646\constfunc{void}{GetSelection}{\param{long* }{from}, \param{long* }{to}}
647
62a268cc
JS
648Returns the range of the current selection.
649
650The end point of range is specified as the last character position of the span of text, plus one.
651
652If the return values {\it from} and {\it to} are the same, there is no selection.
5f35b46a
JS
653
654\membersection{wxRichTextCtrl::GetSelectionRange}\label{wxrichtextctrlgetselectionrange}
655
656\constfunc{const wxRichTextRange\&}{GetSelectionRange}{\void}
657
658Returns the selection range in character positions. -1, -1 means no selection.
659
660\membersection{wxRichTextCtrl::GetStringSelection}\label{wxrichtextctrlgetstringselection}
661
662\constfunc{wxString}{GetStringSelection}{\void}
663
664Returns the text within the current selection range, if any.
665
666\membersection{wxRichTextCtrl::GetStyle}\label{wxrichtextctrlgetstyle}
667
62a268cc 668\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
5f35b46a 669
62a268cc
JS
670\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
671
672\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
5f35b46a
JS
673
674Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient
675because it does not use wxFont objects.
676
62a268cc
JS
677This function gets the combined style - that is, the style you see on the screen as a result
678of combining base style, paragraph style and character style attributes. To get the character
679or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextctrlgetuncombinedstyle}.
680
5f35b46a
JS
681\membersection{wxRichTextCtrl::GetStyleSheet}\label{wxrichtextctrlgetstylesheet}
682
683\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void}
684
685Returns the style sheet associated with the control, if any. A style sheet allows named
686character and paragraph styles to be applied.
687
62a268cc
JS
688\membersection{wxRichTextCtrl::GetUncombinedStyle}\label{wxrichtextctrlgetuncombinedstyle}
689
690\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
691
692\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
693
694\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
695
696Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient
697because it does not use wxFont objects.
698
699This function gets the {\it uncombined style} - that is, the attributes associated with the
700paragraph or character content, and not necessarily the combined attributes you see on the
701screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextctrlgetstyle}.
702
703If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch
704the paragraph attributes. Otherwise, it will return the character attributes.
705
5f35b46a
JS
706\membersection{wxRichTextCtrl::GetValue}\label{wxrichtextctrlgetvalue}
707
708\constfunc{wxString}{GetValue}{\void}
709
710Returns the content of the entire control as a string.
711
712\membersection{wxRichTextCtrl::GetVisibleLineForCaretPosition}\label{wxrichtextctrlgetvisiblelineforcaretposition}
713
714\constfunc{wxRichTextLine*}{GetVisibleLineForCaretPosition}{\param{long }{caretPosition}}
715
716Internal helper function returning the line for the visible caret position. If the caret is
717shown at the very end of the line, it means the next character is actually
718on the following line. So this function gets the line we're expecting to find
719if this is the case.
720
721\membersection{wxRichTextCtrl::HasCharacterAttributes}\label{wxrichtextctrlhascharacterattributes}
722
723\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}}
724
725\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}}
726
727Test if this whole range has character attributes of the specified kind. If any
728of the attributes are different within the range, the test fails. You
729can use this to implement, for example, bold button updating. {\it style} must have
730flags indicating which attributes are of interest.
731
732\membersection{wxRichTextCtrl::HasParagraphAttributes}\label{wxrichtextctrlhasparagraphattributes}
733
734\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}}
735
736\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}}
737
738Test if this whole range has paragraph attributes of the specified kind. If any
739of the attributes are different within the range, the test fails. You
740can use this to implement, for example, centering button updating. {\it style} must have
741flags indicating which attributes are of interest.
742
743\membersection{wxRichTextCtrl::HasSelection}\label{wxrichtextctrlhasselection}
744
745\constfunc{bool}{HasSelection}{\void}
746
747Returns \true if there is a selection.
748
749\membersection{wxRichTextCtrl::HitTest}\label{wxrichtextctrlhittest}
750
751\constfunc{wxTextCtrlHitTestResult}{HitTest}{\param{const wxPoint\& }{pt}, \param{long* }{pos}}
752
753\constfunc{wxTextCtrlHitTestResult}{HitTest}{\param{const wxPoint\& }{pt}, \param{wxTextCoord* }{col}, \param{wxTextCoord* }{row}}
754
755Finds the character at the given position in pixels.
756
757{\it pt} is in device coords (not adjusted for the client area origin nor for scrolling).
758
759\membersection{wxRichTextCtrl::Init}\label{wxrichtextctrlinit}
760
761\func{void}{Init}{\void}
762
763Initialises the members of the control.
764
765\membersection{wxRichTextCtrl::InitCommandEvent}\label{wxrichtextctrlinitcommandevent}
766
767\constfunc{void}{InitCommandEvent}{\param{wxCommandEvent\& }{event}}
768
769Initialises the command event.
770
62a268cc
JS
771\membersection{wxRichTextCtrl::IsDefaultStyleShowing}\label{wxrichtextctrlisdefaultstyleshowing}
772
773\constfunc{bool}{IsDefaultStyleShowing}{\void}
774
775Returns \true if the user has recently set the default style without moving the caret,
776and therefore the UI needs to reflect the default style and not the style at the caret.
777
778Below is an example of code that uses this function to determine whether the UI
779should show that the current style is bold.
780
781\begin{verbatim}
782/// Is all of the selection bold?
783bool wxRichTextCtrl::IsSelectionBold()
784{
785 if (HasSelection())
786 {
787 wxRichTextAttr attr;
788 wxRichTextRange range = GetInternalSelectionRange();
789 attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
790 attr.SetFontWeight(wxBOLD);
791
792 return HasCharacterAttributes(range, attr);
793 }
794 else
795 {
796 // If no selection, then we need to combine current style with default style
797 // to see what the effect would be if we started typing.
798 wxRichTextAttr attr;
799 attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
800
801 long pos = GetAdjustedCaretPosition(GetCaretPosition());
802 if (GetStyle(pos, attr))
803 {
804 if (IsDefaultStyleShowing())
805 wxRichTextApplyStyle(attr, GetDefaultStyleEx());
806 return attr.GetFontWeight() == wxBOLD;
807 }
808 }
809 return false;
810}
811\end{verbatim}
812
813See also \helpref{SetAndShowDefaultStyle}{wxrichtextctrlsetandshowdefaultstyle}.
814
5f35b46a
JS
815\membersection{wxRichTextCtrl::IsEditable}\label{wxrichtextctrliseditable}
816
817\constfunc{bool}{IsEditable}{\void}
818
819Returns \true if the control is editable.
820
821\membersection{wxRichTextCtrl::IsFrozen}\label{wxrichtextctrlisfrozen}
822
823\constfunc{bool}{IsFrozen}{\void}
824
825Returns \true if Freeze has been called without a Thaw.
826
827\membersection{wxRichTextCtrl::IsModified}\label{wxrichtextctrlismodified}
828
829\constfunc{bool}{IsModified}{\void}
830
831Returns \true if the buffer has been modified.
832
833\membersection{wxRichTextCtrl::IsMultiLine}\label{wxrichtextctrlismultiline}
834
835\constfunc{bool}{IsMultiLine}{\void}
836
837Returns \true if the control is multiline.
838
839\membersection{wxRichTextCtrl::IsPositionVisible}\label{wxrichtextctrlispositionvisible}
840
841\constfunc{bool}{IsPositionVisible}{\param{long }{pos}}
842
843Returns \true if the given position is visible on the screen.
844
845\membersection{wxRichTextCtrl::IsSelectionAligned}\label{wxrichtextctrlisselectionaligned}
846
847\constfunc{bool}{IsSelectionAligned}{\param{wxTextAttrAlignment }{alignment}}
848
849Returns \true if all of the selection is aligned according to the specified flag.
850
851\membersection{wxRichTextCtrl::IsSelectionBold}\label{wxrichtextctrlisselectionbold}
852
853\constfunc{bool}{IsSelectionBold}{\void}
854
855Returns \true if all of the selection is bold.
856
857\membersection{wxRichTextCtrl::IsSelectionItalics}\label{wxrichtextctrlisselectionitalics}
858
859\constfunc{bool}{IsSelectionItalics}{\void}
860
861Returns \true if all of the selection is italic.
862
863\membersection{wxRichTextCtrl::IsSelectionUnderlined}\label{wxrichtextctrlisselectionunderlined}
864
865\constfunc{bool}{IsSelectionUnderlined}{\void}
866
867Returns \true if all of the selection is underlined.
868
869\membersection{wxRichTextCtrl::IsSingleLine}\label{wxrichtextctrlissingleline}
870
871\constfunc{bool}{IsSingleLine}{\void}
872
873Returns \true if the control is single-line. Currently wxRichTextCtrl does not
874support single-line editing.
875
876\membersection{wxRichTextCtrl::KeyboardNavigate}\label{wxrichtextctrlkeyboardnavigate}
877
878\func{bool}{KeyboardNavigate}{\param{int }{keyCode}, \param{int }{flags}}
879
880Helper function implementing keyboard navigation.
881
882\membersection{wxRichTextCtrl::LayoutContent}\label{wxrichtextctrllayoutcontent}
883
884\func{bool}{LayoutContent}{\param{bool }{onlyVisibleRect = false}}
885
886Lays out the buffer, which must be done before certain operations, such as
887setting the caret position. This function should not normally be required by the
888application.
889
890\membersection{wxRichTextCtrl::LoadFile}\label{wxrichtextctrlloadfile}
891
892\func{bool}{LoadFile}{\param{const wxString\& }{file}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
893
894Loads content into the control's buffer using the given type. If the specified type
895is wxRICHTEXT\_TYPE\_ANY, the type is deduced from the filename extension.
896
897This function looks for a suitable \helpref{wxRichTextFileHandler}{wxrichtextfilehandler} object.
898
899\membersection{wxRichTextCtrl::MarkDirty}\label{wxrichtextctrlmarkdirty}
900
901\func{void}{MarkDirty}{\void}
902
903Marks the buffer as modified.
904
905\membersection{wxRichTextCtrl::MoveCaret}\label{wxrichtextctrlmovecaret}
906
907\func{bool}{MoveCaret}{\param{long }{pos}, \param{bool }{showAtLineStart = false}}
908
909Move the caret to the given character position.
910
911\membersection{wxRichTextCtrl::MoveCaretBack}\label{wxrichtextctrlmovecaretback}
912
913\func{void}{MoveCaretBack}{\param{long }{oldPosition}}
914
915Move the caret one visual step forward: this may mean setting a flag
916and keeping the same position if we're going from the end of one line
917to the start of the next, which may be the exact same caret position.
918
919\membersection{wxRichTextCtrl::MoveCaretForward}\label{wxrichtextctrlmovecaretforward}
920
921\func{void}{MoveCaretForward}{\param{long }{oldPosition}}
922
923Move the caret one visual step forward: this may mean setting a flag
924and keeping the same position if we're going from the end of one line
925to the start of the next, which may be the exact same caret position.
926
927\membersection{wxRichTextCtrl::MoveDown}\label{wxrichtextctrlmovedown}
928
929\func{bool}{MoveDown}{\param{int }{noLines = 1}, \param{int }{flags = 0}}
930
931Moves the caret down.
932
933\membersection{wxRichTextCtrl::MoveEnd}\label{wxrichtextctrlmoveend}
934
935\func{bool}{MoveEnd}{\param{int }{flags = 0}}
936
937Moves to the end of the buffer.
938
939\membersection{wxRichTextCtrl::MoveHome}\label{wxrichtextctrlmovehome}
940
941\func{bool}{MoveHome}{\param{int }{flags = 0}}
942
943Moves to the start of the buffer.
944
945\membersection{wxRichTextCtrl::MoveLeft}\label{wxrichtextctrlmoveleft}
946
947\func{bool}{MoveLeft}{\param{int }{noPositions = 1}, \param{int }{flags = 0}}
948
949Moves left.
950
951\membersection{wxRichTextCtrl::MoveRight}\label{wxrichtextctrlmoveright}
952
953\func{bool}{MoveRight}{\param{int }{noPositions = 1}, \param{int }{flags = 0}}
954
955Moves right.
956
957\membersection{wxRichTextCtrl::MoveToLineEnd}\label{wxrichtextctrlmovetolineend}
958
959\func{bool}{MoveToLineEnd}{\param{int }{flags = 0}}
960
961Moves to the end of the line.
962
963\membersection{wxRichTextCtrl::MoveToLineStart}\label{wxrichtextctrlmovetolinestart}
964
965\func{bool}{MoveToLineStart}{\param{int }{flags = 0}}
966
967Moves to the start of the line.
968
969\membersection{wxRichTextCtrl::MoveToParagraphEnd}\label{wxrichtextctrlmovetoparagraphend}
970
971\func{bool}{MoveToParagraphEnd}{\param{int }{flags = 0}}
972
973Moves to the end of the paragraph.
974
975\membersection{wxRichTextCtrl::MoveToParagraphStart}\label{wxrichtextctrlmovetoparagraphstart}
976
977\func{bool}{MoveToParagraphStart}{\param{int }{flags = 0}}
978
979Moves to the start of the paragraph.
980
981\membersection{wxRichTextCtrl::MoveUp}\label{wxrichtextctrlmoveup}
982
983\func{bool}{MoveUp}{\param{int }{noLines = 1}, \param{int }{flags = 0}}
984
985Moves up.
986
987\membersection{wxRichTextCtrl::Newline}\label{wxrichtextctrlnewline}
988
989\func{bool}{Newline}{\void}
990
991Insert a newline (actually paragraph) at the current insertion point.
992
62f4313b
JS
993\membersection{wxRichTextCtrl::NumberList}\label{wxrichtextctrlnumberlist}
994
995\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}}
996
997\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}}
998
999Numbers the paragraphs in the given range. Pass flags to determine how the attributes are set.
1000Either the style definition or the name of the style definition (in the current sheet) can be passed.
1001
1002{\it flags} is a bit list of the following:
1003
1004\begin{itemize}\itemsep=0pt
1005\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
1006\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
1007\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.
1008\end{itemize}
1009
1010See also \helpref{wxRichTextCtrl::SetListStyle}{wxrichtextctrlsetliststyle}, \helpref{wxRichTextCtrl::PromoteList}{wxrichtextctrlpromotelist}, \helpref{wxRichTextCtrl::ClearListStyle}{wxrichtextctrlclearliststyle}.
1011
5f35b46a
JS
1012\membersection{wxRichTextCtrl::OnClear}\label{wxrichtextctrlonclear}
1013
1014\func{void}{OnClear}{\param{wxCommandEvent\& }{event}}
1015
1016Standard handler for the wxID\_CLEAR command.
1017
1018\membersection{wxRichTextCtrl::OnContextMenu}\label{wxrichtextctrloncontextmenu}
1019
1020\func{void}{OnContextMenu}{\param{wxContextMenuEvent\& }{event}}
1021
1022Shows a standard context menu with undo, redo, cut, copy, paste, clear, and select all commands.
1023
1024\membersection{wxRichTextCtrl::OnCopy}\label{wxrichtextctrloncopy}
1025
1026\func{void}{OnCopy}{\param{wxCommandEvent\& }{event}}
1027
1028Standard handler for the wxID\_COPY command.
1029
1030\membersection{wxRichTextCtrl::OnCut}\label{wxrichtextctrloncut}
1031
1032\func{void}{OnCut}{\param{wxCommandEvent\& }{event}}
1033
1034Standard handler for the wxID\_CUT command.
1035
1036\membersection{wxRichTextCtrl::OnDropFiles}\label{wxrichtextctrlondropfiles}
1037
1038\func{void}{OnDropFiles}{\param{wxDropFilesEvent\& }{event}}
1039
1040Loads the first dropped file.
1041
1042\membersection{wxRichTextCtrl::OnPaste}\label{wxrichtextctrlonpaste}
1043
1044\func{void}{OnPaste}{\param{wxCommandEvent\& }{event}}
1045
1046Standard handler for the wxID\_PASTE command.
1047
1048\membersection{wxRichTextCtrl::OnRedo}\label{wxrichtextctrlonredo}
1049
1050\func{void}{OnRedo}{\param{wxCommandEvent\& }{event}}
1051
1052Standard handler for the wxID\_REDO command.
1053
1054\membersection{wxRichTextCtrl::OnSelectAll}\label{wxrichtextctrlonselectall}
1055
1056\func{void}{OnSelectAll}{\param{wxCommandEvent\& }{event}}
1057
1058Standard handler for the wxID\_SELECTALL command.
1059
1060\membersection{wxRichTextCtrl::OnUndo}\label{wxrichtextctrlonundo}
1061
1062\func{void}{OnUndo}{\param{wxCommandEvent\& }{event}}
1063
1064Standard handler for the wxID\_PASTE command.
1065
1066\membersection{wxRichTextCtrl::OnUpdateClear}\label{wxrichtextctrlonupdateclear}
1067
1068\func{void}{OnUpdateClear}{\param{wxUpdateUIEvent\& }{event}}
1069
1070Standard update handler for the wxID\_CLEAR command.
1071
1072\membersection{wxRichTextCtrl::OnUpdateCopy}\label{wxrichtextctrlonupdatecopy}
1073
1074\func{void}{OnUpdateCopy}{\param{wxUpdateUIEvent\& }{event}}
1075
1076Standard update handler for the wxID\_COPY command.
1077
1078\membersection{wxRichTextCtrl::OnUpdateCut}\label{wxrichtextctrlonupdatecut}
1079
1080\func{void}{OnUpdateCut}{\param{wxUpdateUIEvent\& }{event}}
1081
1082Standard update handler for the wxID\_CUT command.
1083
1084\membersection{wxRichTextCtrl::OnUpdatePaste}\label{wxrichtextctrlonupdatepaste}
1085
1086\func{void}{OnUpdatePaste}{\param{wxUpdateUIEvent\& }{event}}
1087
1088Standard update handler for the wxID\_PASTE command.
1089
1090\membersection{wxRichTextCtrl::OnUpdateRedo}\label{wxrichtextctrlonupdateredo}
1091
1092\func{void}{OnUpdateRedo}{\param{wxUpdateUIEvent\& }{event}}
1093
1094Standard update handler for the wxID\_REDO command.
1095
1096\membersection{wxRichTextCtrl::OnUpdateSelectAll}\label{wxrichtextctrlonupdateselectall}
1097
1098\func{void}{OnUpdateSelectAll}{\param{wxUpdateUIEvent\& }{event}}
1099
1100Standard update handler for the wxID\_SELECTALL command.
1101
1102\membersection{wxRichTextCtrl::OnUpdateUndo}\label{wxrichtextctrlonupdateundo}
1103
1104\func{void}{OnUpdateUndo}{\param{wxUpdateUIEvent\& }{event}}
1105
1106Standard update handler for the wxID\_UNDO command.
1107
1108\membersection{wxRichTextCtrl::PageDown}\label{wxrichtextctrlpagedown}
1109
1110\func{bool}{PageDown}{\param{int }{noPages = 1}, \param{int }{flags = 0}}
1111
1112Moves one or more pages down.
1113
1114\membersection{wxRichTextCtrl::PageUp}\label{wxrichtextctrlpageup}
1115
1116\func{bool}{PageUp}{\param{int }{noPages = 1}, \param{int }{flags = 0}}
1117
1118Moves one or more pages up.
1119
1120\membersection{wxRichTextCtrl::PaintBackground}\label{wxrichtextctrlpaintbackground}
1121
1122\func{void}{PaintBackground}{\param{wxDC\& }{dc}}
1123
1124Paints the background.
1125
1126\membersection{wxRichTextCtrl::Paste}\label{wxrichtextctrlpaste}
1127
1128\func{void}{Paste}{\void}
1129
1130Pastes content from the clipboard to the buffer.
1131
1132\membersection{wxRichTextCtrl::PositionCaret}\label{wxrichtextctrlpositioncaret}
1133
1134\func{void}{PositionCaret}{\void}
1135
1136Internal function to position the visible caret according to the current caret position.
1137
1138\membersection{wxRichTextCtrl::PositionToXY}\label{wxrichtextctrlpositiontoxy}
1139
1140\constfunc{bool}{PositionToXY}{\param{long }{pos}, \param{long* }{x}, \param{long* }{y}}
1141
1142Converts a text position to zero-based column and line numbers.
1143
62f4313b
JS
1144\membersection{wxRichTextCtrl::PromoteList}\label{wxrichtextctrlpromotelist}
1145
1146\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}}
1147
1148\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}}
1149
1150Promotes or demotes the paragraphs in the given range. A positive {\it promoteBy} produces a smaller indent, and a negative number
1151produces a larger indent. Pass flags to determine how the attributes are set.
1152Either the style definition or the name of the style definition (in the current sheet) can be passed.
1153
1154{\it flags} is a bit list of the following:
1155
1156\begin{itemize}\itemsep=0pt
1157\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
1158\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
1159\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.
1160\end{itemize}
1161
1162See also \helpref{wxRichTextCtrl::SetListStyle}{wxrichtextctrlsetliststyle}, See also \helpref{wxRichTextCtrl::SetListStyle}{wxrichtextctrlnumberlist}, \helpref{wxRichTextCtrl::ClearListStyle}{wxrichtextctrlclearliststyle}.
1163
5f35b46a
JS
1164\membersection{wxRichTextCtrl::Redo}\label{wxrichtextctrlredo}
1165
1166\func{void}{Redo}{\void}
1167
1168Redoes the current command.
1169
1170\membersection{wxRichTextCtrl::Remove}\label{wxrichtextctrlremove}
1171
1172\func{void}{Remove}{\param{long }{from}, \param{long }{to}}
1173
1174Removes the content in the specified range.
1175
1176\membersection{wxRichTextCtrl::Replace}\label{wxrichtextctrlreplace}
1177
1178\func{void}{Replace}{\param{long }{from}, \param{long }{to}, \param{const wxString\& }{value}}
1179
1180Replaces the content in the specified range with the string specified by {\it value}.
1181
1182\membersection{wxRichTextCtrl::SaveFile}\label{wxrichtextctrlsavefile}
1183
1184\func{bool}{SaveFile}{\param{const wxString\& }{file = wxEmptyString}, \param{int }{type = wxRICHTEXT\_TYPE\_ANY}}
1185
1186Saves the buffer content using the given type. If the specified type
1187is wxRICHTEXT\_TYPE\_ANY, the type is deduced from the filename extension.
1188
1189This function looks for a suitable \helpref{wxRichTextFileHandler}{wxrichtextfilehandler} object.
1190
1191\membersection{wxRichTextCtrl::ScrollIntoView}\label{wxrichtextctrlscrollintoview}
1192
1193\func{bool}{ScrollIntoView}{\param{long }{position}, \param{int }{keyCode}}
1194
1195Scrolls {\it position} into view. This function takes a caret position.
1196
1197\membersection{wxRichTextCtrl::SelectAll}\label{wxrichtextctrlselectall}
1198
1199\func{void}{SelectAll}{\void}
1200
1201Selects all the text in the buffer.
1202
1203\membersection{wxRichTextCtrl::SelectNone}\label{wxrichtextctrlselectnone}
1204
1205\func{void}{SelectNone}{\void}
1206
1207Cancels any selection.
1208
62a268cc
JS
1209\membersection{wxRichTextCtrl::SetAndShowDefaultStyle}\label{wxrichtextctrlsetandshowdefaultstyle}
1210
1211\func{void}{SetAndShowDefaultStyle}{\param{const wxRichTextAttr\& }{attr}}
1212
1213Sets {\it attr} as the default style and tells the control that the UI should reflect
1214this attribute until the user moves the caret.
1215
1216See also \helpref{IsDefaultStyleShowing}{wxrichtextctrlisdefaultstyleshowing}.
1217
5f35b46a
JS
1218\membersection{wxRichTextCtrl::SetBasicStyle}\label{wxrichtextctrlsetbasicstyle}
1219
1220\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}}
1221
1222\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
1223
1224Sets the basic (overall) style. This is the style of the whole
1225buffer before further styles are applied, unlike the default style, which
1226only affects the style currently being applied (for example, setting the default
1227style to bold will cause subsequently inserted text to be bold).
1228
1229\membersection{wxRichTextCtrl::SetCaretPosition}\label{wxrichtextctrlsetcaretposition}
1230
1231\func{void}{SetCaretPosition}{\param{long }{position}, \param{bool }{showAtLineStart = false}}
1232
1233The caret position is the character position just before the caret.
1234A value of -1 means the caret is at the start of the buffer.
1235
1236\membersection{wxRichTextCtrl::SetDefaultStyle}\label{wxrichtextctrlsetdefaultstyle}
1237
1238\func{bool}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}}
1239
1240Sets the current default style, which can be used to change how subsequently inserted
1241text is displayed.
1242
1243\membersection{wxRichTextCtrl::SetDefaultStyleToCursorStyle}\label{wxrichtextctrlsetdefaultstyletocursorstyle}
1244
1245\func{bool}{SetDefaultStyleToCursorStyle}{\void}
1246
1247Sets the default style to the style under the cursor.
1248
1249\membersection{wxRichTextCtrl::SetDelayedLayoutThreshold}\label{wxrichtextctrlsetdelayedlayoutthreshold}
1250
1251\func{void}{SetDelayedLayoutThreshold}{\param{long }{threshold}}
1252
1253Sets the size of the buffer beyond which layout is delayed during resizing.
1254This optimizes sizing for large buffers. The default is 20000.
1255
1256\membersection{wxRichTextCtrl::SetEditable}\label{wxrichtextctrlseteditable}
1257
1258\func{void}{SetEditable}{\param{bool }{editable}}
1259
1260Makes the control editable, or not.
1261
1262\membersection{wxRichTextCtrl::SetFilename}\label{wxrichtextctrlsetfilename}
1263
1264\func{void}{SetFilename}{\param{const wxString\& }{filename}}
1265
1266Sets the current filename.
1267
1268\membersection{wxRichTextCtrl::SetFont}\label{wxrichtextctrlsetfont}
1269
1270\func{bool}{SetFont}{\param{const wxFont\& }{font}}
1271
1272Sets the font, and also the basic and default attributes (see \helpref{SetDefaultStyle}{wxrichtextctrlsetdefaultstyle}).
1273
1274\membersection{wxRichTextCtrl::SetInsertionPoint}\label{wxrichtextctrlsetinsertionpoint}
1275
1276\func{void}{SetInsertionPoint}{\param{long }{pos}}
1277
1278Sets the insertion point.
1279
1280\membersection{wxRichTextCtrl::SetInsertionPointEnd}\label{wxrichtextctrlsetinsertionpointend}
1281
1282\func{void}{SetInsertionPointEnd}{\void}
1283
1284Sets the insertion point to the end of the text control.
1285
62f4313b
JS
1286\membersection{wxRichTextCtrl::SetListStyle}\label{wxrichtextctrlsetliststyle}
1287
1288\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}}
1289
1290\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}}
1291
1292Sets the list attributes for the given range, passing flags to determine how the attributes are set.
1293Either the style definition or the name of the style definition (in the current sheet) can be passed.
1294
1295{\it flags} is a bit list of the following:
1296
1297\begin{itemize}\itemsep=0pt
1298\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this command will be undoable.
1299\item wxRICHTEXT\_SETSTYLE\_RENUMBER: specifies that numbering should start from {\it startFrom}, otherwise existing attributes are used.
1300\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.
1301\end{itemize}
1302
1303See also \helpref{wxRichTextCtrl::NumberList}{wxrichtextctrlnumberlist}, \helpref{wxRichTextCtrl::PromoteList}{wxrichtextctrlpromotelist}, \helpref{wxRichTextCtrl::ClearListStyle}{wxrichtextctrlclearliststyle}.
1304
5f35b46a
JS
1305\membersection{wxRichTextCtrl::SetSelection}\label{wxrichtextctrlsetselection}
1306
1307\func{void}{SetSelection}{\param{long }{from}, \param{long }{to}}
1308
1309Sets the selection to the given range.
1310
62a268cc
JS
1311The end point of range is specified as the last character position of the span of text, plus one.
1312So, for example, to set the style for a character at position 5, use the range (5,6).
1313
5f35b46a
JS
1314\membersection{wxRichTextCtrl::SetSelectionRange}\label{wxrichtextctrlsetselectionrange}
1315
1316\func{void}{SetSelectionRange}{\param{const wxRichTextRange\& }{range}}
1317
1318Sets the selection to the given range.
1319
62a268cc
JS
1320The end point of range is specified as the last character position of the span of text, plus one.
1321So, for example, to set the style for a character at position 5, use the range (5,6).
1322
5f35b46a
JS
1323\membersection{wxRichTextCtrl::SetStyle}\label{wxrichtextctrlsetstyle}
1324
1325\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}}
1326
1327\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}}
1328
62a268cc
JS
1329\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}}
1330
5f35b46a
JS
1331Sets the attributes for the given range. The wxRichTextAttr version is more efficient
1332because it does not use wxFont objects.
1333
62a268cc
JS
1334The end point of range is specified as the last character position of the span of text, plus one.
1335So, for example, to set the style for a character at position 5, use the range (5,6).
1336
1337\membersection{wxRichTextCtrl::SetStyleEx}\label{wxrichtextctrlsetstyleex}
1338
1339\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
1340
1341\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
1342
1343\func{bool}{SetStyleEx}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
1344
1345Sets the attributes for the given range, passing flags to determine how the attributes are set. The wxRichTextAttr version is more efficient
1346because it does not use wxFont objects.
1347
1348The end point of range is specified as the last character position of the span of text, plus one.
1349So, for example, to set the style for a character at position 5, use the range (5,6).
1350
1351{\it flags} may contain a bit list of the following values:
1352
62f4313b
JS
1353\begin{itemize}\itemsep=0pt
1354\item wxRICHTEXT\_SETSTYLE\_NONE: no style flag.
1355\item wxRICHTEXT\_SETSTYLE\_WITH\_UNDO: specifies that this operation should be undoable.
1356\item wxRICHTEXT\_SETSTYLE\_OPTIMIZE: specifies that the style should not be applied if the
1357combined style at this point is already the style in question.
1358\item define wxRICHTEXT\_SETSTYLE\_PARAGRAPHS\_ONLY: specifies that the style should only be applied to paragraphs,
1359and not the content. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
1360\item wxRICHTEXT\_SETSTYLE\_CHARACTERS\_ONLY: specifies that the style should only be applied to characters,
1361and not the paragraph. This allows content styling to be preserved independently from that of e.g. a named paragraph style.
1362\end{itemize}
62a268cc 1363
5f35b46a
JS
1364\membersection{wxRichTextCtrl::SetStyleSheet}\label{wxrichtextctrlsetstylesheet}
1365
1366\func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}}
1367
1368Sets the style sheet associated with the control. A style sheet allows named
1369character and paragraph styles to be applied.
1370
1371\membersection{wxRichTextCtrl::SetValue}\label{wxrichtextctrlsetvalue}
1372
1373\func{void}{SetValue}{\param{const wxString\& }{value}}
1374
1375Replaces existing content with the given text.
1376
1377\membersection{wxRichTextCtrl::SetupScrollbars}\label{wxrichtextctrlsetupscrollbars}
1378
1379\func{void}{SetupScrollbars}{\param{bool }{atTop = false}}
1380
1381A helper function setting up scrollbars, for example after a resize.
1382
1383\membersection{wxRichTextCtrl::ShowPosition}\label{wxrichtextctrlshowposition}
1384
1385\func{void}{ShowPosition}{\param{long }{pos}}
1386
1387Scrolls the buffer so that the given position is in view.
1388
1389\membersection{wxRichTextCtrl::SuppressingUndo}\label{wxrichtextctrlsuppressingundo}
1390
1391\constfunc{bool}{SuppressingUndo}{\void}
1392
1393Returns \true if undo history suppression is on.
1394
1395\membersection{wxRichTextCtrl::Thaw}\label{wxrichtextctrlthaw}
1396
1397\func{void}{Thaw}{\void}
1398
1399Call this function to end a Freeze and refresh the display.
1400
1401\membersection{wxRichTextCtrl::Undo}\label{wxrichtextctrlundo}
1402
1403\func{void}{Undo}{\void}
1404
1405Undoes the command at the top of the command history, if there is one.
1406
1407\membersection{wxRichTextCtrl::WordLeft}\label{wxrichtextctrlwordleft}
1408
1409\func{bool}{WordLeft}{\param{int }{noWords = 1}, \param{int }{flags = 0}}
1410
1411Moves a number of words to the left.
1412
1413\membersection{wxRichTextCtrl::WordRight}\label{wxrichtextctrlwordright}
1414
1415\func{bool}{WordRight}{\param{int }{noWords = 1}, \param{int }{flags = 0}}
1416
1417Move a nuber of words to the right.
1418
1419\membersection{wxRichTextCtrl::WriteImage}\label{wxrichtextctrlwriteimage}
1420
1421\func{bool}{WriteImage}{\param{const wxString\& }{filename}, \param{int }{bitmapType}}
1422
1423Loads an image from a file and writes it at the current insertion point.
1424
1425\func{bool}{WriteImage}{\param{const wxRichTextImageBlock\& }{imageBlock}}
1426
1427Writes an image block at the current insertion point.
1428
1429\func{bool}{WriteImage}{\param{const wxBitmap\& }{bitmap}, \param{int }{bitmapType = wxBITMAP\_TYPE\_PNG}}
1430
1431\func{bool}{WriteImage}{\param{const wxImage\& }{image}, \param{int }{bitmapType = wxBITMAP\_TYPE\_PNG}}
1432
1433Write a bitmap or image at the current insertion point. Supply an optional type to use
1434for internal and file storage of the raw data.
1435
1436\membersection{wxRichTextCtrl::WriteText}\label{wxrichtextctrlwritetext}
1437
1438\func{void}{WriteText}{\param{const wxString\& }{text}}
1439
1440Writes text at the current position.
1441
1442\membersection{wxRichTextCtrl::XYToPosition}\label{wxrichtextctrlxytoposition}
1443
1444\constfunc{long}{XYToPosition}{\param{long }{x}, \param{long }{y}}
1445
1446Translates from column and line number to position.
62a268cc 1447