]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontpicker.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxFontPickerCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxFontPickerCtrl
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
17 It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
20 @style{wxFNTP_DEFAULT_STYLE}
21 The default style: wxFNTP_FONTDESC_AS_LABEL |
22 wxFNTP_USEFONT_FOR_LABEL.
23 @style{wxFNTP_USE_TEXTCTRL}
24 Creates a text control to the left of the picker button which is
25 completely managed by the wxFontPickerCtrl and which can be used by
26 the user to specify a font (see SetSelectedFont). The text control
27 is automatically synchronized with button's value. Use functions
28 defined in wxPickerBase to modify the text control.
29 @style{wxFNTP_FONTDESC_AS_LABEL}
30 Keeps the label of the button updated with the fontface name and
31 the font size. E.g. choosing "Times New Roman bold, italic with
32 size 10" from the fontdialog, will update the label (overwriting
33 any previous label) with the "Times New Roman, 10" text.
34 @style{wxFNTP_USEFONT_FOR_LABEL}
35 Uses the currently selected font to draw the label of the button.
40 <!-- @appearance{fontpickerctrl.png} -->
42 @see wxFontDialog, wxFontPickerEvent
44 class wxFontPickerCtrl
: public wxPickerBase
48 Initializes the object and calls Create() with
51 wxFontPickerCtrl(wxWindow
* parent
, wxWindowID id
,
52 const wxFont
& font
= wxNullFont
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
55 long style
= wxFNTP_DEFAULT_STYLE
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= "fontpickerctrl");
61 Parent window, must not be non-@NULL.
63 The identifier for the control.
65 The initial font shown in the control. If wxNullFont
66 is given, the default font is used.
72 The window style, see wxFNTP_* flags.
74 Validator which can be used for additional date checks.
78 @return @true if the control was successfully created or @false if
81 bool Create(wxWindow
* parent
, wxWindowID id
,
82 const wxFont
& font
= wxNullFont
,
83 const wxPoint
& pos
= wxDefaultPosition
,
84 const wxSize
& size
= wxDefaultSize
,
85 long style
= wxFNTP_DEFAULT_STYLE
,
86 const wxValidator
& validator
= wxDefaultValidator
,
87 const wxString
& name
= "fontpickerctrl");
90 Returns the maximum point size value allowed for the user-chosen font.
92 unsigned int GetMaxPointSize() const;
95 Returns the currently selected font.
96 Note that this function is completely different from wxWindow::GetFont.
98 wxFont
GetSelectedFont() const;
101 Sets the maximum point size value allowed for the user-chosen font.
102 The default value is 100. Note that big fonts can require a lot of memory and
104 both for creation and for rendering; thus, specially because the user has the
106 the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea
108 to the maximum font size when huge fonts do not make much sense.
110 void GetMaxPointSize(unsigned int max
);
113 Sets the currently selected font.
114 Note that this function is completely different from wxWindow::SetFont.
116 void SetSelectedFont(const wxFont
& font
);
122 @class wxFontPickerEvent
124 This event class is used for the events generated by
130 @see wxFontPickerCtrl
132 class wxFontPickerEvent
: public wxCommandEvent
136 The constructor is not normally used by the user code.
138 wxFontPickerEvent(wxObject
* generator
, int id
,
142 Retrieve the font the user has just selected.
144 wxFont
GetFont() const;
147 Set the font associated with the event.
149 void SetFont(const wxFont
& f
);