]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
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} | |
7c913512 | 12 | |
23324ae1 FM |
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). | |
7c913512 | 19 | |
23324ae1 FM |
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 | |
7c913512 | 38 | |
23324ae1 FM |
39 | @library{wxcore} |
40 | @category{miscpickers} | |
41 | @appearance{fontpickerctrl.png} | |
7c913512 | 42 | |
23324ae1 FM |
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 | /** | |
7c913512 | 62 | @param parent |
23324ae1 FM |
63 | Parent window, must not be non-@NULL. |
64 | ||
7c913512 | 65 | @param id |
23324ae1 FM |
66 | The identifier for the control. |
67 | ||
7c913512 FM |
68 | @param font |
69 | The initial font shown in the control. If wxNullFont | |
23324ae1 FM |
70 | is given, the default font is used. |
71 | ||
7c913512 | 72 | @param pos |
23324ae1 FM |
73 | Initial position. |
74 | ||
7c913512 | 75 | @param size |
23324ae1 FM |
76 | Initial size. |
77 | ||
7c913512 | 78 | @param style |
23324ae1 FM |
79 | The window style, see wxFNTP_* flags. |
80 | ||
7c913512 | 81 | @param validator |
23324ae1 FM |
82 | Validator which can be used for additional date checks. |
83 | ||
7c913512 | 84 | @param name |
23324ae1 FM |
85 | Control name. |
86 | ||
87 | @returns @true if the control was successfully created or @false if | |
88 | creation failed. | |
89 | */ | |
90 | bool Create(wxWindow * parent, wxWindowID id, | |
91 | const wxFont& font = wxNullFont, | |
92 | const wxPoint& pos = wxDefaultPosition, | |
93 | const wxSize& size = wxDefaultSize, | |
94 | long style = wxFNTP_DEFAULT_STYLE, | |
95 | const wxValidator& validator = wxDefaultValidator, | |
96 | const wxString& name = "fontpickerctrl"); | |
97 | ||
98 | /** | |
99 | Returns the maximum point size value allowed for the user-chosen font. | |
100 | */ | |
101 | unsigned int GetMaxPointSize(); | |
102 | ||
103 | /** | |
104 | Returns the currently selected font. | |
105 | Note that this function is completely different from wxWindow::GetFont. | |
106 | */ | |
107 | wxFont GetSelectedFont(); | |
108 | ||
109 | /** | |
110 | Sets the maximum point size value allowed for the user-chosen font. | |
111 | The default value is 100. Note that big fonts can require a lot of memory and | |
112 | CPU time | |
113 | both for creation and for rendering; thus, specially because the user has the | |
114 | option to specify | |
115 | the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea | |
116 | to put a limit | |
117 | to the maximum font size when huge fonts do not make much sense. | |
118 | */ | |
119 | void GetMaxPointSize(unsigned int max); | |
120 | ||
121 | /** | |
122 | Sets the currently selected font. | |
123 | Note that this function is completely different from wxWindow::SetFont. | |
124 | */ | |
125 | void SetSelectedFont(const wxFont & font); | |
126 | }; | |
127 | ||
128 | ||
129 | /** | |
130 | @class wxFontPickerEvent | |
131 | @wxheader{fontpicker.h} | |
7c913512 | 132 | |
23324ae1 FM |
133 | This event class is used for the events generated by |
134 | wxFontPickerCtrl. | |
7c913512 | 135 | |
23324ae1 FM |
136 | @library{wxcore} |
137 | @category{FIXME} | |
7c913512 | 138 | |
23324ae1 FM |
139 | @seealso |
140 | wxFontPickerCtrl | |
141 | */ | |
142 | class wxFontPickerEvent : public wxCommandEvent | |
143 | { | |
144 | public: | |
145 | /** | |
146 | The constructor is not normally used by the user code. | |
147 | */ | |
148 | wxFontPickerEvent(wxObject * generator, int id, | |
149 | const wxFont& font); | |
150 | ||
151 | /** | |
152 | Retrieve the font the user has just selected. | |
153 | */ | |
154 | wxFont GetFont(); | |
155 | ||
156 | /** | |
157 | Set the font associated with the event. | |
158 | */ | |
159 | void SetFont(const wxFont & f); | |
160 | }; |