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