2006-05-31 19:57:54 -04:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: fontpicker.tex
%% Purpose: wxFontPickerCtrl and wxFontPickerEvent documentation
%% Author: Francesco Montorsi
%% Created: 2006-04-17
%% RCS-ID: $Id$
%% Copyright: (c) 2006 Francesco Montorsi
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section { \class { wxFontPickerCtrl} } \label { wxfontpickerctrl}
This control allows the user to select a font. The generic implementation is
a button which brings up a \helpref { wxFontDialog} { wxfontdialog} when clicked. Native implementation
may differ but this is usually a (small) widget which give access to the font-chooser
dialog.
It is only available if \texttt { wxUSE\_ FONTPICKERCTRL} is set to $ 1 $ (the default).
\wxheading { Derived from}
\helpref { wxPickerBase} { wxpickerbase} \\
\helpref { wxControl} { wxcontrol} \\
\helpref { wxWindow} { wxwindow} \\
\helpref { wxEvtHandler} { wxevthandler} \\
\helpref { wxObject} { wxobject}
\wxheading { Include files}
<wx/fontpicker.h>
\wxheading { Window styles}
\twocolwidtha { 5cm} %
\begin { twocollist} \itemsep =0pt
2006-10-08 11:49:36 -04:00
\twocolitem { \windowstyle { wxFNTP\_ DEFAULT\_ STYLE} } { The default style:
2006-06-25 21:04:44 -04:00
wxFNTP\_ FONTDESC\_ AS\_ LABEL | wxFNTP\_ USEFONT\_ FOR\_ LABEL.}
2006-06-08 15:10:00 -04:00
\twocolitem { \windowstyle { wxFNTP\_ USE\_ TEXTCTRL} } { Creates a text control to the left of the
2006-05-31 19:57:54 -04:00
picker button which is completely managed by the \helpref { wxFontPickerCtrl} { wxfontpickerctrl}
and which can be used by the user to specify a font (see \helpref { SetSelectedFont} { wxfontpickerctrlsetselectedfont} ).
The text control is automatically synchronized with button's value. Use functions defined in \helpref { wxPickerBase} { wxpickerbase} to modify the text control.}
2006-06-08 15:10:00 -04:00
\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.}
\twocolitem { \windowstyle { wxFNTP\_ USEFONT\_ FOR\_ LABEL} } { Uses the currently selected font to draw the label of the button.}
2006-05-31 19:57:54 -04:00
\end { twocollist}
\wxheading { Event handling}
\twocolwidtha { 7cm} %
\begin { twocollist} \itemsep =0pt
\twocolitem { { \bf EVT\_ FONTPICKER\_ CHANGED(id, func)} } { The user changed the font
selected in the control either using the button or using text control (see
2006-06-08 15:10:00 -04:00
wxFNTP\_ USE\_ TEXTCTRL; note that in this case the event is fired only if the
2006-05-31 19:57:54 -04:00
user's input is valid, i.e. recognizable). }
\end { twocollist}
\wxheading { See also}
\helpref { wxFontDialog} { wxfontdialog} ,\\
\helpref { wxFontPickerEvent} { wxfontpickerevent}
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxFontPickerCtrl::wxFontPickerCtrl} \label { wxfontpickerctrl}
\func { } { wxFontPickerCtrl} { \param { wxWindow *} { parent} ,\rtfsp
\param { wxWindowID} { id} ,\rtfsp
2006-11-03 16:54:13 -05:00
\param { const wxFont\& } { font = wxNullFont} ,\rtfsp
2006-05-31 19:57:54 -04:00
\param { const wxPoint\& } { pos = wxDefaultPosition} ,\rtfsp
\param { const wxSize\& } { size = wxDefaultSize} ,\rtfsp
2006-06-08 15:10:00 -04:00
\param { long} { style = wxFNTP\_ DEFAULT\_ STYLE} ,\rtfsp
2006-05-31 19:57:54 -04:00
\param { const wxValidator\& } { validator = wxDefaultValidator} ,
\param { const wxString\& } { name = ``fontpickerctrl"} }
Initializes the object and calls \helpref { Create} { wxfontpickerctrlcreate} with
all the parameters.
\membersection { wxFontPickerCtrl::Create} \label { wxfontpickerctrlcreate}
\func { bool} { Create} { \param { wxWindow *} { parent} ,\rtfsp
\param { wxWindowID} { id} ,\rtfsp
2006-11-03 16:54:13 -05:00
\param { const wxFont\& } { font = wxNullFont} ,\rtfsp
2006-05-31 19:57:54 -04:00
\param { const wxPoint\& } { pos = wxDefaultPosition} ,\rtfsp
\param { const wxSize\& } { size = wxDefaultSize} ,\rtfsp
2006-06-08 15:10:00 -04:00
\param { long} { style = wxFNTP\_ DEFAULT\_ STYLE} ,\rtfsp
2006-05-31 19:57:54 -04:00
\param { const wxValidator\& } { validator = wxDefaultValidator} ,
\param { const wxString\& } { name = ``fontpickerctrl"} }
\wxheading { Parameters}
\docparam { parent} { Parent window, must not be non-\texttt { NULL} .}
\docparam { id} { The identifier for the control.}
2006-11-03 16:54:13 -05:00
\docparam { font} { The initial font shown in the control. The default
\texttt { wxNORMAL\_ FONT} value means to use the default font.}
2006-05-31 19:57:54 -04:00
\docparam { pos} { Initial position.}
\docparam { size} { Initial size.}
2006-06-08 15:10:00 -04:00
\docparam { style} { The window style, see { \tt wxFNTP\_ * } flags.}
2006-05-31 19:57:54 -04:00
\docparam { validator} { Validator which can be used for additional date checks.}
\docparam { name} { Control name.}
\wxheading { Return value}
\true if the control was successfully created or \false if creation failed.
\membersection { wxFontPickerCtrl::GetSelectedFont} \label { wxfontpickerctrlgetselectedfont}
\constfunc { wxFont} { GetSelectedFont} { \void }
Returns the currently selected font.
Note that this function is completely different from \helpref { wxWindow::GetFont} { wxwindowgetfont} .
\membersection { wxFontPickerCtrl::SetSelectedFont} \label { wxfontpickerctrlsetselectedfont}
\func { void} { SetSelectedFont} { \param { const wxFont \& } { font} }
Sets the currently selected font.
Note that this function is completely different from \helpref { wxWindow::SetFont} { wxwindowsetfont} .
\membersection { wxFontPickerCtrl::GetMaxPointSize} \label { wxfontpickerctrlgetmaxpointsize}
\constfunc { unsigned int} { GetMaxPointSize} { \void }
Returns the maximum point size value allowed for the user-chosen font.
\membersection { wxFontPickerCtrl::SetMaxPointSize} \label { wxfontpickerctrlsetmaxpointsize}
\func { void} { GetMaxPointSize} { \param { unsigned int} { max} }
Sets the maximum point size value allowed for the user-chosen font.
The default value is 100. Note that big fonts can require a lot of memory and CPU time
both for creation and for rendering; thus, specially because the user has the option to specify
2006-06-08 15:10:00 -04:00
the fontsize through a text control (see wxFNTP\_ USE\_ TEXTCTRL), it's a good idea to put a limit
2006-05-31 19:57:54 -04:00
to the maximum font size when huge fonts do not make much sense.
%% wxFontPickerEvent documentation
\section { \class { wxFontPickerEvent} } \label { wxfontpickerevent}
This event class is used for the events generated by
\helpref { wxFontPickerCtrl} { wxfontpickerctrl} .
\wxheading { Derived from}
\helpref { wxCommandEvent} { wxcommandevent} \\
\helpref { wxEvent} { wxevent} \\
\helpref { wxObject} { wxobject}
\wxheading { Include files}
2006-06-08 15:10:00 -04:00
<wx/fontpicker.h>
2006-05-31 19:57:54 -04:00
\wxheading { Event handling}
To process input from a wxFontPickerCtrl, use one of these event handler macros to
direct input to member function that take a
\helpref { wxFontPickerEvent} { wxfontpickerevent} argument:
\twocolwidtha { 7cm}
\begin { twocollist}
\twocolitem { { \bf EVT\_ FONTPICKER\_ CHANGED(id, func)} } { Generated whenever the selected font changes.}
\end { twocollist} %
\wxheading { See also}
\helpref { wxFontPickerCtrl} { wxfontpickerctrl}
\latexignore { \rtfignore { \wxheading { Members} } }
\membersection { wxFontPickerEvent::wxFontPickerEvent} \label { wxfontpickereventctor}
\func { } { wxFontPickerEvent} { \param { wxObject *} { generator} , \param { int} { id} , \param { const wxFont\& } { font} }
The constructor is not normally used by the user code.
\membersection { wxFontPickerEvent::GetFont} \label { wxfontpickereventgetfont}
\constfunc { wxFont} { GetFont} { \void }
Retrieve the font the user has just selected.
\membersection { wxFontPickerEvent::SetFont} \label { wxfontpickereventsetfont}
\func { void} { SetFont} { \param { const wxFont \& } { f} }
Set the font associated with the event.
2006-10-10 13:46:49 -04:00