]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/aboutdlg.mm
Fix harmless unused parameter warning in wxOSX.
[wxWidgets.git] / src / osx / cocoa / aboutdlg.mm
CommitLineData
fb8dcb05 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/osx/cocoa/aboutdlg.mm
fb8dcb05
SC
3// Purpose: native wxAboutBox() implementation for wxMac
4// Author: Vadim Zeitlin
5// Created: 2006-10-08
a9a4f229 6// RCS-ID: $Id$
fb8dcb05
SC
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/osx/private.h"
31
e9670814
VZ
32// see http://developer.apple.com/mac/library/technotes/tn2006/tn2179.html for
33// information about the various keys used here
fb8dcb05
SC
34
35// helper class for HIAboutBox options
36class AboutBoxOptions : public wxCFRef<CFMutableDictionaryRef>
37{
38public:
39 AboutBoxOptions() : wxCFRef<CFMutableDictionaryRef>
40 (
41 CFDictionaryCreateMutable
42 (
43 kCFAllocatorDefault,
44 4, // there are at most 4 values
45 &kCFTypeDictionaryKeyCallBacks,
46 &kCFTypeDictionaryValueCallBacks
47 )
48 )
49 {
50 }
51
52 void Set(CFStringRef key, const wxString& value)
53 {
54 CFDictionarySetValue(*this, key, wxCFStringRef(value));
55 }
56
57 void SetAttributedString( CFStringRef key, const wxString& value )
58 {
953aebc2 59 wxCFRef<CFAttributedStringRef> attrString(
fb8dcb05
SC
60 CFAttributedStringCreate(kCFAllocatorDefault, wxCFStringRef(value), NULL) );
61 CFDictionarySetValue(*this, key, attrString);
62 }
63};
64
65// ============================================================================
66// implementation
67// ============================================================================
68
7d7cb800 69void wxAboutBox(const wxAboutDialogInfo& info, wxWindow *parent)
fb8dcb05
SC
70{
71 // Mac native about box currently can show only name, version, copyright
72 // and description fields and we also shoehorn the credits text into the
73 // description but if we have anything else we must use the generic version
74
75 if ( info.IsSimple() )
76 {
77 AboutBoxOptions opts;
78
79 opts.Set(CFSTR("ApplicationName"), info.GetName());
80
81 if ( info.HasVersion() )
82 {
83 opts.Set(CFSTR("Version"),info.GetVersion());
f43a3988
SC
84 if ( info.GetLongVersion() != (_("Version ")+info.GetVersion()))
85 opts.Set(CFSTR("ApplicationVersion"),info.GetLongVersion());
fb8dcb05
SC
86 }
87
88 if ( info.HasCopyright() )
953aebc2 89 opts.Set(CFSTR("Copyright"), info.GetCopyrightToDisplay());
fb8dcb05
SC
90
91 opts.SetAttributedString(CFSTR("Credits"), info.GetDescriptionAndCredits());
92
93 [[NSApplication sharedApplication] orderFrontStandardAboutPanelWithOptions:((NSDictionary*)(CFDictionaryRef) opts)];
94 }
95 else // simple "native" version is not enough
96 {
97 // we need to use the full-blown generic version
7d7cb800 98 wxGenericAboutBox(info, parent);
fb8dcb05
SC
99 }
100}
101
102#endif // wxUSE_ABOUTDLG