1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/aboutdlg.cpp
3 // Purpose: native wxAboutBox() implementation for wxMac
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 // ============================================================================
12 // ============================================================================
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
18 // for compilers that support precompilation, includes "wx.h".
19 #include "wx/wxprec.h"
26 #include "wx/aboutdlg.h"
27 #include "wx/generic/aboutdlgg.h"
29 #include "wx/osx/private.h"
31 // helper class for HIAboutBox options
32 class AboutBoxOptions
: public wxCFRef
<CFMutableDictionaryRef
>
35 AboutBoxOptions() : wxCFRef
<CFMutableDictionaryRef
>
37 CFDictionaryCreateMutable
40 4, // there are at most 4 values
41 &kCFTypeDictionaryKeyCallBacks
,
42 &kCFTypeDictionaryValueCallBacks
48 void Set(CFStringRef key
, const wxString
& value
)
50 CFDictionarySetValue(*this, key
, wxCFStringRef(value
));
54 // ============================================================================
56 // ============================================================================
58 void wxAboutBox(const wxAboutDialogInfo
& info
, wxWindow
*parent
)
60 // Mac native about box currently can show only name, version, copyright
61 // and description fields and we also shoehorn the credits text into the
62 // description but if we have anything else we must use the generic version
64 if ( info
.IsSimple() )
68 opts
.Set(kHIAboutBoxNameKey
, info
.GetName());
70 if ( info
.HasVersion() )
71 opts
.Set(kHIAboutBoxVersionKey
,info
.GetLongVersion());
73 if ( info
.HasCopyright() )
74 opts
.Set(kHIAboutBoxCopyrightKey
, info
.GetCopyrightToDisplay());
76 opts
.Set(kHIAboutBoxDescriptionKey
, info
.GetDescriptionAndCredits());
80 else // simple "native" version is not enough
82 // we need to use the full-blown generic version
83 wxGenericAboutBox(info
, parent
);
87 #endif // wxUSE_ABOUTDLG