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 #if WXWIN_COMPATIBILITY_2_6
47 // deprecated interface, for compatibility only, don't use
48 wxDEPRECATED( wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
) );
50 wxDEPRECATED( bool Create(wxWindow
*parent
, const wxFontData
*data
) );
51 #endif // WXWIN_COMPATIBILITY_2_6
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 #if WXWIN_COMPATIBILITY_2_6
65 // deprecated interface, for compatibility only, don't use
66 inline wxFontDialogBase::wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
)
67 { m_parent
= parent
; InitFontData(data
); }
69 inline bool wxFontDialogBase::Create(wxWindow
*parent
, const wxFontData
*data
)
70 { InitFontData(data
); return Create(parent
); }
71 #endif // WXWIN_COMPATIBILITY_2_6
73 // ----------------------------------------------------------------------------
74 // platform-specific wxFontDialog implementation
75 // ----------------------------------------------------------------------------
77 #if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 )
78 //set to 1 to use native mac font and color dialogs
79 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
81 //not supported on these platforms, leave 0
82 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
85 #if defined(__WXUNIVERSAL__) || \
86 defined(__WXMOTIF__) || \
87 defined(__WXCOCOA__) || \
88 defined(__WXWINCE__) || \
91 #include "wx/generic/fontdlgg.h"
92 #define wxFontDialog wxGenericFontDialog
93 #elif defined(__WXMSW__)
94 #include "wx/msw/fontdlg.h"
95 #elif defined(__WXGTK20__)
96 #include "wx/gtk/fontdlg.h"
97 #elif defined(__WXGTK__)
98 #include "wx/gtk1/fontdlg.h"
99 #elif defined(__WXPM__)
100 #include "wx/os2/fontdlg.h"
101 #elif defined(__WXMAC__)
102 #include "wx/mac/fontdlg.h"
105 // ----------------------------------------------------------------------------
106 // global public functions
107 // ----------------------------------------------------------------------------
109 // get the font from user and return it, returns wxNullFont if the dialog was
112 wxGetFontFromUser(wxWindow
*parent
= (wxWindow
*)NULL
,
113 const wxFont
& fontInit
= wxNullFont
, const wxString
& caption
= wxEmptyString
);
115 #endif // wxUSE_FONTDLG
118 // _WX_FONTDLG_H_BASE_