]>
Commit | Line | Data |
---|---|---|
dbc65e27 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/fontdlg.h | |
3 | // Purpose: common interface for different wxFontDialog classes | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 12.05.02 | |
77ffb593 | 7 | // Copyright: (c) 1997-2002 wxWidgets team |
65571936 | 8 | // Licence: wxWindows licence |
dbc65e27 VZ |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
34138703 JS |
11 | #ifndef _WX_FONTDLG_H_BASE_ |
12 | #define _WX_FONTDLG_H_BASE_ | |
c801d85f | 13 | |
dbc65e27 VZ |
14 | #include "wx/defs.h" // for wxUSE_FONTDLG |
15 | ||
1e6feb95 VZ |
16 | #if wxUSE_FONTDLG |
17 | ||
dbc65e27 | 18 | #include "wx/dialog.h" // the base class |
081d8d96 | 19 | #include "wx/fontdata.h" |
dbc65e27 VZ |
20 | |
21 | // ---------------------------------------------------------------------------- | |
22 | // wxFontDialog interface | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
53a2db12 | 25 | class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog |
dbc65e27 VZ |
26 | { |
27 | public: | |
28 | // create the font dialog | |
29 | wxFontDialogBase() { } | |
3fde374f VZ |
30 | wxFontDialogBase(wxWindow *parent) { m_parent = parent; } |
31 | wxFontDialogBase(wxWindow *parent, const wxFontData& data) | |
32 | { m_parent = parent; InitFontData(&data); } | |
dbc65e27 VZ |
33 | |
34 | bool Create(wxWindow *parent) | |
35 | { return DoCreate(parent); } | |
36 | bool Create(wxWindow *parent, const wxFontData& data) | |
3fde374f | 37 | { InitFontData(&data); return Create(parent); } |
dbc65e27 | 38 | |
dbc65e27 VZ |
39 | // retrieve the font data |
40 | const wxFontData& GetFontData() const { return m_fontData; } | |
41 | wxFontData& GetFontData() { return m_fontData; } | |
42 | ||
ca3e85cf | 43 | #if WXWIN_COMPATIBILITY_2_6 |
dbc65e27 | 44 | // deprecated interface, for compatibility only, don't use |
ca3e85cf | 45 | wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) ); |
dbc65e27 | 46 | |
ca3e85cf WS |
47 | wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) ); |
48 | #endif // WXWIN_COMPATIBILITY_2_6 | |
dbc65e27 VZ |
49 | |
50 | protected: | |
a62848fd | 51 | virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } |
dbc65e27 | 52 | |
3fde374f VZ |
53 | void InitFontData(const wxFontData *data = NULL) |
54 | { if ( data ) m_fontData = *data; } | |
55 | ||
dbc65e27 | 56 | wxFontData m_fontData; |
fc7a2a60 | 57 | |
c0c133e1 | 58 | wxDECLARE_NO_COPY_CLASS(wxFontDialogBase); |
dbc65e27 VZ |
59 | }; |
60 | ||
ca3e85cf WS |
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); } | |
65 | ||
66 | inline bool wxFontDialogBase::Create(wxWindow *parent, const wxFontData *data) | |
67 | { InitFontData(data); return Create(parent); } | |
68 | #endif // WXWIN_COMPATIBILITY_2_6 | |
69 | ||
dbc65e27 VZ |
70 | // ---------------------------------------------------------------------------- |
71 | // platform-specific wxFontDialog implementation | |
72 | // ---------------------------------------------------------------------------- | |
73 | ||
712d087f | 74 | #if defined( __WXOSX_MAC__ ) |
356c775f | 75 | //set to 1 to use native mac font and color dialogs |
31189345 | 76 | #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 1 |
356c775f RN |
77 | #else |
78 | //not supported on these platforms, leave 0 | |
79 | #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 | |
80 | #endif | |
fde692b5 | 81 | |
d22004c4 WS |
82 | #if defined(__WXUNIVERSAL__) || \ |
83 | defined(__WXMOTIF__) || \ | |
d22004c4 WS |
84 | defined(__WXCOCOA__) || \ |
85 | defined(__WXWINCE__) || \ | |
86 | defined(__WXGPE__) | |
87 | ||
dbc65e27 VZ |
88 | #include "wx/generic/fontdlgg.h" |
89 | #define wxFontDialog wxGenericFontDialog | |
4234ea8b | 90 | #elif defined(__WXMSW__) |
dbc65e27 | 91 | #include "wx/msw/fontdlg.h" |
1be7a35c | 92 | #elif defined(__WXGTK20__) |
dbc65e27 | 93 | #include "wx/gtk/fontdlg.h" |
1be7a35c MR |
94 | #elif defined(__WXGTK__) |
95 | #include "wx/gtk1/fontdlg.h" | |
1777b9bb | 96 | #elif defined(__WXPM__) |
dbc65e27 | 97 | #include "wx/os2/fontdlg.h" |
10dc1363 | 98 | #elif defined(__WXMAC__) |
ef0e9220 | 99 | #include "wx/osx/fontdlg.h" |
c801d85f KB |
100 | #endif |
101 | ||
dbc65e27 VZ |
102 | // ---------------------------------------------------------------------------- |
103 | // global public functions | |
104 | // ---------------------------------------------------------------------------- | |
105 | ||
65d877d2 VZ |
106 | // get the font from user and return it, returns wxNullFont if the dialog was |
107 | // cancelled | |
d3b9f782 | 108 | WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL, |
53a2db12 FM |
109 | const wxFont& fontInit = wxNullFont, |
110 | const wxString& caption = wxEmptyString); | |
bf31fa26 | 111 | |
1e6feb95 VZ |
112 | #endif // wxUSE_FONTDLG |
113 | ||
c801d85f | 114 | #endif |
34138703 | 115 | // _WX_FONTDLG_H_BASE_ |