]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontdlg.h
XRC: make wxSplitterWindow's sashpos and minpanesize dimensions.
[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 // Copyright: (c) 1997-2002 wxWidgets team
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_FONTDLG_H_BASE_
12 #define _WX_FONTDLG_H_BASE_
13
14 #include "wx/defs.h" // for wxUSE_FONTDLG
15
16 #if wxUSE_FONTDLG
17
18 #include "wx/dialog.h" // the base class
19 #include "wx/fontdata.h"
20
21 // ----------------------------------------------------------------------------
22 // wxFontDialog interface
23 // ----------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_CORE wxFontDialogBase : public wxDialog
26 {
27 public:
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); }
33
34 bool Create(wxWindow *parent)
35 { return DoCreate(parent); }
36 bool Create(wxWindow *parent, const wxFontData& data)
37 { InitFontData(&data); return Create(parent); }
38
39 // retrieve the font data
40 const wxFontData& GetFontData() const { return m_fontData; }
41 wxFontData& GetFontData() { return m_fontData; }
42
43 #if WXWIN_COMPATIBILITY_2_6
44 // deprecated interface, for compatibility only, don't use
45 wxDEPRECATED( wxFontDialogBase(wxWindow *parent, const wxFontData *data) );
46
47 wxDEPRECATED( bool Create(wxWindow *parent, const wxFontData *data) );
48 #endif // WXWIN_COMPATIBILITY_2_6
49
50 protected:
51 virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return true; }
52
53 void InitFontData(const wxFontData *data = NULL)
54 { if ( data ) m_fontData = *data; }
55
56 wxFontData m_fontData;
57
58 wxDECLARE_NO_COPY_CLASS(wxFontDialogBase);
59 };
60
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
70 // ----------------------------------------------------------------------------
71 // platform-specific wxFontDialog implementation
72 // ----------------------------------------------------------------------------
73
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
77 #else
78 //not supported on these platforms, leave 0
79 #define USE_NATIVE_FONT_DIALOG_FOR_MACOSX 0
80 #endif
81
82 #if defined(__WXUNIVERSAL__) || \
83 defined(__WXMOTIF__) || \
84 defined(__WXCOCOA__) || \
85 defined(__WXWINCE__) || \
86 defined(__WXGPE__)
87
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"
100 #endif
101
102 // ----------------------------------------------------------------------------
103 // global public functions
104 // ----------------------------------------------------------------------------
105
106 // get the font from user and return it, returns wxNullFont if the dialog was
107 // cancelled
108 WXDLLIMPEXP_CORE wxFont wxGetFontFromUser(wxWindow *parent = NULL,
109 const wxFont& fontInit = wxNullFont,
110 const wxString& caption = wxEmptyString);
111
112 #endif // wxUSE_FONTDLG
113
114 #endif
115 // _WX_FONTDLG_H_BASE_