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
}
31 \wxheading{Window styles
}
34 \begin{twocollist
}\itemsep=
0pt
35 \twocolitem{\windowstyle{wxFNTP
\_DEFAULT\_STYLE}}{The default style:
36 wxFNTP
\_FONTDESC\_AS\_LABEL | wxFNTP
\_USEFONT\_FOR\_LABEL.
}
37 \twocolitem{\windowstyle{wxFNTP
\_USE\_TEXTCTRL}}{Creates a text control to the left of the
38 picker button which is completely managed by the
\helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}
39 and which can be used by the user to specify a font (see
\helpref{SetSelectedFont
}{wxfontpickerctrlsetselectedfont
}).
40 The 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.
}
45 \wxheading{Event handling
}
47 To process a font picker event, use these event handler macros to direct input to member
48 functions that take a
\helpref{wxFontPickerEvent
}{wxfontpickerevent
} argument.
51 \begin{twocollist
}\itemsep=
0pt
52 \twocolitem{{\bf EVT
\_FONTPICKER\_CHANGED(id, func)
}}{The user changed the font
53 selected in the control either using the button or using text control (see
54 wxFNTP
\_USE\_TEXTCTRL; note that in this case the event is fired only if the
55 user's input is valid, i.e. recognizable).
}
60 \helpref{wxFontDialog
}{wxfontdialog
},\\
61 \helpref{wxFontPickerEvent
}{wxfontpickerevent
}
64 \latexignore{\rtfignore{\wxheading{Members
}}}
66 \membersection{wxFontPickerCtrl::wxFontPickerCtrl
}\label{wxfontpickerctrl
}
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"
}}
77 Initializes the object and calls
\helpref{Create
}{wxfontpickerctrlcreate
} with
81 \membersection{wxFontPickerCtrl::Create
}\label{wxfontpickerctrlcreate
}
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"
}}
92 \wxheading{Parameters
}
94 \docparam{parent
}{Parent window, must not be non-
\texttt{NULL
}.
}
96 \docparam{id
}{The identifier for the control.
}
98 \docparam{font
}{The initial font shown in the control. If
\texttt{wxNullFont
}
99 is given, the default font is used.
}
101 \docparam{pos
}{Initial position.
}
103 \docparam{size
}{Initial size.
}
105 \docparam{style
}{The window style, see
{\tt wxFNTP
\_*
} flags.
}
107 \docparam{validator
}{Validator which can be used for additional date checks.
}
109 \docparam{name
}{Control name.
}
111 \wxheading{Return value
}
113 \true if the control was successfully created or
\false if creation failed.
116 \membersection{wxFontPickerCtrl::GetSelectedFont
}\label{wxfontpickerctrlgetselectedfont
}
118 \constfunc{wxFont
}{GetSelectedFont
}{\void}
120 Returns the currently selected font.
121 Note that this function is completely different from
\helpref{wxWindow::GetFont
}{wxwindowgetfont
}.
124 \membersection{wxFontPickerCtrl::SetSelectedFont
}\label{wxfontpickerctrlsetselectedfont
}
126 \func{void
}{SetSelectedFont
}{\param{const wxFont \&
}{font
}}
128 Sets the currently selected font.
129 Note that this function is completely different from
\helpref{wxWindow::SetFont
}{wxwindowsetfont
}.
132 \membersection{wxFontPickerCtrl::GetMaxPointSize
}\label{wxfontpickerctrlgetmaxpointsize
}
134 \constfunc{unsigned int
}{GetMaxPointSize
}{\void}
136 Returns the maximum point size value allowed for the user-chosen font.
139 \membersection{wxFontPickerCtrl::SetMaxPointSize
}\label{wxfontpickerctrlsetmaxpointsize
}
141 \func{void
}{GetMaxPointSize
}{\param{unsigned int
}{ max
}}
143 Sets the maximum point size value allowed for the user-chosen font.
144 The default value is
100. Note that big fonts can require a lot of memory and CPU time
145 both for creation and for rendering; thus, specially because the user has the option to specify
146 the fontsize through a text control (see wxFNTP
\_USE\_TEXTCTRL), it's a good idea to put a limit
147 to the maximum font size when huge fonts do not make much sense.
152 %% wxFontPickerEvent documentation
154 \section{\class{wxFontPickerEvent
}}\label{wxfontpickerevent
}
156 This event class is used for the events generated by
157 \helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}.
159 \wxheading{Derived from
}
161 \helpref{wxCommandEvent
}{wxcommandevent
}\\
162 \helpref{wxEvent
}{wxevent
}\\
163 \helpref{wxObject
}{wxobject
}
165 \wxheading{Include files
}
169 \wxheading{Event handling
}
171 To process input from a wxFontPickerCtrl, use one of these event handler macros to
172 direct input to member function that take a
173 \helpref{wxFontPickerEvent
}{wxfontpickerevent
} argument:
177 \twocolitem{{\bf EVT
\_FONTPICKER\_CHANGED(id, func)
}}{Generated whenever the selected font changes.
}
183 \helpref{wxFontPickerCtrl
}{wxfontpickerctrl
}
185 \latexignore{\rtfignore{\wxheading{Members
}}}
187 \membersection{wxFontPickerEvent::wxFontPickerEvent
}\label{wxfontpickereventctor
}
189 \func{}{wxFontPickerEvent
}{\param{wxObject *
}{ generator
},
\param{int
}{ id
},
\param{const wxFont\&
}{ font
}}
191 The constructor is not normally used by the user code.
194 \membersection{wxFontPickerEvent::GetFont
}\label{wxfontpickereventgetfont
}
196 \constfunc{wxFont
}{GetFont
}{\void}
198 Retrieve the font the user has just selected.
201 \membersection{wxFontPickerEvent::SetFont
}\label{wxfontpickereventsetfont
}
203 \func{void
}{SetFont
}{\param{const wxFont \&
}{ f
}}
205 Set the font associated with the event.