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