]>
Commit | Line | Data |
---|---|---|
5f35b46a JS |
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::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour} | |
148 | ||
149 | \constfunc{bool}{HasBackgroundColour}{\void} | |
150 | ||
151 | Returns {\tt true} if this style specifies the background colour to use. | |
152 | ||
153 | ||
154 | \membersection{wxTextAttr::HasFont}\label{wxtextattrhasfont} | |
155 | ||
156 | \constfunc{bool}{HasFont}{\void} | |
157 | ||
158 | Returns {\tt true} if this style specifies the font to use. | |
159 | ||
160 | ||
161 | \membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour} | |
162 | ||
163 | \constfunc{bool}{HasTextColour}{\void} | |
164 | ||
165 | Returns {\tt true} if this style specifies the foreground colour to use. | |
166 | ||
167 | ||
168 | \membersection{wxTextAttr::GetFlags}\label{wxtextattrgetflags} | |
169 | ||
170 | \func{long}{GetFlags}{\void} | |
171 | ||
172 | Returns a bitlist indicating which attributes will be set. | |
173 | ||
174 | ||
175 | \membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault} | |
176 | ||
177 | \constfunc{bool}{IsDefault}{\void} | |
178 | ||
179 | Returns {\tt true} if this style specifies any non-default attributes. | |
180 | ||
181 | ||
182 | \membersection{wxTextAttr::Merge}\label{wxtextattrmerge} | |
183 | ||
184 | \func{void}{Merge}{\param{const wxTextAttr\&}{ overlay}} | |
185 | ||
186 | Copies all defined/valid properties from \arg{overlay} to current object. | |
187 | ||
188 | \func{static wxTextAttr}{Merge}{\param{const wxTextAttr\&}{ base}, \param{const wxTextAttr\&}{ overlay}} | |
189 | ||
190 | Creates a new {\tt wxTextAttr} which is a merge of \arg{base} and | |
191 | \arg{overlay}. Properties defined in \arg{overlay} take precedence over those | |
192 | in \arg{base}. Properties undefined/invalid in both are undefined in the | |
193 | result. | |
194 | ||
195 | ||
196 | \membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment} | |
197 | ||
198 | \func{void}{SetAlignment}{\param{wxTextAttrAlignment}{ alignment}} | |
199 | ||
200 | Sets the paragraph alignment. | |
201 | ||
202 | ||
203 | \membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour} | |
204 | ||
205 | \func{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}} | |
206 | ||
207 | Sets the background colour. | |
208 | ||
209 | ||
210 | \membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags} | |
211 | ||
212 | \func{void}{SetFlags}{\param{long}{ flags}} | |
213 | ||
214 | Pass a bitlist indicating which attributes will be set. | |
215 | ||
216 | ||
217 | \membersection{wxTextAttr::SetFont}\label{wxtextattrsetfont} | |
218 | ||
219 | \func{void}{SetFont}{\param{const wxFont\&}{ font}} | |
220 | ||
221 | Sets the text font. | |
222 | ||
223 | ||
224 | \membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent} | |
225 | ||
226 | \func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}} | |
227 | ||
228 | Sets the left indent in tenths of a millimetre. | |
229 | subIndent sets the indent for all lines but the first line in a paragraph | |
230 | relative to the first line. | |
231 | ||
232 | ||
233 | \membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent} | |
234 | ||
235 | \func{void}{SetRightIndent}{\param{int }{indent}} | |
236 | ||
237 | Sets the right indent in tenths of a millimetre. | |
238 | ||
239 | ||
240 | \membersection{wxTextAttr::SetTabs}\label{wxtextattrsettabs} | |
241 | ||
242 | \func{void}{SetTabs}{\param{const wxArrayInt\&}{ tabs}} | |
243 | ||
244 | Sets the array of integers representing the tab stops. Each | |
245 | array element specifies the tab stop in tenths of a millimetre. | |
246 | ||
247 | ||
248 | \membersection{wxTextAttr::SetTextColour}\label{wxtextattrsettextcolour} | |
249 | ||
250 | \func{void}{SetTextColour}{\param{const wxColour\& }{colour}} | |
251 | ||
252 | Sets the text colour. |