## wxFontDialog

This class represents the font chooser dialog.

Derived from

wxDialog
wxWindow
wxEvtHandler
wxObject

Include files

<wx/fontdlg.h>

See also

Overview,
wxFontData,
wxGetFontFromUser

Members

wxFontDialog::wxFontDialog
wxFontDialog::Create
wxFontDialog::GetFontData
wxFontDialog::ShowModal

### wxFontDialog::wxFontDialog

wxFontDialog()

wxFontDialog(wxWindow* parent)

wxFontDialog(wxWindow* parent, const wxFontData& data)

Constructor. Pass a parent window, and optionally the font data object to be used to initialize the dialog controls. If the default constructor is used, Create() must be called before the dialog can be shown.

### wxFontDialog::Create

bool Create(wxWindow* parent)

bool Create(wxWindow* parent, const wxFontData& data)

Creates the dialog if it the wxFontDialog object had been initialized using the default constructor. Returns `true` on success and `false` if an error occurred.

### wxFontDialog::GetFontData

const wxFontData& GetFontData() const

wxFontData& GetFontData()

Returns the font data associated with the font dialog.

### wxFontDialog::ShowModal

int ShowModal()

Shows the dialog, returning `wxID_OK` if the user pressed Ok, and `wxID_CANCEL` otherwise.

If the user cancels the dialog (ShowModal returns `wxID_CANCEL`), no font will be created. If the user presses OK, a new wxFont will be created and stored in the font dialog's wxFontData structure.