]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontdlg.h
we need our own imaglist implementation because in wxmac wxIcon does not inherit...
[wxWidgets.git] / include / wx / fontdlg.h
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$
8 // Copyright: (c) 1997-2002 wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONTDLG_H_BASE_
13 #define _WX_FONTDLG_H_BASE_
14
15 #include "wx/defs.h" // for wxUSE_FONTDLG
16
17 #if wxUSE_FONTDLG
18
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() { }
31 wxFontDialogBase(wxWindow *parent) { m_parent = parent; }
32 wxFontDialogBase(wxWindow *parent, const wxFontData& data)
33 { m_parent = parent; InitFontData(&data); }
34
35 bool Create(wxWindow *parent)
36 { return DoCreate(parent); }
37 bool Create(wxWindow *parent, const wxFontData& data)
38 { InitFontData(&data); return Create(parent); }
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)
48 { m_parent = parent; InitFontData(data); }
49
50 bool Create(wxWindow *parent, const wxFontData *data)
51 { InitFontData(data); return Create(parent); }
52
53 protected:
54 virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; }
55
56 void InitFontData(const wxFontData *data = NULL)
57 { if ( data ) m_fontData = *data; }
58
59 wxFontData m_fontData;
60
61 DECLARE_NO_COPY_CLASS(wxFontDialogBase)
62 };
63
64 // ----------------------------------------------------------------------------
65 // platform-specific wxFontDialog implementation
66 // ----------------------------------------------------------------------------
67
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
70 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
71 #else
72 //not supported on these platforms, leave 0
73 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
74 #endif
75
76 #if defined(__WXUNIVERSAL__) || \
77 defined(__WXMOTIF__) || \
78 (defined(__WXMAC__) && !defined(__WXMAC_OSX__)) || \
79 (defined(__WXMAC__) && !USE_NATIVE_FONT_DIALOG_FOR_MACOSX) || \
80 (defined(__WXMAC_OSX__) && ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 ) ) || \
81 defined(__WXCOCOA__) || \
82 defined(__WXWINCE__) || \
83 defined(__WXGPE__)
84
85 #include "wx/generic/fontdlgg.h"
86 #define wxFontDialog wxGenericFontDialog
87 #elif defined(__WXMSW__)
88 #include "wx/msw/fontdlg.h"
89 #elif defined(__WXGTK__)
90 #include "wx/gtk/fontdlg.h"
91 #elif defined(__WXPM__)
92 #include "wx/os2/fontdlg.h"
93 #elif defined(__WXMAC__)
94 #include "wx/mac/fontdlg.h"
95 #endif
96
97 // ----------------------------------------------------------------------------
98 // global public functions
99 // ----------------------------------------------------------------------------
100
101 // get the font from user and return it, returns wxNullFont if the dialog was
102 // cancelled
103 wxFont WXDLLEXPORT
104 wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL,
105 const wxFont& fontInit = wxNullFont);
106
107 #endif // wxUSE_FONTDLG
108
109 #endif
110 // _WX_FONTDLG_H_BASE_