]>
Commit | Line | Data |
---|---|---|
489468fe | 1 | /////////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: src/osx/carbon/aboutdlg.cpp |
489468fe SC |
3 | // Purpose: native wxAboutBox() implementation for wxMac |
4 | // Author: Vadim Zeitlin | |
5 | // Created: 2006-10-08 | |
489468fe SC |
6 | // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> |
7 | // Licence: wxWindows licence | |
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // ============================================================================ | |
11 | // declarations | |
12 | // ============================================================================ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | // for compilers that support precompilation, includes "wx.h". | |
19 | #include "wx/wxprec.h" | |
20 | ||
21 | #if wxUSE_ABOUTDLG | |
22 | ||
23 | #ifndef WX_PRECOMP | |
24 | #endif //WX_PRECOMP | |
25 | ||
26 | #include "wx/aboutdlg.h" | |
27 | #include "wx/generic/aboutdlgg.h" | |
28 | ||
1f0c8f31 | 29 | #include "wx/osx/private.h" |
489468fe SC |
30 | |
31 | // helper class for HIAboutBox options | |
32 | class AboutBoxOptions : public wxCFRef<CFMutableDictionaryRef> | |
33 | { | |
34 | public: | |
35 | AboutBoxOptions() : wxCFRef<CFMutableDictionaryRef> | |
36 | ( | |
37 | CFDictionaryCreateMutable | |
38 | ( | |
39 | kCFAllocatorDefault, | |
40 | 4, // there are at most 4 values | |
41 | &kCFTypeDictionaryKeyCallBacks, | |
42 | &kCFTypeDictionaryValueCallBacks | |
43 | ) | |
44 | ) | |
45 | { | |
46 | } | |
47 | ||
48 | void Set(CFStringRef key, const wxString& value) | |
49 | { | |
50 | CFDictionarySetValue(*this, key, wxCFStringRef(value)); | |
51 | } | |
52 | }; | |
53 | ||
54 | // ============================================================================ | |
55 | // implementation | |
56 | // ============================================================================ | |
57 | ||
7d7cb800 | 58 | void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent) |
489468fe SC |
59 | { |
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 | |
524c47aa | 63 | |
489468fe SC |
64 | if ( info.IsSimple() ) |
65 | { | |
66 | AboutBoxOptions opts; | |
67 | ||
68 | opts.Set(kHIAboutBoxNameKey, info.GetName()); | |
69 | ||
70 | if ( info.HasVersion() ) | |
704006b3 | 71 | opts.Set(kHIAboutBoxVersionKey,info.GetLongVersion()); |
489468fe SC |
72 | |
73 | if ( info.HasCopyright() ) | |
953aebc2 | 74 | opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyrightToDisplay()); |
489468fe SC |
75 | |
76 | opts.Set(kHIAboutBoxDescriptionKey, info.GetDescriptionAndCredits()); | |
77 | ||
78 | HIAboutBox(opts); | |
79 | } | |
80 | else // simple "native" version is not enough | |
489468fe SC |
81 | { |
82 | // we need to use the full-blown generic version | |
7d7cb800 | 83 | wxGenericAboutBox(info, parent); |
489468fe SC |
84 | } |
85 | } | |
86 | ||
87 | #endif // wxUSE_ABOUTDLG |