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 \helpref{wxCore
}{librarieslist
}
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
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
37 The following values can be passed to SetAlignment to determine
42 enum wxTextAttrAlignment
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
54 These values are passed in a bitlist to SetFlags to determine
55 what attributes will be considered when setting the attributes
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
77 \latexignore{\rtfignore{\wxheading{Members
}}}
80 \membersection{wxTextAttr::wxTextAttr
}\label{wxtextattrctor
}
82 \func{}{wxTextAttr
}{\void}
84 \func{}{wxTextAttr
}{\param{const wxColour\&
}{colText
},
\param{const wxColour\&
}{colBack = wxNullColour
},
85 \param{const wxFont\&
}{font = wxNullFont
},
\param{wxTextAttrAlignment
}{alignment = wxTEXT
\_ALIGNMENT\_DEFAULT}}
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.
93 \membersection{wxTextAttr::GetAlignment
}\label{wxtextattrgetalignment
}
95 \constfunc{wxTextAttrAlignment
}{GetAlignment
}{\void}
97 Returns the paragraph alignment.
100 \membersection{wxTextAttr::GetBackgroundColour
}\label{wxtextattrgetbackgroundcolour
}
102 \constfunc{const wxColour\&
}{GetBackgroundColour
}{\void}
104 Return the background colour specified by this attribute.
107 \membersection{wxTextAttr::GetFont
}\label{wxtextattrgetfont
}
109 \constfunc{const wxFont\&
}{GetFont
}{\void}
111 Return the text font specified by this attribute.
114 \membersection{wxTextAttr::GetLeftIndent
}\label{wxtextattrgetleftindent
}
116 \constfunc{int
}{GetLeftIndent
}{\void}
118 Returns the left indent in tenths of a millimetre.
121 \membersection{wxTextAttr::GetLeftSubIndent
}\label{wxtextattrgetleftsubindent
}
123 \constfunc{int
}{GetLeftSubIndent
}{\void}
125 Returns the left sub indent for all lines but the first line in a paragraph in
126 tenths of a millimetre.
129 \membersection{wxTextAttr::GetRightIndent
}\label{wxtextattrgetrightindent
}
131 \constfunc{int
}{GetRightIndent
}{\void}
133 Returns the right indent in tenths of a millimetre.
136 \membersection{wxTextAttr::GetTabs
}\label{wxtextattrgettabs
}
138 \constfunc{const wxArrayInt\&
}{GetTabs
}{\void}
140 Returns the array of integers representing the tab stops. Each
141 array element specifies the tab stop in tenths of a millimetre.
144 \membersection{wxTextAttr::GetTextColour
}\label{wxtextattrgettextcolour
}
146 \constfunc{const wxColour\&
}{GetTextColour
}{\void}
148 Return the text colour specified by this attribute.
151 \membersection{wxTextAttr::HasAlignment
}\label{wxtextattrhasalignment
}
153 \constfunc{bool
}{HasAlignment
}{\void}
155 Returns
{\tt true
} if this style specifies the text alignment.
158 \membersection{wxTextAttr::HasBackgroundColour
}\label{wxtextattrhasbackgroundcolour
}
160 \constfunc{bool
}{HasBackgroundColour
}{\void}
162 Returns
{\tt true
} if this style specifies the background colour to use.
165 \membersection{wxTextAttr::HasFont
}\label{wxtextattrhasfont
}
167 \constfunc{bool
}{HasFont
}{\void}
169 Returns
{\tt true
} if this style specifies the font to use.
172 \membersection{wxTextAttr::HasLeftIndent
}\label{wxtextattrhasleftindent
}
174 \constfunc{bool
}{HasLeftIndent
}{\void}
176 Returns
{\tt true
} if this style specifies the left indent.
179 \membersection{wxTextAttr::HasRightIndent
}\label{wxtextattrhasrightindent
}
181 \constfunc{bool
}{HasRightIndent
}{\void}
183 Returns
{\tt true
} if this style specifies the right indent.
186 \membersection{wxTextAttr::HasTabs
}\label{wxtextattrhastabs
}
188 \constfunc{bool
}{HasTabs
}{\void}
190 Returns
{\tt true
} if this style specifies any tabstobs.
193 \membersection{wxTextAttr::HasTextColour
}\label{wxtextattrhastextcolour
}
195 \constfunc{bool
}{HasTextColour
}{\void}
197 Returns
{\tt true
} if this style specifies the foreground colour to use.
200 \membersection{wxTextAttr::GetFlags
}\label{wxtextattrgetflags
}
202 \func{long
}{GetFlags
}{\void}
204 Returns a bitlist indicating which attributes will be set.
207 \membersection{wxTextAttr::IsDefault
}\label{wxtextattrisdefault
}
209 \constfunc{bool
}{IsDefault
}{\void}
211 Returns
{\tt true
} if this style specifies any non-default attributes.
214 \membersection{wxTextAttr::Merge
}\label{wxtextattrmerge
}
216 \func{void
}{Merge
}{\param{const wxTextAttr\&
}{ overlay
}}
218 Copies all defined/valid properties from
\arg{overlay
} to current object.
220 \func{static wxTextAttr
}{Merge
}{\param{const wxTextAttr\&
}{ base
},
\param{const wxTextAttr\&
}{ overlay
}}
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
228 \membersection{wxTextAttr::SetAlignment
}\label{wxtextattrsetalignment
}
230 \func{void
}{SetAlignment
}{\param{wxTextAttrAlignment
}{ alignment
}}
232 Sets the paragraph alignment.
235 \membersection{wxTextAttr::SetBackgroundColour
}\label{wxtextattrsetbackgroundcolour
}
237 \func{void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
239 Sets the background colour.
242 \membersection{wxTextAttr::SetFlags
}\label{wxtextattrsetflags
}
244 \func{void
}{SetFlags
}{\param{long
}{ flags
}}
246 Pass a bitlist indicating which attributes will be set.
249 \membersection{wxTextAttr::SetFont
}\label{wxtextattrsetfont
}
251 \func{void
}{SetFont
}{\param{const wxFont\&
}{ font
}}
256 \membersection{wxTextAttr::SetLeftIndent
}\label{wxtextattrsetleftindent
}
258 \func{void
}{SetLeftIndent
}{\param{int
}{indent
},
\param{int
}{subIndent =
0}}
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.
265 \membersection{wxTextAttr::SetRightIndent
}\label{wxtextattrsetrightindent
}
267 \func{void
}{SetRightIndent
}{\param{int
}{indent
}}
269 Sets the right indent in tenths of a millimetre.
272 \membersection{wxTextAttr::SetTabs
}\label{wxtextattrsettabs
}
274 \func{void
}{SetTabs
}{\param{const wxArrayInt\&
}{ tabs
}}
276 Sets the array of integers representing the tab stops. Each
277 array element specifies the tab stop in tenths of a millimetre.
280 \membersection{wxTextAttr::SetTextColour
}\label{wxtextattrsettextcolour
}
282 \func{void
}{SetTextColour
}{\param{const wxColour\&
}{colour
}}
284 Sets the text colour.