]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/textattr.tex
use WX_DEFINE_ARRAY_INT for an array of ints (bug 1536482)
[wxWidgets.git] / docs / latex / wx / textattr.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%% wxTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 \section{\class{wxTextAttr}}\label{wxtextattr}
4
5 wxTextAttr represents the character and paragraph attributes, or style, for a range of text in a\rtfsp
6 \helpref{wxTextCtrl}{wxtextctrl}.
7
8 When setting up a wxTextAttr object, pass a bitlist mask to SetFlags to indicate
9 which style elements should be changed. As a convenience, when you call a
10 setter such as SetFont, the relevant bit will be set.
11
12 \wxheading{Derived from}
13
14 No base class
15
16 \wxheading{Include files}
17
18 <wx/textctrl.h>
19
20 \wxheading{Typedefs}
21
22 \texttt{wxTextPos} is the type containing the index of a position in a text
23 control. \texttt{wxTextCoord} contains the index of a column or a row in the
24 control.
25
26 Note that although both of these types should probably have been unsigned, due
27 to backwards compatibility reasons, are defined as \texttt{long} currently.
28 Their use (instead of plain \texttt{long}) is still encouraged as it makes the
29 code more readable.
30
31 \wxheading{Constants}
32
33 The following values can be passed to SetAlignment to determine
34 paragraph alignment.
35
36 {\small
37 \begin{verbatim}
38 enum wxTextAttrAlignment
39 {
40 wxTEXT_ALIGNMENT_DEFAULT,
41 wxTEXT_ALIGNMENT_LEFT,
42 wxTEXT_ALIGNMENT_CENTRE,
43 wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
44 wxTEXT_ALIGNMENT_RIGHT,
45 wxTEXT_ALIGNMENT_JUSTIFIED
46 };
47 \end{verbatim}
48 }
49
50 These values are passed in a bitlist to SetFlags to determine
51 what attributes will be considered when setting the attributes
52 for a text control.
53
54 {\small
55 \begin{verbatim}
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 \end{verbatim}
71 }
72
73 \latexignore{\rtfignore{\wxheading{Members}}}
74
75
76 \membersection{wxTextAttr::wxTextAttr}\label{wxtextattrctor}
77
78 \func{}{wxTextAttr}{\void}
79
80 \func{}{wxTextAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour},
81 \param{const wxFont\& }{font = wxNullFont}, \param{wxTextAttrAlignment }{alignment = wxTEXT\_ALIGNMENT\_DEFAULT}}
82
83 The constructors initialize one or more of the text foreground colour, background
84 colour, font, and alignment. The values not initialized in the constructor can be set
85 later, otherwise \helpref{wxTextCtrl::SetStyle}{wxtextctrlsetstyle} will use
86 the default values for them.
87
88
89 \membersection{wxTextAttr::GetAlignment}\label{wxtextattrgetalignment}
90
91 \constfunc{wxTextAttrAlignment}{GetAlignment}{\void}
92
93 Returns the paragraph alignment.
94
95
96 \membersection{wxTextAttr::GetBackgroundColour}\label{wxtextattrgetbackgroundcolour}
97
98 \constfunc{const wxColour\&}{GetBackgroundColour}{\void}
99
100 Return the background colour specified by this attribute.
101
102
103 \membersection{wxTextAttr::GetFont}\label{wxtextattrgetfont}
104
105 \constfunc{const wxFont\&}{GetFont}{\void}
106
107 Return the text font specified by this attribute.
108
109
110 \membersection{wxTextAttr::GetLeftIndent}\label{wxtextattrgetleftindent}
111
112 \constfunc{int}{GetLeftIndent}{\void}
113
114 Returns the left indent in tenths of a millimetre.
115
116
117 \membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent}
118
119 \constfunc{int}{GetLeftSubIndent}{\void}
120
121 Returns the left sub indent for all lines but the first line in a paragraph in
122 tenths of a millimetre.
123
124
125 \membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent}
126
127 \constfunc{int}{GetRightIndent}{\void}
128
129 Returns the right indent in tenths of a millimetre.
130
131
132 \membersection{wxTextAttr::GetTabs}\label{wxtextattrgettabs}
133
134 \constfunc{const wxArrayInt\&}{GetTabs}{\void}
135
136 Returns the array of integers representing the tab stops. Each
137 array element specifies the tab stop in tenths of a millimetre.
138
139
140 \membersection{wxTextAttr::GetTextColour}\label{wxtextattrgettextcolour}
141
142 \constfunc{const wxColour\&}{GetTextColour}{\void}
143
144 Return the text colour specified by this attribute.
145
146
147 \membersection{wxTextAttr::HasAlignment}\label{wxtextattrhasalignment}
148
149 \constfunc{bool}{HasAlignment}{\void}
150
151 Returns {\tt true} if this style specifies the text alignment.
152
153
154 \membersection{wxTextAttr::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour}
155
156 \constfunc{bool}{HasBackgroundColour}{\void}
157
158 Returns {\tt true} if this style specifies the background colour to use.
159
160
161 \membersection{wxTextAttr::HasFont}\label{wxtextattrhasfont}
162
163 \constfunc{bool}{HasFont}{\void}
164
165 Returns {\tt true} if this style specifies the font to use.
166
167
168 \membersection{wxTextAttr::HasLeftIndent}\label{wxtextattrhasleftindent}
169
170 \constfunc{bool}{HasLeftIndent}{\void}
171
172 Returns {\tt true} if this style specifies the left indent.
173
174
175 \membersection{wxTextAttr::HasRightIndent}\label{wxtextattrhasrightindent}
176
177 \constfunc{bool}{HasRightIndent}{\void}
178
179 Returns {\tt true} if this style specifies the right indent.
180
181
182 \membersection{wxTextAttr::HasTabs}\label{wxtextattrhastabs}
183
184 \constfunc{bool}{HasTabs}{\void}
185
186 Returns {\tt true} if this style specifies any tabstobs.
187
188
189 \membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour}
190
191 \constfunc{bool}{HasTextColour}{\void}
192
193 Returns {\tt true} if this style specifies the foreground colour to use.
194
195
196 \membersection{wxTextAttr::GetFlags}\label{wxtextattrgetflags}
197
198 \func{long}{GetFlags}{\void}
199
200 Returns a bitlist indicating which attributes will be set.
201
202
203 \membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault}
204
205 \constfunc{bool}{IsDefault}{\void}
206
207 Returns {\tt true} if this style specifies any non-default attributes.
208
209
210 \membersection{wxTextAttr::Merge}\label{wxtextattrmerge}
211
212 \func{void}{Merge}{\param{const wxTextAttr\&}{ overlay}}
213
214 Copies all defined/valid properties from \arg{overlay} to current object.
215
216 \func{static wxTextAttr}{Merge}{\param{const wxTextAttr\&}{ base}, \param{const wxTextAttr\&}{ overlay}}
217
218 Creates a new {\tt wxTextAttr} which is a merge of \arg{base} and
219 \arg{overlay}. Properties defined in \arg{overlay} take precedence over those
220 in \arg{base}. Properties undefined/invalid in both are undefined in the
221 result.
222
223
224 \membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment}
225
226 \func{void}{SetAlignment}{\param{wxTextAttrAlignment}{ alignment}}
227
228 Sets the paragraph alignment.
229
230
231 \membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour}
232
233 \func{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
234
235 Sets the background colour.
236
237
238 \membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags}
239
240 \func{void}{SetFlags}{\param{long}{ flags}}
241
242 Pass a bitlist indicating which attributes will be set.
243
244
245 \membersection{wxTextAttr::SetFont}\label{wxtextattrsetfont}
246
247 \func{void}{SetFont}{\param{const wxFont\&}{ font}}
248
249 Sets the text font.
250
251
252 \membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent}
253
254 \func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
255
256 Sets the left indent in tenths of a millimetre.
257 subIndent sets the indent for all lines but the first line in a paragraph
258 relative to the first line.
259
260
261 \membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent}
262
263 \func{void}{SetRightIndent}{\param{int }{indent}}
264
265 Sets the right indent in tenths of a millimetre.
266
267
268 \membersection{wxTextAttr::SetTabs}\label{wxtextattrsettabs}
269
270 \func{void}{SetTabs}{\param{const wxArrayInt\&}{ tabs}}
271
272 Sets the array of integers representing the tab stops. Each
273 array element specifies the tab stop in tenths of a millimetre.
274
275
276 \membersection{wxTextAttr::SetTextColour}\label{wxtextattrsettextcolour}
277
278 \func{void}{SetTextColour}{\param{const wxColour\& }{colour}}
279
280 Sets the text colour.
281