]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/textattrex.tex
clarified LeftIsDown() behaviour for left click events
[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_BULLET_STYLE 0x00010000
79 #define wxTEXT_ATTR_BULLET_NUMBER 0x00020000
80 #define wxTEXT_ATTR_BULLET_SYMBOL 0x00040000
81 \end{verbatim}
82 }
83
84 The following styles can be passed to wxRichTextAttr::SetBulletStyle:
85
86 {\small
87 \begin{verbatim}
88 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x0000
89 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x0001
90 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x0002
91 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x0004
92 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x0008
93 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x0010
94 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x0020
95 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x0040
96 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x0080
97 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x0100
98 \end{verbatim}
99 }
100
101 The following constants can be passed to wxRichTextAttr::SetLineSpacing:
102
103 {\small
104 \begin{verbatim}
105 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
106 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
107 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
108 \end{verbatim}
109 }
110
111 \wxheading{See also}
112
113 \helpref{wxTextAttr}{wxtextattr}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
114
115 \latexignore{\rtfignore{\wxheading{Members}}}
116
117
118 \membersection{wxTextAttrEx::wxTextAttrEx}\label{wxtextattrexwxtextattrex}
119
120 \func{}{wxTextAttrEx}{\void}
121
122
123 \func{}{wxTextAttrEx}{\param{const wxTextAttrEx\& }{attr}}
124
125 Constructors.
126
127 \membersection{wxTextAttrEx::GetBulletNumber}\label{wxtextattrexgetbulletnumber}
128
129 \constfunc{int}{GetBulletNumber}{\void}
130
131 Returns the bullet number.
132
133 \membersection{wxTextAttrEx::GetBulletStyle}\label{wxtextattrexgetbulletstyle}
134
135 \constfunc{int}{GetBulletStyle}{\void}
136
137 Returns the bullet style.
138 See \helpref{wxTextAttrEx::SetBulletStyle}{wxtextattrexsetbulletstyle} for a list of available styles.
139
140 \membersection{wxTextAttrEx::GetBulletSymbol}\label{wxtextattrexgetbulletsymbol}
141
142 \constfunc{wxChar}{GetBulletSymbol}{\void}
143
144 Returns the bullet symbol, a character.
145
146 \membersection{wxTextAttrEx::GetCharacterStyleName}\label{wxtextattrexgetcharacterstylename}
147
148 \constfunc{const wxString\&}{GetCharacterStyleName}{\void}
149
150 Returns the name of the character style.
151
152 \membersection{wxTextAttrEx::GetLineSpacing}\label{wxtextattrexgetlinespacing}
153
154 \constfunc{int}{GetLineSpacing}{\void}
155
156 Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
157 wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
158
159 \membersection{wxTextAttrEx::GetParagraphSpacingAfter}\label{wxtextattrexgetparagraphspacingafter}
160
161 \constfunc{int}{GetParagraphSpacingAfter}{\void}
162
163 Returns the space in tenths of a millimeter after the paragraph.
164
165 \membersection{wxTextAttrEx::GetParagraphSpacingBefore}\label{wxtextattrexgetparagraphspacingbefore}
166
167 \constfunc{int}{GetParagraphSpacingBefore}{\void}
168
169 Returns the space in tenths of a millimeter before the paragraph.
170
171 \membersection{wxTextAttrEx::GetParagraphStyleName}\label{wxtextattrexgetparagraphstylename}
172
173 \constfunc{const wxString\&}{GetParagraphStyleName}{\void}
174
175 Returns the name of the paragraph style.
176
177 \membersection{wxTextAttrEx::HasBulletNumber}\label{wxtextattrexhasbulletnumber}
178
179 \constfunc{bool}{HasBulletNumber}{\void}
180
181 Returns \true if the attribute object specifies a bullet number.
182
183 \membersection{wxTextAttrEx::HasBulletStyle}\label{wxtextattrexhasbulletstyle}
184
185 \constfunc{bool}{HasBulletStyle}{\void}
186
187 Returns \true if the attribute object specifies a bullet style.
188
189 \membersection{wxTextAttrEx::HasBulletSymbol}\label{wxtextattrexhasbulletsymbol}
190
191 \constfunc{bool}{HasBulletSymbol}{\void}
192
193 Returns \true if the attribute object specifies a bullet symbol.
194
195 \membersection{wxTextAttrEx::HasCharacterStyleName}\label{wxtextattrexhascharacterstylename}
196
197 \constfunc{bool}{HasCharacterStyleName}{\void}
198
199 Returns \true if the attribute object specifies a character style name.
200
201 \membersection{wxTextAttrEx::HasLineSpacing}\label{wxtextattrexhaslinespacing}
202
203 \constfunc{bool}{HasLineSpacing}{\void}
204
205 Returns \true if the attribute object specifies line spacing.
206
207 \membersection{wxTextAttrEx::HasParagraphSpacingAfter}\label{wxtextattrexhasparagraphspacingafter}
208
209 \constfunc{bool}{HasParagraphSpacingAfter}{\void}
210
211 Returns \true if the attribute object specifies spacing after a paragraph.
212
213 \membersection{wxTextAttrEx::HasParagraphSpacingBefore}\label{wxtextattrexhasparagraphspacingbefore}
214
215 \constfunc{bool}{HasParagraphSpacingBefore}{\void}
216
217 Returns \true if the attribute object specifies spacing before a paragraph.
218
219 \membersection{wxTextAttrEx::HasParagraphStyleName}\label{wxtextattrexhasparagraphstylename}
220
221 \constfunc{bool}{HasParagraphStyleName}{\void}
222
223 Returns \true if the attribute object specifies a paragraph style name.
224
225 \membersection{wxTextAttrEx::Init}\label{wxtextattrexinit}
226
227 \func{void}{Init}{\void}
228
229 Initialises this object.
230
231 \membersection{wxTextAttrEx::IsCharacterStyle}\label{wxtextattrexischaracterstyle}
232
233 \constfunc{bool}{IsCharacterStyle}{\void}
234
235 Returns \true if the object represents a character style, that is,
236 the flags specify a font or a text background or foreground colour.
237
238 \membersection{wxTextAttrEx::IsDefault}\label{wxtextattrexisdefault}
239
240 \constfunc{bool}{IsDefault}{\void}
241
242 Returns \false if we have any attributes set, \true otherwise.
243
244 \membersection{wxTextAttrEx::IsParagraphStyle}\label{wxtextattrexisparagraphstyle}
245
246 \constfunc{bool}{IsParagraphStyle}{\void}
247
248 Returns \true if the object represents a paragraph style, that is,
249 the flags specify alignment, indentation, tabs, paragraph spacing, or
250 bullet style.
251
252 \membersection{wxTextAttrEx::SetBulletNumber}\label{wxtextattrexsetbulletnumber}
253
254 \func{void}{SetBulletNumber}{\param{int }{n}}
255
256 Sets the bullet number.
257
258 \membersection{wxTextAttrEx::SetBulletStyle}\label{wxtextattrexsetbulletstyle}
259
260 \func{void}{SetBulletStyle}{\param{int }{style}}
261
262 Sets the bullet style. The following styles can be passed:
263
264 {\small
265 \begin{verbatim}
266 #define wxTEXT_ATTR_BULLET_STYLE_NONE 0x0000
267 #define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x0001
268 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x0002
269 #define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x0004
270 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x0008
271 #define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x0010
272 #define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x0020
273 #define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x0040
274 #define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x0080
275 #define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x0100
276 \end{verbatim}
277 }
278
279 \membersection{wxTextAttrEx::SetBulletSymbol}\label{wxtextattrexsetbulletsymbol}
280
281 \func{void}{SetBulletSymbol}{\param{wxChar }{symbol}}
282
283 Sets the paragraph symbol.
284
285 \membersection{wxTextAttrEx::SetCharacterStyleName}\label{wxtextattrexsetcharacterstylename}
286
287 \func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
288
289 Sets the character style name.
290
291 \membersection{wxTextAttrEx::SetLineSpacing}\label{wxtextattrexsetlinespacing}
292
293 \func{void}{SetLineSpacing}{\param{int }{spacing}}
294
295 Sets the line spacing. {\it spacing} is a multiple, where 10 means single-spacing,
296 15 means 1.5 spacing, and 20 means double spacing. The following constants are
297 defined for convenience:
298
299 {\small
300 \begin{verbatim}
301 #define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
302 #define wxTEXT_ATTR_LINE_SPACING_HALF 15
303 #define wxTEXT_ATTR_LINE_SPACING_TWICE 20
304 \end{verbatim}
305 }
306
307 \membersection{wxTextAttrEx::SetParagraphSpacingAfter}\label{wxtextattrexsetparagraphspacingafter}
308
309 \func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
310
311 Sets the spacing after a paragraph, in tenths of a millimetre.
312
313 \membersection{wxTextAttrEx::SetParagraphSpacingBefore}\label{wxtextattrexsetparagraphspacingbefore}
314
315 \func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
316
317 Sets the spacing before a paragraph, in tenths of a millimetre.
318
319 \membersection{wxTextAttrEx::SetParagraphStyleName}\label{wxtextattrexsetparagraphstylename}
320
321 \func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
322
323 Sets the name of the paragraph style.
324
325 \membersection{wxTextAttrEx::operator=}\label{wxtextattrexoperatorassign}
326
327 \func{void operator}{operator=}{\param{const wxTextAttr\& }{attr}}
328
329 Assignment from a wxTextAttr object.
330
331 \func{void operator}{operator=}{\param{const wxTextAttrEx\& }{attr}}
332
333 Assignment from a wxTextAttrEx object.