1 %%%%%%%%%%%%%%%%%%%%%%%%%%%% wxTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 \section{\class{wxTextAttr
}}\label{wxtextattr
}
5 wxTextAttr represents the character and paragraph attributes, or style, for a range of text in a
\rtfsp
6 \helpref{wxTextCtrl
}{wxtextctrl
}.
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.
12 \wxheading{Derived from
}
16 \wxheading{Include files
}
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
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
33 The following values can be passed to SetAlignment to determine
38 enum wxTextAttrAlignment
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
50 These values are passed in a bitlist to SetFlags to determine
51 what attributes will be considered when setting the attributes
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
73 \latexignore{\rtfignore{\wxheading{Members
}}}
76 \membersection{wxTextAttr::wxTextAttr
}\label{wxtextattrctor
}
78 \func{}{wxTextAttr
}{\void}
80 \func{}{wxTextAttr
}{\param{const wxColour\&
}{colText
},
\param{const wxColour\&
}{colBack = wxNullColour
},
81 \param{const wxFont\&
}{font = wxNullFont
},
\param{wxTextAttrAlignment
}{alignment = wxTEXT
\_ALIGNMENT\_DEFAULT}}
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.
89 \membersection{wxTextAttr::GetAlignment
}\label{wxtextattrgetalignment
}
91 \constfunc{wxTextAttrAlignment
}{GetAlignment
}{\void}
93 Returns the paragraph alignment.
96 \membersection{wxTextAttr::GetBackgroundColour
}\label{wxtextattrgetbackgroundcolour
}
98 \constfunc{const wxColour\&
}{GetBackgroundColour
}{\void}
100 Return the background colour specified by this attribute.
103 \membersection{wxTextAttr::GetFont
}\label{wxtextattrgetfont
}
105 \constfunc{const wxFont\&
}{GetFont
}{\void}
107 Return the text font specified by this attribute.
110 \membersection{wxTextAttr::GetLeftIndent
}\label{wxtextattrgetleftindent
}
112 \constfunc{int
}{GetLeftIndent
}{\void}
114 Returns the left indent in tenths of a millimetre.
117 \membersection{wxTextAttr::GetLeftSubIndent
}\label{wxtextattrgetleftsubindent
}
119 \constfunc{int
}{GetLeftSubIndent
}{\void}
121 Returns the left sub indent for all lines but the first line in a paragraph in
122 tenths of a millimetre.
125 \membersection{wxTextAttr::GetRightIndent
}\label{wxtextattrgetrightindent
}
127 \constfunc{int
}{GetRightIndent
}{\void}
129 Returns the right indent in tenths of a millimetre.
132 \membersection{wxTextAttr::GetTabs
}\label{wxtextattrgettabs
}
134 \constfunc{const wxArrayInt\&
}{GetTabs
}{\void}
136 Returns the array of integers representing the tab stops. Each
137 array element specifies the tab stop in tenths of a millimetre.
140 \membersection{wxTextAttr::GetTextColour
}\label{wxtextattrgettextcolour
}
142 \constfunc{const wxColour\&
}{GetTextColour
}{\void}
144 Return the text colour specified by this attribute.
147 \membersection{wxTextAttr::HasAlignment
}\label{wxtextattrhasalignment
}
149 \constfunc{bool
}{HasAlignment
}{\void}
151 Returns
{\tt true
} if this style specifies the text alignment.
154 \membersection{wxTextAttr::HasBackgroundColour
}\label{wxtextattrhasbackgroundcolour
}
156 \constfunc{bool
}{HasBackgroundColour
}{\void}
158 Returns
{\tt true
} if this style specifies the background colour to use.
161 \membersection{wxTextAttr::HasFont
}\label{wxtextattrhasfont
}
163 \constfunc{bool
}{HasFont
}{\void}
165 Returns
{\tt true
} if this style specifies the font to use.
168 \membersection{wxTextAttr::HasLeftIndent
}\label{wxtextattrhasleftindent
}
170 \constfunc{bool
}{HasLeftIndent
}{\void}
172 Returns
{\tt true
} if this style specifies the left indent.
175 \membersection{wxTextAttr::HasRightIndent
}\label{wxtextattrhasrightindent
}
177 \constfunc{bool
}{HasRightIndent
}{\void}
179 Returns
{\tt true
} if this style specifies the right indent.
182 \membersection{wxTextAttr::HasTabs
}\label{wxtextattrhastabs
}
184 \constfunc{bool
}{HasTabs
}{\void}
186 Returns
{\tt true
} if this style specifies any tabstobs.
189 \membersection{wxTextAttr::HasTextColour
}\label{wxtextattrhastextcolour
}
191 \constfunc{bool
}{HasTextColour
}{\void}
193 Returns
{\tt true
} if this style specifies the foreground colour to use.
196 \membersection{wxTextAttr::GetFlags
}\label{wxtextattrgetflags
}
198 \func{long
}{GetFlags
}{\void}
200 Returns a bitlist indicating which attributes will be set.
203 \membersection{wxTextAttr::IsDefault
}\label{wxtextattrisdefault
}
205 \constfunc{bool
}{IsDefault
}{\void}
207 Returns
{\tt true
} if this style specifies any non-default attributes.
210 \membersection{wxTextAttr::Merge
}\label{wxtextattrmerge
}
212 \func{void
}{Merge
}{\param{const wxTextAttr\&
}{ overlay
}}
214 Copies all defined/valid properties from
\arg{overlay
} to current object.
216 \func{static wxTextAttr
}{Merge
}{\param{const wxTextAttr\&
}{ base
},
\param{const wxTextAttr\&
}{ overlay
}}
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
224 \membersection{wxTextAttr::SetAlignment
}\label{wxtextattrsetalignment
}
226 \func{void
}{SetAlignment
}{\param{wxTextAttrAlignment
}{ alignment
}}
228 Sets the paragraph alignment.
231 \membersection{wxTextAttr::SetBackgroundColour
}\label{wxtextattrsetbackgroundcolour
}
233 \func{void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
235 Sets the background colour.
238 \membersection{wxTextAttr::SetFlags
}\label{wxtextattrsetflags
}
240 \func{void
}{SetFlags
}{\param{long
}{ flags
}}
242 Pass a bitlist indicating which attributes will be set.
245 \membersection{wxTextAttr::SetFont
}\label{wxtextattrsetfont
}
247 \func{void
}{SetFont
}{\param{const wxFont\&
}{ font
}}
252 \membersection{wxTextAttr::SetLeftIndent
}\label{wxtextattrsetleftindent
}
254 \func{void
}{SetLeftIndent
}{\param{int
}{indent
},
\param{int
}{subIndent =
0}}
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.
261 \membersection{wxTextAttr::SetRightIndent
}\label{wxtextattrsetrightindent
}
263 \func{void
}{SetRightIndent
}{\param{int
}{indent
}}
265 Sets the right indent in tenths of a millimetre.
268 \membersection{wxTextAttr::SetTabs
}\label{wxtextattrsettabs
}
270 \func{void
}{SetTabs
}{\param{const wxArrayInt\&
}{ tabs
}}
272 Sets the array of integers representing the tab stops. Each
273 array element specifies the tab stop in tenths of a millimetre.
276 \membersection{wxTextAttr::SetTextColour
}\label{wxtextattrsettextcolour
}
278 \func{void
}{SetTextColour
}{\param{const wxColour\&
}{colour
}}
280 Sets the text colour.