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