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