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