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