]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/fontpicker.h
document wxDELETE() and wxDELETEA() (now committing the right file, please disregard...
[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$
6// Licence: wxWindows license
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
15 font-chooser
16 dialog.
17 It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
7c913512 18
23324ae1 19 @beginStyleTable
8c6791e4 20 @style{wxFNTP_DEFAULT_STYLE}
23324ae1
FM
21 The default style: wxFNTP_FONTDESC_AS_LABEL |
22 wxFNTP_USEFONT_FOR_LABEL.
8c6791e4 23 @style{wxFNTP_USE_TEXTCTRL}
23324ae1
FM
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.
8c6791e4 29 @style{wxFNTP_FONTDESC_AS_LABEL}
23324ae1
FM
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.
8c6791e4 34 @style{wxFNTP_USEFONT_FOR_LABEL}
23324ae1
FM
35 Uses the currently selected font to draw the label of the button.
36 @endStyleTable
7c913512 37
23324ae1 38 @library{wxcore}
d18d9f60 39 @category{pickers}
0c7fe6f2 40 <!-- @appearance{fontpickerctrl.png} -->
7c913512 41
e54c96f1 42 @see wxFontDialog, wxFontPickerEvent
23324ae1
FM
43*/
44class wxFontPickerCtrl : public wxPickerBase
45{
46public:
47 /**
48 Initializes the object and calls Create() with
49 all the parameters.
50 */
4cc4bfaf 51 wxFontPickerCtrl(wxWindow* parent, wxWindowID id,
23324ae1
FM
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");
58
59 /**
7c913512 60 @param parent
4cc4bfaf 61 Parent window, must not be non-@NULL.
7c913512 62 @param id
4cc4bfaf 63 The identifier for the control.
7c913512 64 @param font
4cc4bfaf
FM
65 The initial font shown in the control. If wxNullFont
66 is given, the default font is used.
7c913512 67 @param pos
4cc4bfaf 68 Initial position.
7c913512 69 @param size
4cc4bfaf 70 Initial size.
7c913512 71 @param style
4cc4bfaf 72 The window style, see wxFNTP_* flags.
7c913512 73 @param validator
4cc4bfaf 74 Validator which can be used for additional date checks.
7c913512 75 @param name
4cc4bfaf 76 Control name.
3c4f71cc 77
d29a9a8a 78 @return @true if the control was successfully created or @false if
4cc4bfaf 79 creation failed.
23324ae1 80 */
4cc4bfaf 81 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
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");
88
89 /**
90 Returns the maximum point size value allowed for the user-chosen font.
91 */
328f5751 92 unsigned int GetMaxPointSize() const;
23324ae1
FM
93
94 /**
95 Returns the currently selected font.
96 Note that this function is completely different from wxWindow::GetFont.
97 */
328f5751 98 wxFont GetSelectedFont() const;
23324ae1
FM
99
100 /**
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
103 CPU time
104 both for creation and for rendering; thus, specially because the user has the
105 option to specify
106 the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea
107 to put a limit
108 to the maximum font size when huge fonts do not make much sense.
109 */
110 void GetMaxPointSize(unsigned int max);
111
112 /**
113 Sets the currently selected font.
114 Note that this function is completely different from wxWindow::SetFont.
115 */
4cc4bfaf 116 void SetSelectedFont(const wxFont& font);
23324ae1
FM
117};
118
119
e54c96f1 120
23324ae1
FM
121/**
122 @class wxFontPickerEvent
7c913512 123
23324ae1
FM
124 This event class is used for the events generated by
125 wxFontPickerCtrl.
7c913512 126
23324ae1
FM
127 @library{wxcore}
128 @category{FIXME}
7c913512 129
e54c96f1 130 @see wxFontPickerCtrl
23324ae1
FM
131*/
132class wxFontPickerEvent : public wxCommandEvent
133{
134public:
135 /**
136 The constructor is not normally used by the user code.
137 */
4cc4bfaf 138 wxFontPickerEvent(wxObject* generator, int id,
23324ae1
FM
139 const wxFont& font);
140
141 /**
142 Retrieve the font the user has just selected.
143 */
328f5751 144 wxFont GetFont() const;
23324ae1
FM
145
146 /**
147 Set the font associated with the event.
148 */
4cc4bfaf 149 void SetFont(const wxFont& f);
23324ae1 150};
e54c96f1 151