]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/textattr.tex
wxBORDER_THEME now means 'use an appropriate themed border' on all plaforms
[wxWidgets.git] / docs / latex / wx / textattr.tex
CommitLineData
5f35b46a
JS
1%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3\section{\class{wxTextAttr}}\label{wxtextattr}
4
5wxTextAttr represents the character and paragraph attributes, or style, for a range of text in a\rtfsp
6\helpref{wxTextCtrl}{wxtextctrl}.
7
8When setting up a wxTextAttr object, pass a bitlist mask to SetFlags to indicate
9which style elements should be changed. As a convenience, when you call a
10setter such as SetFont, the relevant bit will be set.
11
12\wxheading{Derived from}
13
14No base class
15
16\wxheading{Include files}
17
18<wx/textctrl.h>
19
a7af285d
VZ
20\wxheading{Library}
21
22\helpref{wxCore}{librarieslist}
23
5f35b46a
JS
24\wxheading{Typedefs}
25
26\texttt{wxTextPos} is the type containing the index of a position in a text
27control. \texttt{wxTextCoord} contains the index of a column or a row in the
28control.
29
30Note that although both of these types should probably have been unsigned, due
31to backwards compatibility reasons, are defined as \texttt{long} currently.
32Their use (instead of plain \texttt{long}) is still encouraged as it makes the
33code more readable.
34
35\wxheading{Constants}
36
37The following values can be passed to SetAlignment to determine
38paragraph alignment.
39
40{\small
41\begin{verbatim}
42enum 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
54These values are passed in a bitlist to SetFlags to determine
55what attributes will be considered when setting the attributes
56for 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
87The constructors initialize one or more of the text foreground colour, background
88colour, font, and alignment. The values not initialized in the constructor can be set
89later, otherwise \helpref{wxTextCtrl::SetStyle}{wxtextctrlsetstyle} will use
90the default values for them.
91
92
93\membersection{wxTextAttr::GetAlignment}\label{wxtextattrgetalignment}
94
95\constfunc{wxTextAttrAlignment}{GetAlignment}{\void}
96
97Returns the paragraph alignment.
98
99
100\membersection{wxTextAttr::GetBackgroundColour}\label{wxtextattrgetbackgroundcolour}
101
102\constfunc{const wxColour\&}{GetBackgroundColour}{\void}
103
104Return the background colour specified by this attribute.
105
106
107\membersection{wxTextAttr::GetFont}\label{wxtextattrgetfont}
108
109\constfunc{const wxFont\&}{GetFont}{\void}
110
111Return the text font specified by this attribute.
112
113
114\membersection{wxTextAttr::GetLeftIndent}\label{wxtextattrgetleftindent}
115
116\constfunc{int}{GetLeftIndent}{\void}
117
118Returns the left indent in tenths of a millimetre.
119
120
121\membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent}
122
123\constfunc{int}{GetLeftSubIndent}{\void}
124
125Returns the left sub indent for all lines but the first line in a paragraph in
126tenths of a millimetre.
127
128
129\membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent}
130
131\constfunc{int}{GetRightIndent}{\void}
132
133Returns the right indent in tenths of a millimetre.
134
135
136\membersection{wxTextAttr::GetTabs}\label{wxtextattrgettabs}
137
138\constfunc{const wxArrayInt\&}{GetTabs}{\void}
139
140Returns the array of integers representing the tab stops. Each
141array 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
148Return the text colour specified by this attribute.
149
150
9ec83118
VZ
151\membersection{wxTextAttr::HasAlignment}\label{wxtextattrhasalignment}
152
153\constfunc{bool}{HasAlignment}{\void}
154
155Returns {\tt true} if this style specifies the text alignment.
156
157
5f35b46a
JS
158\membersection{wxTextAttr::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour}
159
160\constfunc{bool}{HasBackgroundColour}{\void}
161
162Returns {\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
169Returns {\tt true} if this style specifies the font to use.
170
171
9ec83118
VZ
172\membersection{wxTextAttr::HasLeftIndent}\label{wxtextattrhasleftindent}
173
174\constfunc{bool}{HasLeftIndent}{\void}
175
176Returns {\tt true} if this style specifies the left indent.
177
178
179\membersection{wxTextAttr::HasRightIndent}\label{wxtextattrhasrightindent}
180
181\constfunc{bool}{HasRightIndent}{\void}
182
183Returns {\tt true} if this style specifies the right indent.
184
185
186\membersection{wxTextAttr::HasTabs}\label{wxtextattrhastabs}
187
188\constfunc{bool}{HasTabs}{\void}
189
190Returns {\tt true} if this style specifies any tabstobs.
191
192
5f35b46a
JS
193\membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour}
194
195\constfunc{bool}{HasTextColour}{\void}
196
197Returns {\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
204Returns a bitlist indicating which attributes will be set.
205
206
207\membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault}
208
209\constfunc{bool}{IsDefault}{\void}
210
211Returns {\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
218Copies 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
222Creates a new {\tt wxTextAttr} which is a merge of \arg{base} and
223\arg{overlay}. Properties defined in \arg{overlay} take precedence over those
224in \arg{base}. Properties undefined/invalid in both are undefined in the
225result.
226
227
228\membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment}
229
230\func{void}{SetAlignment}{\param{wxTextAttrAlignment}{ alignment}}
231
232Sets the paragraph alignment.
233
234
235\membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour}
236
237\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}}
238
239Sets the background colour.
240
241
242\membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags}
243
244\func{void}{SetFlags}{\param{long}{ flags}}
245
246Pass 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
253Sets the text font.
254
255
256\membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent}
257
258\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
259
260Sets the left indent in tenths of a millimetre.
261subIndent sets the indent for all lines but the first line in a paragraph
262relative to the first line.
263
264
265\membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent}
266
267\func{void}{SetRightIndent}{\param{int }{indent}}
268
269Sets 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
276Sets the array of integers representing the tab stops. Each
277array 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
284Sets the text colour.
b67a86d5 285