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