]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/textattrex.tex
Add a topc overview about window sizing
[wxWidgets.git] / docs / latex / wx / textattrex.tex
1 \section{\class{wxTextAttrEx}}\label{wxtextattrex}
2
3 wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes.
4 Currently it is only used with \helpref{wxRichTextCtrl}{wxrichtextctrl}.
5
6 It is intended that eventually, the members of wxTextAttrEx will
7 be folded into wxTextAttr, and wxTextAttr will be the official
8 cross-platform API for text controls that support attributes.
9 However, for now, wxTextAttrEx is provided as a means of enabling
10 extra functionality in wxRichTextCtrl, while retaining some compatibility
11 with the wxTextAttr API.
12
13 The most efficient method of accessing wxRichTextCtrl functionality
14 is a third attribute class, \helpref{wxRichTextAttr}{wxrichtextattr}, which
15 optimizes its storage to allow it to be used for implementing objects
16 in a buffer, as well as access to that buffer.
17
18 This section only documents the additional members; see \helpref{wxTextAttr}{wxtextattr} for
19 the remaining functions.
20
21 \wxheading{Derived from}
22
23 \helpref{wxTextAttr}{wxtextattr}
24
25 \wxheading{Include files}
26
27 <wx/richtext/richtextbuffer.h>
28
29 \wxheading{Constants}
30
31 The following values can be passed to SetAlignment to determine
32 paragraph alignment.
33
34 {\small
35 \begin{verbatim}
36 enum wxTextAttrAlignment
37 {
38 wxTEXT_ALIGNMENT_DEFAULT,
39 wxTEXT_ALIGNMENT_LEFT,
40 wxTEXT_ALIGNMENT_CENTRE,
41 wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
42 wxTEXT_ALIGNMENT_RIGHT,
43 wxTEXT_ALIGNMENT_JUSTIFIED
44 };
45 \end{verbatim}
46 }
47
48 These values are passed in a bitlist to SetFlags to determine
49 what attributes will be considered when setting the attributes
50 for a text control.
51
52 {\small
53 \begin{verbatim}
54 // Standard wxTextAttr constants
55
56 #define wxTEXT_ATTR_TEXT_COLOUR 0x0001
57 #define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002
58 #define wxTEXT_ATTR_FONT_FACE 0x0004
59 #define wxTEXT_ATTR_FONT_SIZE 0x0008
60 #define wxTEXT_ATTR_FONT_WEIGHT 0x0010
61 #define wxTEXT_ATTR_FONT_ITALIC 0x0020
62 #define wxTEXT_ATTR_FONT_UNDERLINE 0x0040
63 #define wxTEXT_ATTR_FONT \
64 wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \
65 | wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE
66 #define wxTEXT_ATTR_ALIGNMENT 0x0080
67 #define wxTEXT_ATTR_LEFT_INDENT 0x0100
68 #define wxTEXT_ATTR_RIGHT_INDENT 0x0200
69 #define wxTEXT_ATTR_TABS 0x0400
70
71 // Extra formatting flags not in wxTextAttr
72
73 #define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800
74 #define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000
75 #define wxTEXT_ATTR_LINE_SPACING 0x00002000
76 #define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000
77 #define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000
78 #define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000
79 #define wxTEXT_ATTR_BULLET_STYLE 0x00020000
80 #define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
81 #define wxTEXT_ATTR_BULLET_TEXT 0x00080000
82 #define wxTEXT_ATTR_BULLET_NAME 0x00100000
83 #define wxTEXT_ATTR_URL 0x00200000
84 #define wxTEXT_ATTR_PAGE_BREAK 0x00400000
85 \end{verbatim}
86 }
87
88 The following styles can be passed to wxRichTextAttr::SetBulletStyle:
89
90 {\small
91 \begin{verbatim}
92 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
93 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
94 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
95 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
96 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
97 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
98 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
99 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
100 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
101 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
102 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
103 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
104 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
105 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
106 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
107 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
108 \end{verbatim}
109 }
110
111 The following constants can be passed to wxRichTextAttr::SetLineSpacing:
112
113 {\small
114 \begin{verbatim}
115 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
116 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
117 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
118 \end{verbatim}
119 }
120
121 \wxheading{See also}
122
123 \helpref{wxTextAttr}{wxtextattr}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
124
125 \latexignore{\rtfignore{\wxheading{Members}}}
126
127
128 \membersection{wxTextAttrEx::wxTextAttrEx}\label{wxtextattrexwxtextattrex}
129
130 \func{}{wxTextAttrEx}{\void}
131
132
133 \func{}{wxTextAttrEx}{\param{const wxTextAttrEx\& }{attr}}
134
135 Constructors.
136
137 \membersection{wxTextAttrEx::GetBulletFont}\label{wxtextattrexgetbulletfont}
138
139 \constfunc{const wxString\&}{GetBulletFont}{\void}
140
141 Returns a string containing the name of the font associated with the bullet symbol.
142 Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
143
144 \membersection{wxTextAttrEx::GetBulletName}\label{wxtextattrexgetbulletname}
145
146 \constfunc{const wxString\&}{GetBulletName}{\void}
147
148 Returns the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
149 Currently the following standard bullet names are supported:
150
151 \begin{itemize}\itemsep=0pt
152 \item {\tt standard/circle}
153 \item {\tt standard/square}
154 \item {\tt standard/diamond}
155 \item {\tt standard/triangle}
156 \end{itemize}
157
158 If you wish your application to support further bullet graphics, you can derive a
159 class from wxRichTextRenderer or wxRichTextStdRenderer, override {\tt DrawStandardBullet} and {\tt EnumerateStandardBulletNames}, and
160 set an instance of the class using \helpref{wxRichTextBuffer::SetRenderer}{wxrichtextbuffersetrenderer}.
161
162 \membersection{wxTextAttrEx::GetBulletNumber}\label{wxtextattrexgetbulletnumber}
163
164 \constfunc{int}{GetBulletNumber}{\void}
165
166 Returns the bullet number.
167
168 \membersection{wxTextAttrEx::GetBulletStyle}\label{wxtextattrexgetbulletstyle}
169
170 \constfunc{int}{GetBulletStyle}{\void}
171
172 Returns the bullet style.
173 See \helpref{wxTextAttrEx::SetBulletStyle}{wxtextattrexsetbulletstyle} for a list of available styles.
174
175 \membersection{wxTextAttrEx::GetBulletText}\label{wxrichtextattrgetbullettext}
176
177 \constfunc{const wxString\&}{GetBulletText}{\void}
178
179 Returns the bullet text, which could be a symbol, or (for example) cached outline text.
180
181 \membersection{wxTextAttrEx::GetCharacterStyleName}\label{wxtextattrexgetcharacterstylename}
182
183 \constfunc{const wxString\&}{GetCharacterStyleName}{\void}
184
185 Returns the name of the character style.
186
187 \membersection{wxTextAttrEx::GetLineSpacing}\label{wxtextattrexgetlinespacing}
188
189 \constfunc{int}{GetLineSpacing}{\void}
190
191 Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
192 wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
193
194 \membersection{wxTextAttrEx::GetListStyleName}\label{wxtextattrexgetliststylename}
195
196 \constfunc{const wxString\&}{GetListStyleName}{\void}
197
198 Returns the name of the list style.
199
200 \membersection{wxTextAttrEx::GetParagraphSpacingAfter}\label{wxtextattrexgetparagraphspacingafter}
201
202 \constfunc{int}{GetParagraphSpacingAfter}{\void}
203
204 Returns the space in tenths of a millimeter after the paragraph.
205
206 \membersection{wxTextAttrEx::GetParagraphSpacingBefore}\label{wxtextattrexgetparagraphspacingbefore}
207
208 \constfunc{int}{GetParagraphSpacingBefore}{\void}
209
210 Returns the space in tenths of a millimeter before the paragraph.
211
212 \membersection{wxTextAttrEx::GetParagraphStyleName}\label{wxtextattrexgetparagraphstylename}
213
214 \constfunc{const wxString\&}{GetParagraphStyleName}{\void}
215
216 Returns the name of the paragraph style.
217
218 \membersection{wxTextAttrEx::GetURL}\label{wxtextattrexgeturl}
219
220 \constfunc{const wxString\&}{GetURL}{\void}
221
222 Returns the URL for the content. Content with wxTEXT\_ATTR\_URL style
223 causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates
224 a wxTextUrlEvent when the content is clicked.
225
226 \membersection{wxTextAttrEx::HasBulletName}\label{wxtextattrexhasbulletname}
227
228 \constfunc{bool}{HasBulletName}{\void}
229
230 Returns \true if the attribute object specifies a standard bullet name.
231
232 \membersection{wxTextAttrEx::HasBulletNumber}\label{wxtextattrexhasbulletnumber}
233
234 \constfunc{bool}{HasBulletNumber}{\void}
235
236 Returns \true if the attribute object specifies a bullet number.
237
238 \membersection{wxTextAttrEx::HasBulletStyle}\label{wxtextattrexhasbulletstyle}
239
240 \constfunc{bool}{HasBulletStyle}{\void}
241
242 Returns \true if the attribute object specifies a bullet style.
243
244 \membersection{wxTextAttrEx::HasBulletText}\label{wxtextattrexhasbullettext}
245
246 \constfunc{bool}{HasBulletText}{\void}
247
248 Returns \true if the attribute object specifies bullet text (usually containing a symbol).
249
250 \membersection{wxTextAttrEx::HasCharacterStyleName}\label{wxtextattrexhascharacterstylename}
251
252 \constfunc{bool}{HasCharacterStyleName}{\void}
253
254 Returns \true if the attribute object specifies a character style name.
255
256 \membersection{wxTextAttrEx::HasLineSpacing}\label{wxtextattrexhaslinespacing}
257
258 \constfunc{bool}{HasLineSpacing}{\void}
259
260 Returns \true if the attribute object specifies line spacing.
261
262 \membersection{wxTextAttrEx::HasListStyleName}\label{wxtextattrexhasliststylename}
263
264 \constfunc{bool}{HasListStyleName}{\void}
265
266 Returns \true if the attribute object specifies a list style name.
267
268 \membersection{wxTextAttrEx::HasPageBreak}\label{wxtextattrexhaspagebreak}
269
270 \constfunc{bool}{HasPageBreak}{\void}
271
272 Returns \true if the attribute object specifies a page break before this paragraph.
273
274 \membersection{wxTextAttrEx::HasParagraphSpacingAfter}\label{wxtextattrexhasparagraphspacingafter}
275
276 \constfunc{bool}{HasParagraphSpacingAfter}{\void}
277
278 Returns \true if the attribute object specifies spacing after a paragraph.
279
280 \membersection{wxTextAttrEx::HasParagraphSpacingBefore}\label{wxtextattrexhasparagraphspacingbefore}
281
282 \constfunc{bool}{HasParagraphSpacingBefore}{\void}
283
284 Returns \true if the attribute object specifies spacing before a paragraph.
285
286 \membersection{wxTextAttrEx::HasParagraphStyleName}\label{wxtextattrexhasparagraphstylename}
287
288 \constfunc{bool}{HasParagraphStyleName}{\void}
289
290 Returns \true if the attribute object specifies a paragraph style name.
291
292 \membersection{wxTextAttrEx::Init}\label{wxtextattrexinit}
293
294 \func{void}{Init}{\void}
295
296 Initialises this object.
297
298 \membersection{wxTextAttrEx::IsCharacterStyle}\label{wxtextattrexischaracterstyle}
299
300 \constfunc{bool}{IsCharacterStyle}{\void}
301
302 Returns \true if the object represents a character style, that is,
303 the flags specify a font or a text background or foreground colour.
304
305 \membersection{wxTextAttrEx::IsDefault}\label{wxtextattrexisdefault}
306
307 \constfunc{bool}{IsDefault}{\void}
308
309 Returns \false if we have any attributes set, \true otherwise.
310
311 \membersection{wxTextAttrEx::IsParagraphStyle}\label{wxtextattrexisparagraphstyle}
312
313 \constfunc{bool}{IsParagraphStyle}{\void}
314
315 Returns \true if the object represents a paragraph style, that is,
316 the flags specify alignment, indentation, tabs, paragraph spacing, or
317 bullet style.
318
319 \membersection{wxTextAttrEx::SetBulletFont}\label{wxtextattrexsetbulletfont}
320
321 \func{void}{SetBulletFont}{\param{const wxString\& }{font}}
322
323 Sets the name of the font associated with the bullet symbol.
324 Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
325
326 \membersection{wxTextAttrEx::SetBulletNumber}\label{wxtextattrexsetbulletnumber}
327
328 \func{void}{SetBulletNumber}{\param{int }{n}}
329
330 Sets the bullet number.
331
332 \membersection{wxTextAttrEx::SetBulletName}\label{wxtextattrexsetbulletname}
333
334 \func{void}{SetBulletName}{\param{const wxString\& }{name}}
335
336 Sets the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
337 See \helpref{wxTextAttrEx::GetBulletName}{wxtextattrexgetbulletname} for a list
338 of supported names, and how to expand the range of supported types.
339
340 \membersection{wxTextAttrEx::SetBulletStyle}\label{wxtextattrexsetbulletstyle}
341
342 \func{void}{SetBulletStyle}{\param{int }{style}}
343
344 Sets the bullet style. The following styles can be passed:
345
346 {\small
347 \begin{verbatim}
348 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
349 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
350 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
351 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
352 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
353 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
354 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
355 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
356 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
357 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
358 #define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
359 #define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
360 #define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
361 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
362 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
363 #define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
364 \end{verbatim}
365 }
366
367 \membersection{wxTextAttrEx::SetBulletText}\label{wxtextattrexsetbullettext}
368
369 \func{void}{SetBulletText}{\param{const wxString\& }{text}}
370
371 Sets the bullet text, which could be a symbol, or (for example) cached outline text.
372
373 \membersection{wxTextAttrEx::SetCharacterStyleName}\label{wxtextattrexsetcharacterstylename}
374
375 \func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
376
377 Sets the character style name.
378
379 \membersection{wxTextAttrEx::SetLineSpacing}\label{wxtextattrexsetlinespacing}
380
381 \func{void}{SetLineSpacing}{\param{int }{spacing}}
382
383 Sets the line spacing. {\it spacing} is a multiple, where 10 means single-spacing,
384 15 means 1.5 spacing, and 20 means double spacing. The following constants are
385 defined for convenience:
386
387 {\small
388 \begin{verbatim}
389 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
390 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
391 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
392 \end{verbatim}
393 }
394
395 \membersection{wxTextAttrEx::SetListStyleName}\label{wxtextattrexsetliststylename}
396
397 \func{void}{SetListStyleName}{\param{const wxString\& }{name}}
398
399 Sets the list style name.
400
401 \membersection{wxTextAttrEx::SetPageBreak}\label{wxtextattrexsetpagebreak}
402
403 \func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}}
404
405 Specifies a page break before this paragraph.
406
407 \membersection{wxTextAttrEx::SetParagraphSpacingAfter}\label{wxtextattrexsetparagraphspacingafter}
408
409 \func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
410
411 Sets the spacing after a paragraph, in tenths of a millimetre.
412
413 \membersection{wxTextAttrEx::SetParagraphSpacingBefore}\label{wxtextattrexsetparagraphspacingbefore}
414
415 \func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
416
417 Sets the spacing before a paragraph, in tenths of a millimetre.
418
419 \membersection{wxTextAttrEx::SetParagraphStyleName}\label{wxtextattrexsetparagraphstylename}
420
421 \func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
422
423 Sets the name of the paragraph style.
424
425 \membersection{wxTextAttrEx::SetURL}\label{wxtextattrexseturl}
426
427 \func{void}{SetURL}{\param{const wxString\& }{url}}
428
429 Sets the URL for the content. Sets the wxTEXT\_ATTR\_URL style; content with this style
430 causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates
431 a wxTextUrlEvent when the content is clicked.
432
433 \membersection{wxTextAttrEx::operator=}\label{wxtextattrexoperatorassign}
434
435 \func{void operator}{operator=}{\param{const wxTextAttr\& }{attr}}
436
437 Assignment from a wxTextAttr object.
438
439 \func{void operator}{operator=}{\param{const wxTextAttrEx\& }{attr}}
440
441 Assignment from a wxTextAttrEx object.
442