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