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