]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/fontpicker.tex
typo
[wxWidgets.git] / docs / latex / wx / fontpicker.tex
CommitLineData
ec376c8f
VZ
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: fontpicker.tex
3%% Purpose: wxFontPickerCtrl and wxFontPickerEvent documentation
4%% Author: Francesco Montorsi
5%% Created: 2006-04-17
6%% RCS-ID: $Id$
7%% Copyright: (c) 2006 Francesco Montorsi
8%% License: wxWindows license
9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11\section{\class{wxFontPickerCtrl}}\label{wxfontpickerctrl}
12
13This control allows the user to select a font. The generic implementation is
14a button which brings up a \helpref{wxFontDialog}{wxfontdialog} when clicked. Native implementation
15may differ but this is usually a (small) widget which give access to the font-chooser
16dialog.
17It is only available if \texttt{wxUSE\_FONTPICKERCTRL} is set to $1$ (the default).
18
19\wxheading{Derived from}
20
21\helpref{wxPickerBase}{wxpickerbase}\\
22\helpref{wxControl}{wxcontrol}\\
23\helpref{wxWindow}{wxwindow}\\
24\helpref{wxEvtHandler}{wxevthandler}\\
25\helpref{wxObject}{wxobject}
26
27\wxheading{Include files}
28
29<wx/fontpicker.h>
30
a7af285d
VZ
31\wxheading{Library}
32
33\helpref{wxCore}{librarieslist}
34
ec376c8f
VZ
35\wxheading{Window styles}
36
37\twocolwidtha{5cm}%
38\begin{twocollist}\itemsep=0pt
34c07b8b 39\twocolitem{\windowstyle{wxFNTP\_DEFAULT\_STYLE}}{The default style:
58772e49 40wxFNTP\_FONTDESC\_AS\_LABEL | wxFNTP\_USEFONT\_FOR\_LABEL.}
aaa6f9ba 41\twocolitem{\windowstyle{wxFNTP\_USE\_TEXTCTRL}}{Creates a text control to the left of the
ec376c8f
VZ
42picker button which is completely managed by the \helpref{wxFontPickerCtrl}{wxfontpickerctrl}
43and which can be used by the user to specify a font (see \helpref{SetSelectedFont}{wxfontpickerctrlsetselectedfont}).
44The text control is automatically synchronized with button's value. Use functions defined in \helpref{wxPickerBase}{wxpickerbase} to modify the text control.}
aaa6f9ba
RD
45\twocolitem{\windowstyle{wxFNTP\_FONTDESC\_AS\_LABEL}}{Keeps the label of the button updated with the fontface name and the font size. E.g. choosing "Times New Roman bold, italic with size 10" from the fontdialog, will update the label (overwriting any previous label) with the "Times New Roman, 10" text.}
46\twocolitem{\windowstyle{wxFNTP\_USEFONT\_FOR\_LABEL}}{Uses the currently selected font to draw the label of the button.}
ec376c8f
VZ
47\end{twocollist}
48
49\wxheading{Event handling}
50
c8743553
RR
51To process a font picker event, use these event handler macros to direct input to member
52functions that take a \helpref{wxFontPickerEvent}{wxfontpickerevent} argument.
53
ec376c8f
VZ
54\twocolwidtha{7cm}%
55\begin{twocollist}\itemsep=0pt
56\twocolitem{{\bf EVT\_FONTPICKER\_CHANGED(id, func)}}{The user changed the font
57selected in the control either using the button or using text control (see
aaa6f9ba 58wxFNTP\_USE\_TEXTCTRL; note that in this case the event is fired only if the
ec376c8f
VZ
59user's input is valid, i.e. recognizable). }
60\end{twocollist}
61
62\wxheading{See also}
63
64\helpref{wxFontDialog}{wxfontdialog},\\
65\helpref{wxFontPickerEvent}{wxfontpickerevent}
66
67
68\latexignore{\rtfignore{\wxheading{Members}}}
69
de414223 70\membersection{wxFontPickerCtrl::wxFontPickerCtrl}\label{wxfontpickerctrlctor}
ec376c8f
VZ
71
72\func{}{wxFontPickerCtrl}{\param{wxWindow *}{parent},\rtfsp
73\param{wxWindowID}{ id},\rtfsp
305329c2 74\param{const wxFont\& }{font = wxNullFont},\rtfsp
ec376c8f
VZ
75\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
76\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
aaa6f9ba 77\param{long}{ style = wxFNTP\_DEFAULT\_STYLE},\rtfsp
ec376c8f
VZ
78\param{const wxValidator\& }{validator = wxDefaultValidator},
79\param{const wxString\& }{name = ``fontpickerctrl"}}
80
81Initializes the object and calls \helpref{Create}{wxfontpickerctrlcreate} with
82all the parameters.
83
84
85\membersection{wxFontPickerCtrl::Create}\label{wxfontpickerctrlcreate}
86
87\func{bool}{Create}{\param{wxWindow *}{parent},\rtfsp
88\param{wxWindowID}{ id},\rtfsp
305329c2 89\param{const wxFont\& }{font = wxNullFont},\rtfsp
ec376c8f
VZ
90\param{const wxPoint\& }{pos = wxDefaultPosition},\rtfsp
91\param{const wxSize\& }{size = wxDefaultSize},\rtfsp
aaa6f9ba 92\param{long}{ style = wxFNTP\_DEFAULT\_STYLE},\rtfsp
ec376c8f
VZ
93\param{const wxValidator\& }{validator = wxDefaultValidator},
94\param{const wxString\& }{name = ``fontpickerctrl"}}
95
96\wxheading{Parameters}
97
98\docparam{parent}{Parent window, must not be non-\texttt{NULL}.}
99
100\docparam{id}{The identifier for the control.}
101
0817a2c5
VZ
102\docparam{font}{The initial font shown in the control. If \texttt{wxNullFont}
103is given, the default font is used.}
ec376c8f
VZ
104
105\docparam{pos}{Initial position.}
106
107\docparam{size}{Initial size.}
108
aaa6f9ba 109\docparam{style}{The window style, see {\tt wxFNTP\_*} flags.}
ec376c8f
VZ
110
111\docparam{validator}{Validator which can be used for additional date checks.}
112
113\docparam{name}{Control name.}
114
115\wxheading{Return value}
116
117\true if the control was successfully created or \false if creation failed.
118
119
120\membersection{wxFontPickerCtrl::GetSelectedFont}\label{wxfontpickerctrlgetselectedfont}
121
122\constfunc{wxFont}{GetSelectedFont}{\void}
123
124Returns the currently selected font.
125Note that this function is completely different from \helpref{wxWindow::GetFont}{wxwindowgetfont}.
126
127
128\membersection{wxFontPickerCtrl::SetSelectedFont}\label{wxfontpickerctrlsetselectedfont}
129
130\func{void}{SetSelectedFont}{\param{const wxFont \&}{font}}
131
132Sets the currently selected font.
133Note that this function is completely different from \helpref{wxWindow::SetFont}{wxwindowsetfont}.
134
135
136\membersection{wxFontPickerCtrl::GetMaxPointSize}\label{wxfontpickerctrlgetmaxpointsize}
137
138\constfunc{unsigned int}{GetMaxPointSize}{\void}
139
140Returns the maximum point size value allowed for the user-chosen font.
141
142
143\membersection{wxFontPickerCtrl::SetMaxPointSize}\label{wxfontpickerctrlsetmaxpointsize}
144
145\func{void}{GetMaxPointSize}{\param{unsigned int}{ max}}
146
147Sets the maximum point size value allowed for the user-chosen font.
148The default value is 100. Note that big fonts can require a lot of memory and CPU time
149both for creation and for rendering; thus, specially because the user has the option to specify
aaa6f9ba 150the fontsize through a text control (see wxFNTP\_USE\_TEXTCTRL), it's a good idea to put a limit
ec376c8f
VZ
151to the maximum font size when huge fonts do not make much sense.
152
153
154
155
156%% wxFontPickerEvent documentation
157
158\section{\class{wxFontPickerEvent}}\label{wxfontpickerevent}
159
160This event class is used for the events generated by
161\helpref{wxFontPickerCtrl}{wxfontpickerctrl}.
162
163\wxheading{Derived from}
164
165\helpref{wxCommandEvent}{wxcommandevent}\\
166\helpref{wxEvent}{wxevent}\\
167\helpref{wxObject}{wxobject}
168
169\wxheading{Include files}
170
aaa6f9ba 171<wx/fontpicker.h>
ec376c8f 172
a7af285d
VZ
173\wxheading{Library}
174
175\helpref{wxCore}{librarieslist}
176
ec376c8f
VZ
177\wxheading{Event handling}
178
179To process input from a wxFontPickerCtrl, use one of these event handler macros to
180direct input to member function that take a
181\helpref{wxFontPickerEvent}{wxfontpickerevent} argument:
182
183\twocolwidtha{7cm}
184\begin{twocollist}
185\twocolitem{{\bf EVT\_FONTPICKER\_CHANGED(id, func)}}{Generated whenever the selected font changes.}
186\end{twocollist}%
187
188
189\wxheading{See also}
190
191\helpref{wxFontPickerCtrl}{wxfontpickerctrl}
192
193\latexignore{\rtfignore{\wxheading{Members}}}
194
195\membersection{wxFontPickerEvent::wxFontPickerEvent}\label{wxfontpickereventctor}
196
197\func{}{wxFontPickerEvent}{\param{wxObject *}{ generator}, \param{int}{ id}, \param{const wxFont\&}{ font}}
198
199The constructor is not normally used by the user code.
200
201
202\membersection{wxFontPickerEvent::GetFont}\label{wxfontpickereventgetfont}
203
204\constfunc{wxFont}{GetFont}{\void}
205
206Retrieve the font the user has just selected.
207
208
209\membersection{wxFontPickerEvent::SetFont}\label{wxfontpickereventsetfont}
210
211\func{void}{SetFont}{\param{const wxFont \&}{ f}}
212
213Set the font associated with the event.
b67a86d5 214