]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/fontpicker.h
Document wxNotificationMessage::Timeout_XXX values.
[wxWidgets.git] / interface / wx / fontpicker.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: fontpicker.h
e54c96f1 3// Purpose: interface of wxFontPickerCtrl
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxFontPickerCtrl
7c913512 11
23324ae1
FM
12 This control allows the user to select a font. The generic implementation is
13 a button which brings up a wxFontDialog when clicked. Native implementation
14 may differ but this is usually a (small) widget which give access to the
674d80a7 15 font-chooser dialog.
23324ae1 16 It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
7c913512 17
23324ae1 18 @beginStyleTable
8c6791e4 19 @style{wxFNTP_DEFAULT_STYLE}
674d80a7 20 The default style: wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL.
8c6791e4 21 @style{wxFNTP_USE_TEXTCTRL}
23324ae1
FM
22 Creates a text control to the left of the picker button which is
23 completely managed by the wxFontPickerCtrl and which can be used by
24 the user to specify a font (see SetSelectedFont). The text control
25 is automatically synchronized with button's value. Use functions
26 defined in wxPickerBase to modify the text control.
8c6791e4 27 @style{wxFNTP_FONTDESC_AS_LABEL}
23324ae1
FM
28 Keeps the label of the button updated with the fontface name and
29 the font size. E.g. choosing "Times New Roman bold, italic with
30 size 10" from the fontdialog, will update the label (overwriting
31 any previous label) with the "Times New Roman, 10" text.
8c6791e4 32 @style{wxFNTP_USEFONT_FOR_LABEL}
23324ae1
FM
33 Uses the currently selected font to draw the label of the button.
34 @endStyleTable
7c913512 35
3051a44a 36 @beginEventEmissionTable{wxFontPickerEvent}
674d80a7
FM
37 @event{EVT_FONTPICKER_CHANGED(id, func)}
38 The user changed the font selected in the control either using the button
39 or using text control (see wxFNTP_USE_TEXTCTRL; note that in this case the
40 event is fired only if the user's input is valid, i.e. recognizable).
41 @endEventTable
42
23324ae1 43 @library{wxcore}
d18d9f60 44 @category{pickers}
7e59b885 45 @appearance{fontpickerctrl.png}
7c913512 46
e54c96f1 47 @see wxFontDialog, wxFontPickerEvent
23324ae1
FM
48*/
49class wxFontPickerCtrl : public wxPickerBase
50{
51public:
52 /**
53 Initializes the object and calls Create() with
54 all the parameters.
55 */
4cc4bfaf 56 wxFontPickerCtrl(wxWindow* parent, wxWindowID id,
23324ae1
FM
57 const wxFont& font = wxNullFont,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 long style = wxFNTP_DEFAULT_STYLE,
61 const wxValidator& validator = wxDefaultValidator,
a44f3b5a 62 const wxString& name = wxFontPickerCtrlNameStr);
23324ae1
FM
63
64 /**
674d80a7
FM
65 Creates this widget with given parameters.
66
7c913512 67 @param parent
4cc4bfaf 68 Parent window, must not be non-@NULL.
7c913512 69 @param id
4cc4bfaf 70 The identifier for the control.
7c913512 71 @param font
674d80a7
FM
72 The initial font shown in the control.
73 If ::wxNullFont is given, the default font is used.
7c913512 74 @param pos
4cc4bfaf 75 Initial position.
7c913512 76 @param size
4cc4bfaf 77 Initial size.
7c913512 78 @param style
4cc4bfaf 79 The window style, see wxFNTP_* flags.
7c913512 80 @param validator
4cc4bfaf 81 Validator which can be used for additional date checks.
7c913512 82 @param name
4cc4bfaf 83 Control name.
3c4f71cc 84
d29a9a8a 85 @return @true if the control was successfully created or @false if
4cc4bfaf 86 creation failed.
23324ae1 87 */
4cc4bfaf 88 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
89 const wxFont& font = wxNullFont,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 long style = wxFNTP_DEFAULT_STYLE,
93 const wxValidator& validator = wxDefaultValidator,
5267aefd 94 const wxString& name = wxFontPickerCtrlNameStr);
23324ae1
FM
95
96 /**
97 Returns the maximum point size value allowed for the user-chosen font.
98 */
328f5751 99 unsigned int GetMaxPointSize() const;
23324ae1
FM
100
101 /**
102 Returns the currently selected font.
103 Note that this function is completely different from wxWindow::GetFont.
104 */
328f5751 105 wxFont GetSelectedFont() const;
23324ae1
FM
106
107 /**
108 Sets the maximum point size value allowed for the user-chosen font.
674d80a7 109
23324ae1 110 The default value is 100. Note that big fonts can require a lot of memory and
674d80a7
FM
111 CPU time both for creation and for rendering; thus, specially because the user
112 has the option to specify the fontsize through a text control
113 (see wxFNTP_USE_TEXTCTRL), it's a good idea to put a limit to the maximum
114 font size when huge fonts do not make much sense.
23324ae1 115 */
37220641 116 void SetMaxPointSize(unsigned int max);
23324ae1
FM
117
118 /**
119 Sets the currently selected font.
120 Note that this function is completely different from wxWindow::SetFont.
121 */
4cc4bfaf 122 void SetSelectedFont(const wxFont& font);
23324ae1
FM
123};
124
125
e54c96f1 126
23324ae1
FM
127/**
128 @class wxFontPickerEvent
7c913512 129
23324ae1
FM
130 This event class is used for the events generated by
131 wxFontPickerCtrl.
7c913512 132
674d80a7
FM
133 @beginEventTable{wxFontPickerEvent}
134 @event{EVT_FONTPICKER_CHANGED(id, func)}
135 Generated whenever the selected font changes.
136 @endEventTable
137
23324ae1 138 @library{wxcore}
674d80a7 139 @category{events}
7c913512 140
e54c96f1 141 @see wxFontPickerCtrl
23324ae1
FM
142*/
143class wxFontPickerEvent : public wxCommandEvent
144{
145public:
146 /**
147 The constructor is not normally used by the user code.
148 */
4cc4bfaf 149 wxFontPickerEvent(wxObject* generator, int id,
23324ae1
FM
150 const wxFont& font);
151
152 /**
153 Retrieve the font the user has just selected.
154 */
328f5751 155 wxFont GetFont() const;
23324ae1
FM
156
157 /**
158 Set the font associated with the event.
159 */
4cc4bfaf 160 void SetFont(const wxFont& f);
23324ae1 161};
e54c96f1 162