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::HasBackgroundColour
}\label{wxtextattrhasbackgroundcolour
}
149 \constfunc{bool
}{HasBackgroundColour
}{\void}
151 Returns
{\tt true
} if this style specifies the background colour to use.
154 \membersection{wxTextAttr::HasFont
}\label{wxtextattrhasfont
}
156 \constfunc{bool
}{HasFont
}{\void}
158 Returns
{\tt true
} if this style specifies the font to use.
161 \membersection{wxTextAttr::HasTextColour
}\label{wxtextattrhastextcolour
}
163 \constfunc{bool
}{HasTextColour
}{\void}
165 Returns
{\tt true
} if this style specifies the foreground colour to use.
168 \membersection{wxTextAttr::GetFlags
}\label{wxtextattrgetflags
}
170 \func{long
}{GetFlags
}{\void}
172 Returns a bitlist indicating which attributes will be set.
175 \membersection{wxTextAttr::IsDefault
}\label{wxtextattrisdefault
}
177 \constfunc{bool
}{IsDefault
}{\void}
179 Returns
{\tt true
} if this style specifies any non-default attributes.
182 \membersection{wxTextAttr::Merge
}\label{wxtextattrmerge
}
184 \func{void
}{Merge
}{\param{const wxTextAttr\&
}{ overlay
}}
186 Copies all defined/valid properties from
\arg{overlay
} to current object.
188 \func{static wxTextAttr
}{Merge
}{\param{const wxTextAttr\&
}{ base
},
\param{const wxTextAttr\&
}{ overlay
}}
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
196 \membersection{wxTextAttr::SetAlignment
}\label{wxtextattrsetalignment
}
198 \func{void
}{SetAlignment
}{\param{wxTextAttrAlignment
}{ alignment
}}
200 Sets the paragraph alignment.
203 \membersection{wxTextAttr::SetBackgroundColour
}\label{wxtextattrsetbackgroundcolour
}
205 \func{void
}{SetBackgroundColour
}{\param{const wxColour\&
}{colour
}}
207 Sets the background colour.
210 \membersection{wxTextAttr::SetFlags
}\label{wxtextattrsetflags
}
212 \func{void
}{SetFlags
}{\param{long
}{ flags
}}
214 Pass a bitlist indicating which attributes will be set.
217 \membersection{wxTextAttr::SetFont
}\label{wxtextattrsetfont
}
219 \func{void
}{SetFont
}{\param{const wxFont\&
}{ font
}}
224 \membersection{wxTextAttr::SetLeftIndent
}\label{wxtextattrsetleftindent
}
226 \func{void
}{SetLeftIndent
}{\param{int
}{indent
},
\param{int
}{subIndent =
0}}
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.
233 \membersection{wxTextAttr::SetRightIndent
}\label{wxtextattrsetrightindent
}
235 \func{void
}{SetRightIndent
}{\param{int
}{indent
}}
237 Sets the right indent in tenths of a millimetre.
240 \membersection{wxTextAttr::SetTabs
}\label{wxtextattrsettabs
}
242 \func{void
}{SetTabs
}{\param{const wxArrayInt\&
}{ tabs
}}
244 Sets the array of integers representing the tab stops. Each
245 array element specifies the tab stop in tenths of a millimetre.
248 \membersection{wxTextAttr::SetTextColour
}\label{wxtextattrsettextcolour
}
250 \func{void
}{SetTextColour
}{\param{const wxColour\&
}{colour
}}
252 Sets the text colour.