]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/fontdlg.h
88fc7e414a6a02bda0be38a39c782a60abe7ec96
[wxWidgets.git] / interface / wx / fontdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fontdlg.h
3 // Purpose: interface of wxFontDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxFontDialog
10
11 This class represents the font chooser dialog.
12
13 @library{wxcore}
14 @category{cmndlg}
15
16 @see overview_cmndlg_font, wxFontData, wxGetFontFromUser()
17 */
18 class wxFontDialog : public wxDialog
19 {
20 public:
21 /**
22 Default ctor.
23 Create() must be called before the dialog can be shown.
24 */
25 wxFontDialog();
26
27 /**
28 Constructor with parent window.
29 */
30 wxFontDialog(wxWindow* parent);
31
32 /**
33 Constructor.
34 Pass a parent window, and the @ref wxFontData "font data" object
35 to be used to initialize the dialog controls.
36 */
37 wxFontDialog(wxWindow* parent, const wxFontData& data);
38
39 /**
40 Creates the dialog if the wxFontDialog object had been initialized using
41 the default constructor.
42
43 @return @true on success and @false if an error occurred.
44 */
45 bool Create(wxWindow* parent);
46
47 /**
48 Creates the dialog if the wxFontDialog object had been initialized using
49 the default constructor.
50
51 @return @true on success and @false if an error occurred.
52 */
53 bool Create(wxWindow* parent, const wxFontData& data);
54
55 //@{
56 /**
57 Returns the @ref wxFontData "font data" associated with the
58 font dialog.
59 */
60 const wxFontData& GetFontData() const;
61 wxFontData& GetFontData();
62 //@}
63
64 /**
65 Shows the dialog, returning @c wxID_OK if the user pressed Ok, and
66 @c wxID_CANCEL otherwise.
67
68 If the user cancels the dialog (ShowModal returns @c wxID_CANCEL), no font
69 will be created. If the user presses OK, a new wxFont will be created and
70 stored in the font dialog's wxFontData structure.
71
72 @see GetFontData()
73 */
74 int ShowModal();
75 };
76
77
78
79 // ============================================================================
80 // Global functions/macros
81 // ============================================================================
82
83 /** @addtogroup group_funcmacro_dialog */
84 //@{
85
86 /**
87 Shows the font selection dialog and returns the font selected by user or
88 invalid font (use wxFont::IsOk() to test whether a font is valid) if the
89 dialog was cancelled.
90
91 @param parent
92 The parent window for the font selection dialog.
93 @param fontInit
94 If given, this will be the font initially selected in the dialog.
95 @param caption
96 If given, this will be used for the dialog caption.
97
98 @header{wx/fontdlg.h}
99 */
100 wxFont wxGetFontFromUser(wxWindow* parent,
101 const wxFont& fontInit,
102 const wxString& caption = wxEmptyString);
103
104 //@}
105