1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: fontpicker.tex
3 %% Purpose: wxFontPickerCtrl and wxFontPickerEvent documentation
4 %% Author: Francesco Montorsi
7 %% Copyright: (c) 2006 Francesco Montorsi
8 %% License: wxWindows license
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{\class{wxFontPickerCtrl
}}\label{wxfontpickerctrl
}
13 This control allows the user to select a font. The generic implementation is
14 a button which brings up a
\helpref{wxFontDialog
}{wxfontdialog
} when clicked. Native implementation
15 may differ but this is usually a (small) widget which give access to the font-chooser
17 It is only available if
\texttt{wxUSE
\_FONTPICKERCTRL} is set to $
1$ (the default).
19 \wxheading{Derived from
}
21 \helpref{wxPickerBase
}{wxpickerbase
}\\
22 \helpref{wxControl
}{wxcontrol
}\\
23 \helpref{wxWindow
}{wxwindow
}\\
24 \helpref{wxEvtHandler
}{wxevthandler
}\\
25 \helpref{wxObject
}{wxobject
}
27 \wxheading{Include files
}
33 \helpref{wxCore
}{librarieslist
}
35 \wxheading{Window styles
}
38 \begin{twocollist
}\itemsep=
0pt
39 \twocolitem{\windowstyle{wxFNTP
\_DEFAULT\_STYLE}}{The default style:
40 wxFNTP
\_FONTDESC\_AS\_LABEL | wxFNTP
\_USEFONT\_FOR\_LABEL.
}
41 \twocolitem{\windowstyle{wxFNTP
\_USE\_TEXTCTRL}}{Creates a text control to the left of the
42 picker button which is completely managed by the
\helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}
43 and which can be used by the user to specify a font (see
\helpref{SetSelectedFont
}{wxfontpickerctrlsetselectedfont
}).
44 The text control is automatically synchronized with button's value. Use functions defined in
\helpref{wxPickerBase
}{wxpickerbase
} to modify the text control.
}
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.
}
49 \wxheading{Event handling
}
51 To process a font picker event, use these event handler macros to direct input to member
52 functions that take a
\helpref{wxFontPickerEvent
}{wxfontpickerevent
} argument.
55 \begin{twocollist
}\itemsep=
0pt
56 \twocolitem{{\bf EVT
\_FONTPICKER\_CHANGED(id, func)
}}{The user changed the font
57 selected in the control either using the button or using text control (see
58 wxFNTP
\_USE\_TEXTCTRL; note that in this case the event is fired only if the
59 user's input is valid, i.e. recognizable).
}
64 \helpref{wxFontDialog
}{wxfontdialog
},\\
65 \helpref{wxFontPickerEvent
}{wxfontpickerevent
}
68 \latexignore{\rtfignore{\wxheading{Members
}}}
70 \membersection{wxFontPickerCtrl::wxFontPickerCtrl
}\label{wxfontpickerctrl
}
72 \func{}{wxFontPickerCtrl
}{\param{wxWindow *
}{parent
},
\rtfsp
73 \param{wxWindowID
}{ id
},
\rtfsp
74 \param{const wxFont\&
}{font = wxNullFont
},
\rtfsp
75 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
76 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
77 \param{long
}{ style = wxFNTP
\_DEFAULT\_STYLE},
\rtfsp
78 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
79 \param{const wxString\&
}{name = ``fontpickerctrl"
}}
81 Initializes the object and calls
\helpref{Create
}{wxfontpickerctrlcreate
} with
85 \membersection{wxFontPickerCtrl::Create
}\label{wxfontpickerctrlcreate
}
87 \func{bool
}{Create
}{\param{wxWindow *
}{parent
},
\rtfsp
88 \param{wxWindowID
}{ id
},
\rtfsp
89 \param{const wxFont\&
}{font = wxNullFont
},
\rtfsp
90 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
91 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
92 \param{long
}{ style = wxFNTP
\_DEFAULT\_STYLE},
\rtfsp
93 \param{const wxValidator\&
}{validator = wxDefaultValidator
},
94 \param{const wxString\&
}{name = ``fontpickerctrl"
}}
96 \wxheading{Parameters
}
98 \docparam{parent
}{Parent window, must not be non-
\texttt{NULL
}.
}
100 \docparam{id
}{The identifier for the control.
}
102 \docparam{font
}{The initial font shown in the control. If
\texttt{wxNullFont
}
103 is given, the default font is used.
}
105 \docparam{pos
}{Initial position.
}
107 \docparam{size
}{Initial size.
}
109 \docparam{style
}{The window style, see
{\tt wxFNTP
\_*
} flags.
}
111 \docparam{validator
}{Validator which can be used for additional date checks.
}
113 \docparam{name
}{Control name.
}
115 \wxheading{Return value
}
117 \true if the control was successfully created or
\false if creation failed.
120 \membersection{wxFontPickerCtrl::GetSelectedFont
}\label{wxfontpickerctrlgetselectedfont
}
122 \constfunc{wxFont
}{GetSelectedFont
}{\void}
124 Returns the currently selected font.
125 Note that this function is completely different from
\helpref{wxWindow::GetFont
}{wxwindowgetfont
}.
128 \membersection{wxFontPickerCtrl::SetSelectedFont
}\label{wxfontpickerctrlsetselectedfont
}
130 \func{void
}{SetSelectedFont
}{\param{const wxFont \&
}{font
}}
132 Sets the currently selected font.
133 Note that this function is completely different from
\helpref{wxWindow::SetFont
}{wxwindowsetfont
}.
136 \membersection{wxFontPickerCtrl::GetMaxPointSize
}\label{wxfontpickerctrlgetmaxpointsize
}
138 \constfunc{unsigned int
}{GetMaxPointSize
}{\void}
140 Returns the maximum point size value allowed for the user-chosen font.
143 \membersection{wxFontPickerCtrl::SetMaxPointSize
}\label{wxfontpickerctrlsetmaxpointsize
}
145 \func{void
}{GetMaxPointSize
}{\param{unsigned int
}{ max
}}
147 Sets the maximum point size value allowed for the user-chosen font.
148 The default value is
100. Note that big fonts can require a lot of memory and CPU time
149 both for creation and for rendering; thus, specially because the user has the option to specify
150 the fontsize through a text control (see wxFNTP
\_USE\_TEXTCTRL), it's a good idea to put a limit
151 to the maximum font size when huge fonts do not make much sense.
156 %% wxFontPickerEvent documentation
158 \section{\class{wxFontPickerEvent
}}\label{wxfontpickerevent
}
160 This event class is used for the events generated by
161 \helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}.
163 \wxheading{Derived from
}
165 \helpref{wxCommandEvent
}{wxcommandevent
}\\
166 \helpref{wxEvent
}{wxevent
}\\
167 \helpref{wxObject
}{wxobject
}
169 \wxheading{Include files
}
175 \helpref{wxCore
}{librarieslist
}
177 \wxheading{Event handling
}
179 To process input from a wxFontPickerCtrl, use one of these event handler macros to
180 direct input to member function that take a
181 \helpref{wxFontPickerEvent
}{wxfontpickerevent
} argument:
185 \twocolitem{{\bf EVT
\_FONTPICKER\_CHANGED(id, func)
}}{Generated whenever the selected font changes.
}
191 \helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}
193 \latexignore{\rtfignore{\wxheading{Members
}}}
195 \membersection{wxFontPickerEvent::wxFontPickerEvent
}\label{wxfontpickereventctor
}
197 \func{}{wxFontPickerEvent
}{\param{wxObject *
}{ generator
},
\param{int
}{ id
},
\param{const wxFont\&
}{ font
}}
199 The constructor is not normally used by the user code.
202 \membersection{wxFontPickerEvent::GetFont
}\label{wxfontpickereventgetfont
}
204 \constfunc{wxFont
}{GetFont
}{\void}
206 Retrieve the font the user has just selected.
209 \membersection{wxFontPickerEvent::SetFont
}\label{wxfontpickereventsetfont
}
211 \func{void
}{SetFont
}{\param{const wxFont \&
}{ f
}}
213 Set the font associated with the event.