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