1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: common interface for different wxFontDialog classes
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1997-2002 wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FONTDLG_H_BASE_
13 #define _WX_FONTDLG_H_BASE_
15 #include "wx/defs.h" // for wxUSE_FONTDLG
19 #include "wx/dialog.h" // the base class
20 #include "wx/cmndata.h" // wxFontData
22 // ----------------------------------------------------------------------------
23 // wxFontDialog interface
24 // ----------------------------------------------------------------------------
26 class WXDLLEXPORT wxFontDialogBase
: public wxDialog
29 // create the font dialog
30 wxFontDialogBase() { }
31 wxFontDialogBase(wxWindow
*parent
) { m_parent
= parent
; }
32 wxFontDialogBase(wxWindow
*parent
, const wxFontData
& data
)
33 { m_parent
= parent
; InitFontData(&data
); }
35 bool Create(wxWindow
*parent
)
36 { return DoCreate(parent
); }
37 bool Create(wxWindow
*parent
, const wxFontData
& data
)
38 { InitFontData(&data
); return Create(parent
); }
40 virtual ~wxFontDialogBase();
42 // retrieve the font data
43 const wxFontData
& GetFontData() const { return m_fontData
; }
44 wxFontData
& GetFontData() { return m_fontData
; }
46 // deprecated interface, for compatibility only, don't use
47 wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
)
48 { m_parent
= parent
; InitFontData(data
); }
50 bool Create(wxWindow
*parent
, const wxFontData
*data
)
51 { InitFontData(data
); return Create(parent
); }
54 virtual bool DoCreate(wxWindow
*parent
) { m_parent
= parent
; return true; }
56 void InitFontData(const wxFontData
*data
= NULL
)
57 { if ( data
) m_fontData
= *data
; }
59 wxFontData m_fontData
;
61 DECLARE_NO_COPY_CLASS(wxFontDialogBase
)
64 // ----------------------------------------------------------------------------
65 // platform-specific wxFontDialog implementation
66 // ----------------------------------------------------------------------------
68 #if defined(__WXUNIVERSAL__) || \
69 defined(__WXMOTIF__) || \
70 defined(__WXMAC__) && !defined(__WXMAC_OSX__) || \
71 defined(__WXMAC_OSX__) && ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 ) || \
72 defined(__WXCOCOA__) || \
73 defined(__WXWINCE__) || \
76 #include "wx/generic/fontdlgg.h"
77 #define wxFontDialog wxGenericFontDialog
78 #elif defined(__WXMSW__)
79 #include "wx/msw/fontdlg.h"
80 #elif defined(__WXGTK__)
81 #include "wx/gtk/fontdlg.h"
82 #elif defined(__WXPM__)
83 #include "wx/os2/fontdlg.h"
84 #elif defined(__WXMAC__)
85 #include "wx/mac/fontdlg.h"
88 // ----------------------------------------------------------------------------
89 // global public functions
90 // ----------------------------------------------------------------------------
92 // get the font from user and return it, returns wxNullFont if the dialog was
95 wxGetFontFromUser(wxWindow
*parent
= (wxWindow
*)NULL
,
96 const wxFont
& fontInit
= wxNullFont
);
98 #endif // wxUSE_FONTDLG
101 // _WX_FONTDLG_H_BASE_