fixed wxFontDialog API: accept const ref instead of (well, in addition to) a possibly...
[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 wxWindows team
9 // Licence: wxWindows license
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) { }
32 wxFontDialogBase(wxWindow *parent, const wxFontData& data) { }
33
34 bool Create(wxWindow *parent)
35 { return DoCreate(parent); }
36 bool Create(wxWindow *parent, const wxFontData& data)
37 { m_fontData = data; return Create(parent); }
38
39 virtual ~wxFontDialogBase();
40
41 // retrieve the font data
42 const wxFontData& GetFontData() const { return m_fontData; }
43 wxFontData& GetFontData() { return m_fontData; }
44
45 // deprecated interface, for compatibility only, don't use
46 wxFontDialogBase(wxWindow *parent, const wxFontData *data)
47 { Init(); Create(parent, data); }
48
49 bool Create(wxWindow *parent, const wxFontData *data)
50 { if ( data ) m_fontData = *data; return Create(parent); }
51
52 protected:
53 virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return TRUE; }
54
55 wxFontData m_fontData;
56 };
57
58 // ----------------------------------------------------------------------------
59 // platform-specific wxFontDialog implementation
60 // ----------------------------------------------------------------------------
61
62 #if defined(__WXUNIVERSAL__) || defined(__WXMOTIF__) || defined(__WXMAC__)
63 #include "wx/generic/fontdlgg.h"
64 #define wxFontDialog wxGenericFontDialog
65 #define sm_classwxFontDialog sm_classwxGenericFontDialog
66 #elif defined(__WXMSW__)
67 #include "wx/msw/fontdlg.h"
68 #elif defined(__WXGTK__)
69 #include "wx/gtk/fontdlg.h"
70 #elif defined(__WXPM__)
71 #include "wx/os2/fontdlg.h"
72 #endif
73
74 // ----------------------------------------------------------------------------
75 // global public functions
76 // ----------------------------------------------------------------------------
77
78 // get the font from user and return it, returns wxNullFont if the dialog was
79 // cancelled
80 wxFont WXDLLEXPORT
81 wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL,
82 const wxFont& fontInit = wxNullFont);
83
84 #endif // wxUSE_FONTDLG
85
86 #endif
87 // _WX_FONTDLG_H_BASE_