1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: common interface for different wxFontDialog classes
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 1997-2002 wxWidgets team
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_FONTDLG_H_BASE_
12 #define _WX_FONTDLG_H_BASE_
14 #include "wx/defs.h" // for wxUSE_FONTDLG
18 #include "wx/dialog.h" // the base class
19 #include "wx/fontdata.h"
21 // ----------------------------------------------------------------------------
22 // wxFontDialog interface
23 // ----------------------------------------------------------------------------
25 class WXDLLIMPEXP_CORE wxFontDialogBase
: public wxDialog
28 // create the font dialog
29 wxFontDialogBase() { }
30 wxFontDialogBase(wxWindow
*parent
) { m_parent
= parent
; }
31 wxFontDialogBase(wxWindow
*parent
, const wxFontData
& data
)
32 { m_parent
= parent
; InitFontData(&data
); }
34 bool Create(wxWindow
*parent
)
35 { return DoCreate(parent
); }
36 bool Create(wxWindow
*parent
, const wxFontData
& data
)
37 { InitFontData(&data
); return Create(parent
); }
39 // retrieve the font data
40 const wxFontData
& GetFontData() const { return m_fontData
; }
41 wxFontData
& GetFontData() { return m_fontData
; }
43 #if WXWIN_COMPATIBILITY_2_6
44 // deprecated interface, for compatibility only, don't use
45 wxDEPRECATED( wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
) );
47 wxDEPRECATED( bool Create(wxWindow
*parent
, const wxFontData
*data
) );
48 #endif // WXWIN_COMPATIBILITY_2_6
51 virtual bool DoCreate(wxWindow
*parent
) { m_parent
= parent
; return true; }
53 void InitFontData(const wxFontData
*data
= NULL
)
54 { if ( data
) m_fontData
= *data
; }
56 wxFontData m_fontData
;
58 wxDECLARE_NO_COPY_CLASS(wxFontDialogBase
);
61 #if WXWIN_COMPATIBILITY_2_6
62 // deprecated interface, for compatibility only, don't use
63 inline wxFontDialogBase::wxFontDialogBase(wxWindow
*parent
, const wxFontData
*data
)
64 { m_parent
= parent
; InitFontData(data
); }
66 inline bool wxFontDialogBase::Create(wxWindow
*parent
, const wxFontData
*data
)
67 { InitFontData(data
); return Create(parent
); }
68 #endif // WXWIN_COMPATIBILITY_2_6
70 // ----------------------------------------------------------------------------
71 // platform-specific wxFontDialog implementation
72 // ----------------------------------------------------------------------------
74 #if defined( __WXOSX_MAC__ )
75 //set to 1 to use native mac font and color dialogs
76 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1
78 //not supported on these platforms, leave 0
79 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
82 #if defined(__WXUNIVERSAL__) || \
83 defined(__WXMOTIF__) || \
84 defined(__WXCOCOA__) || \
85 defined(__WXWINCE__) || \
88 #include "wx/generic/fontdlgg.h"
89 #define wxFontDialog wxGenericFontDialog
90 #elif defined(__WXMSW__)
91 #include "wx/msw/fontdlg.h"
92 #elif defined(__WXGTK20__)
93 #include "wx/gtk/fontdlg.h"
94 #elif defined(__WXGTK__)
95 #include "wx/gtk1/fontdlg.h"
96 #elif defined(__WXPM__)
97 #include "wx/os2/fontdlg.h"
98 #elif defined(__WXMAC__)
99 #include "wx/osx/fontdlg.h"
102 // ----------------------------------------------------------------------------
103 // global public functions
104 // ----------------------------------------------------------------------------
106 // get the font from user and return it, returns wxNullFont if the dialog was
108 WXDLLIMPEXP_CORE wxFont
wxGetFontFromUser(wxWindow
*parent
= NULL
,
109 const wxFont
& fontInit
= wxNullFont
,
110 const wxString
& caption
= wxEmptyString
);
112 #endif // wxUSE_FONTDLG
115 // _WX_FONTDLG_H_BASE_