]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/aboutdlg.cpp
changing guard to support popupwindows as well
[wxWidgets.git] / src / mac / carbon / aboutdlg.cpp
CommitLineData
fd3f8f5c
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: mac/carbon/aboutdlg.cpp
3// Purpose: native wxAboutBox() implementation for wxMac
4// Author: Vadim Zeitlin
5// Created: 2006-10-08
6// RCS-ID: $Id$
7// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// for compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#if wxUSE_ABOUTDLG
23
24#ifndef WX_PRECOMP
25#endif //WX_PRECOMP
26
27#include "wx/aboutdlg.h"
28#include "wx/generic/aboutdlgg.h"
29
30#include "wx/mac/private.h"
31
32// helper class for HIAboutBox options
7a7697aa 33class AboutBoxOptions : public wxCFRef<CFMutableDictionaryRef>
fd3f8f5c
VZ
34{
35public:
7a7697aa 36 AboutBoxOptions() : wxCFRef<CFMutableDictionaryRef>
fd3f8f5c
VZ
37 (
38 CFDictionaryCreateMutable
39 (
40 kCFAllocatorDefault,
41 4, // there are at most 4 values
42 &kCFTypeDictionaryKeyCallBacks,
43 &kCFTypeDictionaryValueCallBacks
44 )
45 )
46 {
47 }
48
49 void Set(CFStringRef key, const wxString& value)
50 {
dbe4a80c 51 CFDictionarySetValue(*this, key, wxCFStringRef(value));
fd3f8f5c
VZ
52 }
53};
54
55// ============================================================================
56// implementation
57// ============================================================================
58
59void wxAboutBox(const wxAboutDialogInfo& info)
60{
61 // Mac native about box currently can show only name, version, copyright
62 // and description fields and we also shoehorn the credits text into the
63 // description but if we have anything else we must use the generic version
1bd568fa 64#ifndef __LP64__
fd3f8f5c
VZ
65 if ( info.IsSimple() )
66 {
67 AboutBoxOptions opts;
68
69 opts.Set(kHIAboutBoxNameKey, info.GetName());
70
71 if ( info.HasVersion() )
72 opts.Set(kHIAboutBoxVersionKey, info.GetVersion());
73
74 if ( info.HasCopyright() )
75 opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyright());
76
77 opts.Set(kHIAboutBoxDescriptionKey, info.GetDescriptionAndCredits());
78
79 HIAboutBox(opts);
80 }
81 else // simple "native" version is not enough
1bd568fa 82#endif
fd3f8f5c
VZ
83 {
84 // we need to use the full-blown generic version
85 wxGenericAboutBox(info);
86 }
87}
88
89#endif // wxUSE_ABOUTDLG