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/fontdata.h"
22 // ----------------------------------------------------------------------------
23 // wxFontDialog interface
24 // ----------------------------------------------------------------------------
26 class WXDLLIMPEXP_CORE 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 // retrieve the font data
41 const wxFontData
& GetFontData() const { return m_fontData
; }
42 wxFontData
& GetFontData() { return m_fontData
; }
44 #if WXWIN_COMPATIBILITY_2_6
45 // deprecated interface, for compatibility only, don't use
46 wxDEPRECATED( wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
) );
48 wxDEPRECATED( bool Create(wxWindow
*parent
, const wxFontData
*data
) );
49 #endif // WXWIN_COMPATIBILITY_2_6
52 virtual bool DoCreate(wxWindow
*parent
) { m_parent
= parent
; return true; }
54 void InitFontData(const wxFontData
*data
= NULL
)
55 { if ( data
) m_fontData
= *data
; }
57 wxFontData m_fontData
;
59 wxDECLARE_NO_COPY_CLASS(wxFontDialogBase
);
62 #if WXWIN_COMPATIBILITY_2_6
63 // deprecated interface, for compatibility only, don't use
64 inline wxFontDialogBase::wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
)
65 { m_parent
= parent
; InitFontData(data
); }
67 inline bool wxFontDialogBase::Create(wxWindow
*parent
, const wxFontData
*data
)
68 { InitFontData(data
); return Create(parent
); }
69 #endif // WXWIN_COMPATIBILITY_2_6
71 // ----------------------------------------------------------------------------
72 // platform-specific wxFontDialog implementation
73 // ----------------------------------------------------------------------------
75 #if defined( __WXOSX_MAC__ )
76 //set to 1 to use native mac font and color dialogs
77 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1
79 //not supported on these platforms, leave 0
80 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
83 #if defined(__WXUNIVERSAL__) || \
84 defined(__WXMOTIF__) || \
85 defined(__WXCOCOA__) || \
86 defined(__WXWINCE__) || \
89 #include "wx/generic/fontdlgg.h"
90 #define wxFontDialog wxGenericFontDialog
91 #elif defined(__WXMSW__)
92 #include "wx/msw/fontdlg.h"
93 #elif defined(__WXGTK20__)
94 #include "wx/gtk/fontdlg.h"
95 #elif defined(__WXGTK__)
96 #include "wx/gtk1/fontdlg.h"
97 #elif defined(__WXPM__)
98 #include "wx/os2/fontdlg.h"
99 #elif defined(__WXMAC__)
100 #include "wx/osx/fontdlg.h"
103 // ----------------------------------------------------------------------------
104 // global public functions
105 // ----------------------------------------------------------------------------
107 // get the font from user and return it, returns wxNullFont if the dialog was
109 WXDLLIMPEXP_CORE wxFont
wxGetFontFromUser(wxWindow
*parent
= NULL
,
110 const wxFont
& fontInit
= wxNullFont
,
111 const wxString
& caption
= wxEmptyString
);
113 #endif // wxUSE_FONTDLG
116 // _WX_FONTDLG_H_BASE_