]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/textattr.tex
Correct wxObjectDataPtr<> assignment from *T to not increase the ref count
[wxWidgets.git] / docs / latex / wx / textattr.tex
1 \section{\class{wxTextAttr}}\label{wxtextattr}
2
3 wxTextAttr represents the character and paragraph attributes, or style,
4 for a range of text in a \helpref{wxTextCtrl}{wxtextctrl} or \helpref{wxRichTextCtrl}{wxrichtextctrl}.
5
6 When setting up a wxTextAttr object, pass a bitlist mask to \helpref{SetFlags}{wxtextattrsetflags} to
7 indicate which style elements should be changed. As a convenience, when you call a setter such
8 as SetFont, the relevant bit will be set.
9
10 \wxheading{Derived from}
11
12 No base class
13
14 \wxheading{Include files}
15
16 <wx/textctrl.h>
17
18 \wxheading{Library}
19
20 \helpref{wxCore}{librarieslist}
21
22 \wxheading{Constants}
23
24 The following values can be passed to wxTextAttr::SetAlignment to determine
25 paragraph alignment.
26
27 {\small
28 \begin{verbatim}
29 enum wxTextAttrAlignment
30 {
31 wxTEXT_ALIGNMENT_DEFAULT,
32 wxTEXT_ALIGNMENT_LEFT,
33 wxTEXT_ALIGNMENT_CENTRE,
34 wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
35 wxTEXT_ALIGNMENT_RIGHT,
36 wxTEXT_ALIGNMENT_JUSTIFIED
37 };
38 \end{verbatim}
39 }
40
41 Of these, wxTEXT\_ALIGNMENT\_JUSTIFIED is unimplemented. In future justification may be supported
42 when printing or previewing, only.
43
44 The following values are passed in a bitlist to wxTextAttr::SetFlags to determine
45 what attributes will be considered when setting the attributes
46 for a text control.
47
48 {\small
49 \begin{verbatim}
50 // Standard wxTextAttr constants
51
52 #define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
53 #define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
54 #define wxTEXT_ATTR_FONT_FACE 0x00000004
55 #define wxTEXT_ATTR_FONT_SIZE 0x00000008
56 #define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
57 #define wxTEXT_ATTR_FONT_ITALIC 0x00000020
58 #define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
59 #define wxTEXT_ATTR_FONT_ENCODING 0x02000000
60 #define wxTEXT_ATTR_FONT \
61 wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \
62 | wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING
63 #define wxTEXT_ATTR_ALIGNMENT 0x00000080
64 #define wxTEXT_ATTR_LEFT_INDENT 0x00000100
65 #define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
66 #define wxTEXT_ATTR_TABS 0x00000400
67
68 // Extra formatting flags not in wxTextAttr
69
70 #define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800
71 #define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000
72 #define wxTEXT_ATTR_LINE_SPACING 0x00002000
73 #define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000
74 #define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000
75 #define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000
76 #define wxTEXT_ATTR_BULLET_STYLE 0x00020000
77 #define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
78 #define wxTEXT_ATTR_BULLET_TEXT 0x00080000
79 #define wxTEXT_ATTR_BULLET_NAME 0x00100000
80 #define wxTEXT_ATTR_URL 0x00200000
81 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000
82 #define wxTEXT_ATTR_EFFECTS 0x00800000
83 #define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
84 \end{verbatim}
85 }
86
87 The following styles can be passed to wxTextAttr::SetBulletStyle:
88
89 {\small
90 \begin{verbatim}
91 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
92 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
93 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
94 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
95 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
96 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
97 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
98 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
99 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
100 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
101 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
102 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
103 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
104 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
105 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
106 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
107 \end{verbatim}
108 }
109
110 Of these, wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is unimplemented.
111
112 The following constants can be passed to wxTextAttr::SetLineSpacing:
113
114 {\small
115 \begin{verbatim}
116 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
117 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
118 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
119 \end{verbatim}
120 }
121
122 The following styles can be passed to wxTextAttr::SetTextEffects:
123
124 {\small
125 \begin{verbatim}
126 #define wxTEXT_ATTR_EFFECT_NONE 0x00000000
127 #define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
128 #define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
129 #define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
130 #define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
131 #define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
132 #define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
133 #define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
134 #define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
135 #define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
136 #define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
137 \end{verbatim}
138 }
139
140 Of these, only wxTEXT\_ATTR\_EFFECT\_CAPITALS and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH are implemented.
141
142 \wxheading{See also}
143
144 \helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
145
146 \latexignore{\rtfignore{\wxheading{Members}}}
147
148 \membersection{wxTextAttr::wxTextAttr}\label{wxtextattrwxtextattr}
149
150 \func{}{wxTextAttr}{\void}
151
152 \func{}{wxTextAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour}, \param{const wxFont\& }{font = wxNullFont}, \param{wxTextAttrAlignment }{alignment = wxTEXT\_ALIGNMENT\_DEFAULT}}
153
154 \func{}{wxTextAttr}{\param{const wxTextAttr\& }{attr}}
155
156 Constructors.
157
158 \membersection{wxTextAttr::Apply}\label{wxtextattrapply}
159
160 \func{bool}{Apply}{\param{const wxTextAttr\& }{style}, \param{const wxTextAttr* }{compareWith = NULL}}
161
162 Applies the attributes in {\it style} to the original object, but not those attributes from {\it style} that are the same as those in {\it compareWith} (if passed).
163
164 \membersection{wxTextAttr::CreateFont}\label{wxtextattrcreatefont}
165
166 \constfunc{wxFont}{CreateFont}{\void}
167
168 Creates a font from the font attributes.
169
170 \membersection{wxTextAttr::GetAlignment}\label{wxtextattrgetalignment}
171
172 \constfunc{wxTextAttrAlignment}{GetAlignment}{\void}
173
174 Returns the alignment flags.
175 See \helpref{wxTextAttr::SetAlignment}{wxtextattrsetalignment} for a list of available styles.
176
177 \membersection{wxTextAttr::GetBackgroundColour}\label{wxtextattrgetbackgroundcolour}
178
179 \constfunc{const wxColour\&}{GetBackgroundColour}{\void}
180
181 Returns the background colour.
182
183 \membersection{wxTextAttr::GetBulletFont}\label{wxtextattrgetbulletfont}
184
185 \constfunc{const wxString\&}{GetBulletFont}{\void}
186
187 Returns a string containing the name of the font associated with the bullet symbol.
188 Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
189
190 \membersection{wxTextAttr::GetBulletName}\label{wxtextattrgetbulletname}
191
192 \constfunc{const wxString\&}{GetBulletName}{\void}
193
194 Returns the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
195 Currently the following standard bullet names are supported:
196
197 \begin{itemize}\itemsep=0pt
198 \item {\tt standard/circle}
199 \item {\tt standard/square}
200 \item {\tt standard/diamond}
201 \item {\tt standard/triangle}
202 \end{itemize}
203
204 For wxRichTextCtrl users only: if you wish your rich text controls to support further bullet graphics, you can derive a
205 class from wxRichTextRenderer or wxRichTextStdRenderer, override {\tt DrawStandardBullet} and {\tt EnumerateStandardBulletNames}, and
206 set an instance of the class using \helpref{wxRichTextBuffer::SetRenderer}{wxrichtextbuffersetrenderer}.
207
208 \membersection{wxTextAttr::GetBulletNumber}\label{wxtextattrgetbulletnumber}
209
210 \constfunc{int}{GetBulletNumber}{\void}
211
212 Returns the bullet number.
213
214 \membersection{wxTextAttr::GetBulletStyle}\label{wxtextattrgetbulletstyle}
215
216 \constfunc{int}{GetBulletStyle}{\void}
217
218 Returns the bullet style.
219 See \helpref{wxTextAttr::SetBulletStyle}{wxtextattrsetbulletstyle} for a list of available styles.
220
221 \membersection{wxTextAttr::GetBulletText}\label{wxtextattrgetbullettext}
222
223 \constfunc{const wxString\&}{GetBulletText}{\void}
224
225 Returns the bullet text, which could be a symbol, or (for example) cached outline text.
226
227 \membersection{wxTextAttr::GetCharacterStyleName}\label{wxtextattrgetcharacterstylename}
228
229 \constfunc{const wxString\&}{GetCharacterStyleName}{\void}
230
231 Returns the name of the character style.
232
233 \membersection{wxTextAttr::GetFlags}\label{wxtextattrgetflags}
234
235 \constfunc{long}{GetFlags}{\void}
236
237 Returns flags indicating which attributes are applicable.
238 See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for a list of available flags.
239
240 \membersection{wxTextAttr::GetFont}\label{wxtextattrgetfont}
241
242 \constfunc{wxFont}{GetFont}{\void}
243
244 Creates and returns a font specified by the font attributes in the wxTextAttr object. Note that
245 wxTextAttr does not store a wxFont object, so this is only a temporary font. For greater
246 efficiency, access the font attributes directly.
247
248 \membersection{wxTextAttr::GetFontAttributes}\label{wxtextattrgetfontattributes}
249
250 \func{bool}{GetFontAttributes}{\param{const wxFont\& }{font}, \param{int}{ flags = wxTEXT\_ATTR\_FONT}}
251
252 Gets the font attributes from the given font, using only the attributes specified by {\it flags}.
253
254 \membersection{wxTextAttr::GetFontEncoding}\label{wxtextattrgetfontencoding}
255
256 \constfunc{wxFontEncoding}{GetFontEncoding}{\void}
257
258 Returns the font encoding.
259
260 \membersection{wxTextAttr::GetFontFaceName}\label{wxtextattrgetfontfacename}
261
262 \constfunc{const wxString\&}{GetFontFaceName}{\void}
263
264 Returns the font face name.
265
266 \membersection{wxTextAttr::GetFontSize}\label{wxtextattrgetfontsize}
267
268 \constfunc{int}{GetFontSize}{\void}
269
270 Returns the font size in points.
271
272 \membersection{wxTextAttr::GetFontStyle}\label{wxtextattrgetfontstyle}
273
274 \constfunc{int}{GetFontStyle}{\void}
275
276 Returns the font style.
277
278 \membersection{wxTextAttr::GetFontUnderlined}\label{wxtextattrgetfontunderlined}
279
280 \constfunc{bool}{GetFontUnderlined}{\void}
281
282 Returns \true if the font is underlined.
283
284 \membersection{wxTextAttr::GetFontWeight}\label{wxtextattrgetfontweight}
285
286 \constfunc{int}{GetFontWeight}{\void}
287
288 Returns the font weight.
289
290 \membersection{wxTextAttr::GetLeftIndent}\label{wxtextattrgetleftindent}
291
292 \constfunc{long}{GetLeftIndent}{\void}
293
294 Returns the left indent in tenths of a millimetre.
295
296 \membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent}
297
298 \constfunc{long}{GetLeftSubIndent}{\void}
299
300 Returns the left sub-indent in tenths of a millimetre.
301
302 \membersection{wxTextAttr::GetLineSpacing}\label{wxtextattrgetlinespacing}
303
304 \constfunc{int}{GetLineSpacing}{\void}
305
306 Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
307 wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
308
309 \membersection{wxTextAttr::GetListStyleName}\label{wxtextattrgetliststylename}
310
311 \constfunc{const wxString\&}{GetListStyleName}{\void}
312
313 Returns the name of the list style.
314
315 \membersection{wxTextAttr::GetOutlineLevel}\label{wxtextattrgetoutlinelevel}
316
317 \constfunc{bool}{GetOutlineLevel}{\void}
318
319 Returns the outline level.
320
321 \membersection{wxTextAttr::GetParagraphSpacingAfter}\label{wxtextattrgetparagraphspacingafter}
322
323 \constfunc{int}{GetParagraphSpacingAfter}{\void}
324
325 Returns the space in tenths of a millimeter after the paragraph.
326
327 \membersection{wxTextAttr::GetParagraphSpacingBefore}\label{wxtextattrgetparagraphspacingbefore}
328
329 \constfunc{int}{GetParagraphSpacingBefore}{\void}
330
331 Returns the space in tenths of a millimeter before the paragraph.
332
333 \membersection{wxTextAttr::GetParagraphStyleName}\label{wxtextattrgetparagraphstylename}
334
335 \constfunc{const wxString\&}{GetParagraphStyleName}{\void}
336
337 Returns the name of the paragraph style.
338
339 \membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent}
340
341 \constfunc{long}{GetRightIndent}{\void}
342
343 Returns the right indent in tenths of a millimeter.
344
345 \membersection{wxTextAttr::GetTabs}\label{wxtextattrgettabs}
346
347 \constfunc{const wxArrayInt\&}{GetTabs}{\void}
348
349 Returns an array of tab stops, each expressed in tenths of a millimeter. Each stop
350 is measured from the left margin and therefore each value must be larger than the last.
351
352 \membersection{wxTextAttr::GetTextColour}\label{wxtextattrgettextcolour}
353
354 \constfunc{const wxColour\&}{GetTextColour}{\void}
355
356 Returns the text foreground colour.
357
358 \membersection{wxTextAttr::GetTextEffectFlags}\label{wxtextattrgettexteffectflags}
359
360 \constfunc{int}{GetTextEffectFlags}{\void}
361
362 Returns the text effect bits of interest. See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for further information.
363
364 \membersection{wxTextAttr::GetTextEffects}\label{wxtextattrgettexteffects}
365
366 \constfunc{int}{GetTextEffects}{\void}
367
368 Returns the text effects, a bit list of styles. See \helpref{wxTextAttr::SetTextEffects}{wxtextattrsettexteffects} for
369 details.
370
371 \membersection{wxTextAttr::GetURL}\label{wxtextattrgeturl}
372
373 \constfunc{const wxString\&}{GetURL}{\void}
374
375 Returns the URL for the content. Content with wxTEXT\_ATTR\_URL style
376 causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates
377 a wxTextUrlEvent when the content is clicked.
378
379 \membersection{wxTextAttr::HasAlignment}\label{wxtextattrhasalignment}
380
381 \constfunc{bool}{HasAlignment}{\void}
382
383 Returns \true if the attribute object specifies alignment.
384
385 \membersection{wxTextAttr::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour}
386
387 \constfunc{bool}{HasBackgroundColour}{\void}
388
389 Returns \true if the attribute object specifies a background colour.
390
391 \membersection{wxTextAttr::HasBulletName}\label{wxtextattrhasbulletname}
392
393 \constfunc{bool}{HasBulletName}{\void}
394
395 Returns \true if the attribute object specifies a standard bullet name.
396
397 \membersection{wxTextAttr::HasBulletNumber}\label{wxtextattrhasbulletnumber}
398
399 \constfunc{bool}{HasBulletNumber}{\void}
400
401 Returns \true if the attribute object specifies a bullet number.
402
403 \membersection{wxTextAttr::HasBulletStyle}\label{wxtextattrhasbulletstyle}
404
405 \constfunc{bool}{HasBulletStyle}{\void}
406
407 Returns \true if the attribute object specifies a bullet style.
408
409 \membersection{wxTextAttr::HasBulletText}\label{wxtextattrhasbullettext}
410
411 \constfunc{bool}{HasBulletText}{\void}
412
413 Returns \true if the attribute object specifies bullet text (usually specifying a symbol).
414
415 \membersection{wxTextAttr::HasCharacterStyleName}\label{wxtextattrhascharacterstylename}
416
417 \constfunc{bool}{HasCharacterStyleName}{\void}
418
419 Returns \true if the attribute object specifies a character style name.
420
421 \membersection{wxTextAttr::HasFontEncoding}\label{wxtextattrhasfontencoding}
422
423 \constfunc{bool}{HasFontEncoding}{\void}
424
425 Returns \true if the attribute object specifies an encoding.
426
427 \membersection{wxTextAttr::HasFontFaceName}\label{wxtextattrhasfontfacename}
428
429 \constfunc{bool}{HasFontFaceName}{\void}
430
431 Returns \true if the attribute object specifies a font face name.
432
433 \membersection{wxTextAttr::HasFlag}\label{wxtextattrhasflag}
434
435 \constfunc{bool}{HasFlag}{\param{long }{flag}}
436
437 Returns \true if the {\it flag} is present in the attribute object's flag bitlist.
438
439 \membersection{wxTextAttr::HasFont}\label{wxtextattrhasfont}
440
441 \constfunc{bool}{HasFont}{\void}
442
443 Returns \true if the attribute object specifies any font attributes.
444
445 \membersection{wxTextAttr::HasFontItalic}\label{wxtextattrhasfontitalic}
446
447 \constfunc{bool}{HasFontItalic}{\void}
448
449 Returns \true if the attribute object specifies italic style.
450
451 \membersection{wxTextAttr::HasFontUnderlined}\label{wxtextattrhasfontunderlined}
452
453 \constfunc{bool}{HasFontUnderlined}{\void}
454
455 Returns \true if the attribute object specifies either underlining or no underlining.
456
457 \membersection{wxTextAttr::HasURL}\label{wxtextattrhasurl}
458
459 \constfunc{bool}{HasURL}{\void}
460
461 Returns \true if the attribute object specifies a URL.
462
463 \membersection{wxTextAttr::HasFontWeight}\label{wxtextattrhasfontweight}
464
465 \constfunc{bool}{HasFontWeight}{\void}
466
467 Returns \true if the attribute object specifies font weight (bold, light or normal).
468
469 \membersection{wxTextAttr::HasLeftIndent}\label{wxtextattrhasleftindent}
470
471 \constfunc{bool}{HasLeftIndent}{\void}
472
473 Returns \true if the attribute object specifies a left indent.
474
475 \membersection{wxTextAttr::HasLineSpacing}\label{wxtextattrhaslinespacing}
476
477 \constfunc{bool}{HasLineSpacing}{\void}
478
479 Returns \true if the attribute object specifies line spacing.
480
481 \membersection{wxTextAttr::HasListStyleName}\label{wxtextattrhasliststylename}
482
483 \constfunc{bool}{HasListStyleName}{\void}
484
485 Returns \true if the attribute object specifies a list style name.
486
487 \membersection{wxTextAttr::HasOutlineLevel}\label{wxtextattrhasoutlinelevel}
488
489 \constfunc{bool}{HasOutlineLevel}{\void}
490
491 Returns \true if the attribute object specifies an outline level.
492
493 \membersection{wxTextAttr::HasPageBreak}\label{wxtextattrhaspagebreak}
494
495 \constfunc{bool}{HasPageBreak}{\void}
496
497 Returns \true if the attribute object specifies a page break before this paragraph.
498
499 \membersection{wxTextAttr::HasParagraphSpacingAfter}\label{wxtextattrhasparagraphspacingafter}
500
501 \constfunc{bool}{HasParagraphSpacingAfter}{\void}
502
503 Returns \true if the attribute object specifies spacing after a paragraph.
504
505 \membersection{wxTextAttr::HasParagraphSpacingBefore}\label{wxtextattrhasparagraphspacingbefore}
506
507 \constfunc{bool}{HasParagraphSpacingBefore}{\void}
508
509 Returns \true if the attribute object specifies spacing before a paragraph.
510
511 \membersection{wxTextAttr::HasParagraphStyleName}\label{wxtextattrhasparagraphstylename}
512
513 \constfunc{bool}{HasParagraphStyleName}{\void}
514
515 Returns \true if the attribute object specifies a paragraph style name.
516
517 \membersection{wxTextAttr::HasRightIndent}\label{wxtextattrhasrightindent}
518
519 \constfunc{bool}{HasRightIndent}{\void}
520
521 Returns \true if the attribute object specifies a right indent.
522
523 \membersection{wxTextAttr::HasFontSize}\label{wxtextattrhasfontsize}
524
525 \constfunc{bool}{HasFontSize}{\void}
526
527 Returns \true if the attribute object specifies a font point size.
528
529 \membersection{wxTextAttr::HasTabs}\label{wxtextattrhastabs}
530
531 \constfunc{bool}{HasTabs}{\void}
532
533 Returns \true if the attribute object specifies tab stops.
534
535 \membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour}
536
537 \constfunc{bool}{HasTextColour}{\void}
538
539 Returns \true if the attribute object specifies a text foreground colour.
540
541 \membersection{wxTextAttr::HasTextEffects}\label{wxtextattrhastexteffects}
542
543 \constfunc{bool}{HasTextEffects}{\void}
544
545 Returns \true if the attribute object specifies text effects.
546
547 \membersection{wxTextAttr::IsCharacterStyle}\label{wxtextattrischaracterstyle}
548
549 \constfunc{bool}{IsCharacterStyle}{\void}
550
551 Returns \true if the object represents a character style, that is,
552 the flags specify a font or a text background or foreground colour.
553
554 \membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault}
555
556 \constfunc{bool}{IsDefault}{\void}
557
558 Returns \false if we have any attributes set, \true otherwise.
559
560 \membersection{wxTextAttr::IsParagraphStyle}\label{wxtextattrisparagraphstyle}
561
562 \constfunc{bool}{IsParagraphStyle}{\void}
563
564 Returns \true if the object represents a paragraph style, that is,
565 the flags specify alignment, indentation, tabs, paragraph spacing, or
566 bullet style.
567
568 \membersection{wxTextAttr::Merge}\label{wxtextattrmerge}
569
570 \func{void}{Merge}{\param{const wxTextAttr\&}{ overlay}}
571
572 Copies all defined/valid properties from \arg{overlay} to current object.
573
574 \func{static wxTextAttr}{Merge}{\param{const wxTextAttr\&}{ base}, \param{const wxTextAttr\&}{ overlay}}
575
576 Creates a new {\tt wxTextAttr} which is a merge of \arg{base} and
577 \arg{overlay}. Properties defined in \arg{overlay} take precedence over those
578 in \arg{base}. Properties undefined/invalid in both are undefined in the
579 result.
580
581
582 \membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment}
583
584 \func{void}{SetAlignment}{\param{wxTextAttrAlignment }{alignment}}
585
586 Sets the paragraph alignment. These are the possible values for {\it alignment}:
587
588 {\small
589 \begin{verbatim}
590 enum wxTextAttrAlignment
591 {
592 wxTEXT_ALIGNMENT_DEFAULT,
593 wxTEXT_ALIGNMENT_LEFT,
594 wxTEXT_ALIGNMENT_CENTRE,
595 wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
596 wxTEXT_ALIGNMENT_RIGHT,
597 wxTEXT_ALIGNMENT_JUSTIFIED
598 };
599 \end{verbatim}
600 }
601
602 Of these, wxTEXT\_ALIGNMENT\_JUSTIFIED is unimplemented. In future justification may be supported
603 when printing or previewing, only.
604
605 \membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour}
606
607 \func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}}
608
609 Sets the background colour.
610
611 \membersection{wxTextAttr::SetBulletFont}\label{wxtextattrsetbulletfont}
612
613 \func{void}{SetBulletFont}{\param{const wxString\& }{font}}
614
615 Sets the name of the font associated with the bullet symbol.
616 Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
617
618 \membersection{wxTextAttr::SetBulletName}\label{wxtextattrsetbulletname}
619
620 \func{void}{SetBulletName}{\param{const wxString\& }{name}}
621
622 Sets the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
623 See \helpref{wxTextAttr::GetBulletName}{wxtextattrgetbulletname} for a list
624 of supported names, and how to expand the range of supported types.
625
626 \membersection{wxTextAttr::SetBulletNumber}\label{wxtextattrsetbulletnumber}
627
628 \func{void}{SetBulletNumber}{\param{int }{n}}
629
630 Sets the bullet number.
631
632 \membersection{wxTextAttr::SetBulletStyle}\label{wxtextattrsetbulletstyle}
633
634 \func{void}{SetBulletStyle}{\param{int }{style}}
635
636 Sets the bullet style. The following styles can be passed:
637
638 {\small
639 \begin{verbatim}
640 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
641 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
642 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
643 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
644 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
645 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
646 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
647 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
648 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
649 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
650 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
651 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
652 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
653 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
654 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
655 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
656 \end{verbatim}
657 }
658
659 Currently wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is not supported.
660
661 \membersection{wxTextAttr::SetBulletText}\label{wxtextattrsetbullettext}
662
663 \func{void}{SetBulletText}{\param{const wxString& }{text}}
664
665 Sets the bullet text, which could be a symbol, or (for example) cached outline text.
666
667 \membersection{wxTextAttr::SetCharacterStyleName}\label{wxtextattrsetcharacterstylename}
668
669 \func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
670
671 Sets the character style name.
672
673 \membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags}
674
675 \func{void}{SetFlags}{\param{long }{flags}}
676
677 Sets the flags determining which styles are being specified. The following
678 flags can be passed in a bitlist:
679
680 {\small
681 \begin{verbatim}
682 // Standard wxTextAttr constants
683
684 #define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
685 #define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
686 #define wxTEXT_ATTR_FONT_FACE 0x00000004
687 #define wxTEXT_ATTR_FONT_SIZE 0x00000008
688 #define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
689 #define wxTEXT_ATTR_FONT_ITALIC 0x00000020
690 #define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
691 #define wxTEXT_ATTR_FONT \
692 wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \
693 | wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE
694 #define wxTEXT_ATTR_ALIGNMENT 0x00000080
695 #define wxTEXT_ATTR_LEFT_INDENT 0x00000100
696 #define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
697 #define wxTEXT_ATTR_TABS 0x00000400
698
699 // Extra formatting flags not in wxTextAttr
700
701 #define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800
702 #define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000
703 #define wxTEXT_ATTR_LINE_SPACING 0x00002000
704 #define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000
705 #define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000
706 #define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000
707 #define wxTEXT_ATTR_BULLET_STYLE 0x00020000
708 #define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
709 #define wxTEXT_ATTR_BULLET_TEXT 0x00080000
710 #define wxTEXT_ATTR_BULLET_NAME 0x00100000
711 #define wxTEXT_ATTR_URL 0x00200000
712 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000
713 #define wxTEXT_ATTR_EFFECTS 0x00800000
714 #define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
715 \end{verbatim}
716 }
717
718 \membersection{wxTextAttr::SetFont}\label{wxtextattrsetfont}
719
720 \func{void}{SetFont}{\param{const wxFont\&}{ font}}
721
722 Sets the attributes for the given font. Note that wxTextAttr does not store an actual wxFont object.
723
724 \membersection{wxTextAttr::SetFontEncoding}\label{wxtextattrsetfontencoding}
725
726 \func{void}{SetFontEncoding}{\param{wxFontEncoding }{encoding}}
727
728 Sets the font encoding.
729
730 \membersection{wxTextAttr::SetFontFaceName}\label{wxtextattrsetfontfacename}
731
732 \func{void}{SetFontFaceName}{\param{const wxString\& }{faceName}}
733
734 Sets the paragraph alignment.
735
736 \membersection{wxTextAttr::SetFontSize}\label{wxtextattrsetfontsize}
737
738 \func{void}{SetFontSize}{\param{int }{pointSize}}
739
740 Sets the font size in points.
741
742 \membersection{wxTextAttr::SetFontStyle}\label{wxtextattrsetfontstyle}
743
744 \func{void}{SetFontStyle}{\param{int }{fontStyle}}
745
746 Sets the font style (normal, italic or slanted).
747
748 \membersection{wxTextAttr::SetFontUnderlined}\label{wxtextattrsetfontunderlined}
749
750 \func{void}{SetFontUnderlined}{\param{bool }{underlined}}
751
752 Sets the font underlining.
753
754 \membersection{wxTextAttr::SetFontWeight}\label{wxtextattrsetfontweight}
755
756 \func{void}{SetFontWeight}{\param{int }{fontWeight}}
757
758 Sets the font weight.
759
760 \membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent}
761
762 \func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
763
764 Sets the left indent and left subindent in tenths of a millimetre.
765
766 The sub-indent is an offset from the left of the paragraph, and is used for all but the
767 first line in a paragraph. A positive value will cause the first line to appear to the left
768 of the subsequent lines, and a negative value will cause the first line to be indented
769 relative to the subsequent lines.
770
771 wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between
772 the margin and the bullet. The content of the paragraph, including the first line, starts
773 at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the
774 left of the actual paragraph is leftSubIndent.
775
776 \membersection{wxTextAttr::SetLineSpacing}\label{wxtextattrsetlinespacing}
777
778 \func{void}{SetLineSpacing}{\param{int }{spacing}}
779
780 Sets the line spacing. {\it spacing} is a multiple, where 10 means single-spacing,
781 15 means 1.5 spacing, and 20 means double spacing. The following constants are
782 defined for convenience:
783
784 {\small
785 \begin{verbatim}
786 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
787 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
788 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
789 \end{verbatim}
790 }
791
792 \membersection{wxTextAttr::SetListStyleName}\label{wxtextattrsetliststylename}
793
794 \func{void}{SetListStyleName}{\param{const wxString\& }{name}}
795
796 Sets the list style name.
797
798 \membersection{wxTextAttr::SetOutlineLevel}\label{wxtextattrsetoutlinelevel}
799
800 \func{void}{SetOutlineLevel}{\param{int}{ level}}
801
802 Specifies the outline level. Zero represents normal text. At present, the outline level is
803 not used, but may be used in future for determining list levels and for applications
804 that need to store document structure information.
805
806 \membersection{wxTextAttr::SetPageBreak}\label{wxtextattrsetpagebreak}
807
808 \func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}}
809
810 Specifies a page break before this paragraph.
811
812 \membersection{wxTextAttr::SetParagraphSpacingAfter}\label{wxtextattrsetparagraphspacingafter}
813
814 \func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
815
816 Sets the spacing after a paragraph, in tenths of a millimetre.
817
818 \membersection{wxTextAttr::SetParagraphSpacingBefore}\label{wxtextattrsetparagraphspacingbefore}
819
820 \func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
821
822 Sets the spacing before a paragraph, in tenths of a millimetre.
823
824 \membersection{wxTextAttr::SetParagraphStyleName}\label{wxtextattrsetparagraphstylename}
825
826 \func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
827
828 Sets the name of the paragraph style.
829
830 \membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent}
831
832 \func{void}{SetRightIndent}{\param{int }{indent}}
833
834 Sets the right indent in tenths of a millimetre.
835
836 \membersection{wxTextAttr::SetTabs}\label{wxtextattrsettabs}
837
838 \func{void}{SetTabs}{\param{const wxArrayInt\& }{tabs}}
839
840 Sets the tab stops, expressed in tenths of a millimetre.
841 Each stop is measured from the left margin and therefore each value must be larger than the last.
842
843 \membersection{wxTextAttr::SetTextColour}\label{wxtextattrsettextcolour}
844
845 \func{void}{SetTextColour}{\param{const wxColour\& }{colText}}
846
847 Sets the text foreground colout.
848
849 \membersection{wxTextAttr::SetTextEffectFlags}\label{wxtextattrsettexteffectflags}
850
851 \func{void}{SetTextEffectFlags}{\param{int }{flags}}
852
853 Sets the text effect bits of interest. You should also pass wxTEXT\_ATTR\_EFFECTS to \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}.
854 See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for further information.
855
856 \membersection{wxTextAttr::SetTextEffects}\label{wxtextattrsettexteffects}
857
858 \func{void}{SetTextEffects}{\param{int }{effects}}
859
860 Sets the text effects, a bit list of styles.
861
862 The following styles can be passed:
863
864 {\small
865 \begin{verbatim}
866 #define wxTEXT_ATTR_EFFECT_NONE 0x00000000
867 #define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
868 #define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
869 #define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
870 #define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
871 #define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
872 #define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
873 #define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
874 #define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
875 #define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
876 #define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
877 \end{verbatim}
878 }
879
880 Of these, only wxTEXT\_ATTR\_EFFECT\_CAPITALS and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH are implemented.
881 wxTEXT\_ATTR\_EFFECT\_CAPITALS capitalises text when displayed (leaving the case of the actual buffer
882 text unchanged), and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH draws a line through text.
883
884 To set effects, you should also pass wxTEXT\_ATTR\_EFFECTS to \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}, and call\rtfsp
885 \helpref{wxTextAttr::SetTextEffectFlags}{wxtextattrsettexteffectflags} with the styles (taken from the
886 above set) that you are interested in setting.
887
888 \membersection{wxTextAttr::SetURL}\label{wxtextattrseturl}
889
890 \func{void}{SetURL}{\param{const wxString\& }{url}}
891
892 Sets the URL for the content. Sets the wxTEXT\_ATTR\_URL style; content with this style
893 causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates
894 a wxTextUrlEvent when the content is clicked.
895
896 \membersection{wxTextAttr::operator=}\label{wxtextattroperatorassign}
897
898 \func{void operator}{operator=}{\param{const wxTextAttr\& }{attr}}
899
900 Assignment from a \helpref{wxTextAttr}{wxtextattr} object.
901