]>
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 VZ |
19 | #include "wx/dialog.h" // the base class |
20 | #include "wx/cmndata.h" // wxFontData | |
21 | ||
22 | // ---------------------------------------------------------------------------- | |
23 | // wxFontDialog interface | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
26 | class WXDLLEXPORT wxFontDialogBase : public wxDialog | |
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 VZ |
39 | |
40 | virtual ~wxFontDialogBase(); | |
41 | ||
42 | // retrieve the font data | |
43 | const wxFontData& GetFontData() const { return m_fontData; } | |
44 | wxFontData& GetFontData() { return m_fontData; } | |
45 | ||
46 | // deprecated interface, for compatibility only, don't use | |
47 | wxFontDialogBase(wxWindow *parent, const wxFontData *data) | |
3fde374f | 48 | { m_parent = parent; InitFontData(data); } |
dbc65e27 VZ |
49 | |
50 | bool Create(wxWindow *parent, const wxFontData *data) | |
3fde374f | 51 | { InitFontData(data); return Create(parent); } |
dbc65e27 VZ |
52 | |
53 | protected: | |
a62848fd | 54 | virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; } |
dbc65e27 | 55 | |
3fde374f VZ |
56 | void InitFontData(const wxFontData *data = NULL) |
57 | { if ( data ) m_fontData = *data; } | |
58 | ||
dbc65e27 | 59 | wxFontData m_fontData; |
fc7a2a60 VZ |
60 | |
61 | DECLARE_NO_COPY_CLASS(wxFontDialogBase) | |
dbc65e27 VZ |
62 | }; |
63 | ||
64 | // ---------------------------------------------------------------------------- | |
65 | // platform-specific wxFontDialog implementation | |
66 | // ---------------------------------------------------------------------------- | |
67 | ||
356c775f RN |
68 | #if defined( __WXMAC_OSX__ ) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_2 ) |
69 | //set to 1 to use native mac font and color dialogs | |
fde692b5 | 70 | #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 |
356c775f RN |
71 | #else |
72 | //not supported on these platforms, leave 0 | |
73 | #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0 | |
74 | #endif | |
fde692b5 | 75 | |
d22004c4 WS |
76 | #if defined(__WXUNIVERSAL__) || \ |
77 | defined(__WXMOTIF__) || \ | |
d22004c4 WS |
78 | defined(__WXCOCOA__) || \ |
79 | defined(__WXWINCE__) || \ | |
80 | defined(__WXGPE__) | |
81 | ||
dbc65e27 VZ |
82 | #include "wx/generic/fontdlgg.h" |
83 | #define wxFontDialog wxGenericFontDialog | |
4234ea8b | 84 | #elif defined(__WXMSW__) |
dbc65e27 | 85 | #include "wx/msw/fontdlg.h" |
1be7a35c | 86 | #elif defined(__WXGTK20__) |
dbc65e27 | 87 | #include "wx/gtk/fontdlg.h" |
1be7a35c MR |
88 | #elif defined(__WXGTK__) |
89 | #include "wx/gtk1/fontdlg.h" | |
1777b9bb | 90 | #elif defined(__WXPM__) |
dbc65e27 | 91 | #include "wx/os2/fontdlg.h" |
10dc1363 RN |
92 | #elif defined(__WXMAC__) |
93 | #include "wx/mac/fontdlg.h" | |
c801d85f KB |
94 | #endif |
95 | ||
dbc65e27 VZ |
96 | // ---------------------------------------------------------------------------- |
97 | // global public functions | |
98 | // ---------------------------------------------------------------------------- | |
99 | ||
65d877d2 VZ |
100 | // get the font from user and return it, returns wxNullFont if the dialog was |
101 | // cancelled | |
bf31fa26 VZ |
102 | wxFont WXDLLEXPORT |
103 | wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, | |
f14d6dd1 | 104 | const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString); |
bf31fa26 | 105 | |
1e6feb95 VZ |
106 | #endif // wxUSE_FONTDLG |
107 | ||
c801d85f | 108 | #endif |
34138703 | 109 | // _WX_FONTDLG_H_BASE_ |