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