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