added native Mac implementation of wxAboutBox(); also moved aboutdlg.* files from core to adv library as they depend on wxHyperlinkCtrl which is in adv
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -634,7 +634,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/common/valtext.cpp
|
src/common/valtext.cpp
|
||||||
src/common/wincmn.cpp
|
src/common/wincmn.cpp
|
||||||
src/common/xpmdecod.cpp
|
src/common/xpmdecod.cpp
|
||||||
src/generic/aboutdlgg.cpp
|
|
||||||
src/generic/busyinfo.cpp
|
src/generic/busyinfo.cpp
|
||||||
src/generic/buttonbar.cpp
|
src/generic/buttonbar.cpp
|
||||||
src/generic/choicdgg.cpp
|
src/generic/choicdgg.cpp
|
||||||
@@ -666,7 +665,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
src/generic/vscroll.cpp
|
src/generic/vscroll.cpp
|
||||||
</set>
|
</set>
|
||||||
<set var="GUI_CMN_HDR" hints="files">
|
<set var="GUI_CMN_HDR" hints="files">
|
||||||
wx/aboutdlg.h
|
|
||||||
wx/bmpbuttn.h
|
wx/bmpbuttn.h
|
||||||
wx/brush.h
|
wx/brush.h
|
||||||
wx/button.h
|
wx/button.h
|
||||||
@@ -694,7 +692,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
wx/gauge.h
|
wx/gauge.h
|
||||||
wx/gbsizer.h
|
wx/gbsizer.h
|
||||||
wx/gdicmn.h
|
wx/gdicmn.h
|
||||||
wx/generic/aboutdlgg.h
|
|
||||||
wx/generic/accel.h
|
wx/generic/accel.h
|
||||||
wx/generic/buttonbar.h
|
wx/generic/buttonbar.h
|
||||||
wx/generic/choicdgg.h
|
wx/generic/choicdgg.h
|
||||||
@@ -1511,7 +1508,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
<set var="MSW_SRC" hints="files">
|
<set var="MSW_SRC" hints="files">
|
||||||
src/generic/statusbr.cpp
|
src/generic/statusbr.cpp
|
||||||
src/generic/prntdlgg.cpp
|
src/generic/prntdlgg.cpp
|
||||||
src/msw/aboutdlg.cpp
|
|
||||||
src/msw/accel.cpp
|
src/msw/accel.cpp
|
||||||
src/msw/bmpbuttn.cpp
|
src/msw/bmpbuttn.cpp
|
||||||
src/msw/button.cpp
|
src/msw/button.cpp
|
||||||
@@ -2615,6 +2611,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="ADVANCED_CMN_SRC" hints="files">
|
<set var="ADVANCED_CMN_SRC" hints="files">
|
||||||
src/common/datavcmn.cpp
|
src/common/datavcmn.cpp
|
||||||
|
src/generic/aboutdlgg.cpp
|
||||||
src/generic/bmpcboxg.cpp
|
src/generic/bmpcboxg.cpp
|
||||||
src/generic/calctrl.cpp
|
src/generic/calctrl.cpp
|
||||||
src/generic/datavgen.cpp
|
src/generic/datavgen.cpp
|
||||||
@@ -2639,6 +2636,8 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
wx/dataview.h
|
wx/dataview.h
|
||||||
wx/dateevt.h
|
wx/dateevt.h
|
||||||
wx/dcbuffer.h
|
wx/dcbuffer.h
|
||||||
|
wx/aboutdlg.h
|
||||||
|
wx/generic/aboutdlgg.h
|
||||||
wx/generic/bmpcbox.h
|
wx/generic/bmpcbox.h
|
||||||
wx/generic/calctrl.h
|
wx/generic/calctrl.h
|
||||||
wx/generic/datectrl.h
|
wx/generic/datectrl.h
|
||||||
@@ -2674,6 +2673,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="ADVANCED_MSW_SRC" hints="files">
|
<set var="ADVANCED_MSW_SRC" hints="files">
|
||||||
src/common/taskbarcmn.cpp
|
src/common/taskbarcmn.cpp
|
||||||
|
src/msw/aboutdlg.cpp
|
||||||
src/msw/sound.cpp
|
src/msw/sound.cpp
|
||||||
src/msw/taskbar.cpp
|
src/msw/taskbar.cpp
|
||||||
</set>
|
</set>
|
||||||
@@ -2700,6 +2700,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
|
|
||||||
<set var="ADVANCED_MAC_SRC" hints="files">
|
<set var="ADVANCED_MAC_SRC" hints="files">
|
||||||
src/common/taskbarcmn.cpp
|
src/common/taskbarcmn.cpp
|
||||||
|
src/mac/carbon/aboutdlg.cpp
|
||||||
src/mac/carbon/drawer.cpp
|
src/mac/carbon/drawer.cpp
|
||||||
src/mac/carbon/sound.cpp
|
src/mac/carbon/sound.cpp
|
||||||
src/mac/carbon/taskbar.cpp
|
src/mac/carbon/taskbar.cpp
|
||||||
|
@@ -114,6 +114,20 @@ public:
|
|||||||
bool HasTranslators() const { return !m_translators.empty(); }
|
bool HasTranslators() const { return !m_translators.empty(); }
|
||||||
const wxArrayString& GetTranslators() const { return m_translators; }
|
const wxArrayString& GetTranslators() const { return m_translators; }
|
||||||
|
|
||||||
|
|
||||||
|
// implementation only
|
||||||
|
// -------------------
|
||||||
|
|
||||||
|
// "simple" about dialog shows only textual information (with possibly
|
||||||
|
// default icon but without hyperlink nor any long texts such as the
|
||||||
|
// licence text)
|
||||||
|
bool IsSimple() const
|
||||||
|
{ return !HasWebSite() && !HasIcon() && !HasLicence(); }
|
||||||
|
|
||||||
|
// get the description and credits (i.e. all of developers, doc writers,
|
||||||
|
// artists and translators) as a one long multiline string
|
||||||
|
wxString GetDescriptionAndCredits() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString m_name,
|
wxString m_name,
|
||||||
m_version,
|
m_version,
|
||||||
|
@@ -38,9 +38,52 @@
|
|||||||
#include "wx/hyperlink.h"
|
#include "wx/hyperlink.h"
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxAboutDialog implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxAboutDialogInfo
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// helper function: returns all array elements in a single comma-separated and
|
||||||
|
// newline-terminated string
|
||||||
|
static wxString AllAsString(const wxArrayString& a)
|
||||||
|
{
|
||||||
|
wxString s;
|
||||||
|
const size_t count = a.size();
|
||||||
|
for ( size_t n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
s << a[n] << (n == count - 1 ? _T("\n") : _T(", "));
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxAboutDialogInfo::GetDescriptionAndCredits() const
|
||||||
|
{
|
||||||
|
wxString s = GetDescription();
|
||||||
|
if ( !s.empty() )
|
||||||
|
s << _T('\n');
|
||||||
|
|
||||||
|
if ( HasDevelopers() )
|
||||||
|
s << _T('\n') << _("Developed by ") << AllAsString(GetDevelopers());
|
||||||
|
|
||||||
|
if ( HasDocWriters() )
|
||||||
|
s << _T('\n') << ("Documentation by ") << AllAsString(GetDocWriters());
|
||||||
|
|
||||||
|
if ( HasArtists() )
|
||||||
|
s << _T('\n') << ("Graphics art by ") << AllAsString(GetArtists());
|
||||||
|
|
||||||
|
if ( HasTranslators() )
|
||||||
|
s << _T('\n') << ("Translations by ") << AllAsString(GetTranslators());
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxAboutDialog
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxAboutDialog::Create(const wxAboutDialogInfo& info)
|
bool wxAboutDialog::Create(const wxAboutDialogInfo& info)
|
||||||
{
|
{
|
||||||
// TODO: should we use main frame as parent by default here?
|
// TODO: should we use main frame as parent by default here?
|
||||||
@@ -131,10 +174,9 @@ void wxGenericAboutBox(const wxAboutDialogInfo& info)
|
|||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently wxAboutBox is implemented natively only under wxMSW, so we provide
|
// currently wxAboutBox is implemented natively only under these platforms, for
|
||||||
// it here for the other platforms (this is going to change when GTK+ and Mac
|
// the others we provide a generic fallback here
|
||||||
// native versions are implemented)
|
#if !defined(__WXMSW__) && !defined(__WXMAC__)
|
||||||
#ifndef __WXMSW__
|
|
||||||
|
|
||||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||||
{
|
{
|
||||||
|
87
src/mac/carbon/aboutdlg.cpp
Normal file
87
src/mac/carbon/aboutdlg.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: mac/carbon/aboutdlg.cpp
|
||||||
|
// Purpose: native wxAboutBox() implementation for wxMac
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2006-10-08
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// declarations
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#if wxUSE_ABOUTDLG
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/aboutdlg.h"
|
||||||
|
#include "wx/generic/aboutdlgg.h"
|
||||||
|
|
||||||
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
|
// helper class for HIAboutBox options
|
||||||
|
class AboutBoxOptions : public wxMacCFRefHolder<CFMutableDictionaryRef>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AboutBoxOptions() : wxMacCFRefHolder<CFMutableDictionaryRef>
|
||||||
|
(
|
||||||
|
CFDictionaryCreateMutable
|
||||||
|
(
|
||||||
|
kCFAllocatorDefault,
|
||||||
|
4, // there are at most 4 values
|
||||||
|
&kCFTypeDictionaryKeyCallBacks,
|
||||||
|
&kCFTypeDictionaryValueCallBacks
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Set(CFStringRef key, const wxString& value)
|
||||||
|
{
|
||||||
|
CFDictionarySetValue(*this, key, wxMacCFStringHolder(value));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||||
|
{
|
||||||
|
// Mac native about box currently can show only name, version, copyright
|
||||||
|
// and description fields and we also shoehorn the credits text into the
|
||||||
|
// description but if we have anything else we must use the generic version
|
||||||
|
if ( info.IsSimple() )
|
||||||
|
{
|
||||||
|
AboutBoxOptions opts;
|
||||||
|
|
||||||
|
opts.Set(kHIAboutBoxNameKey, info.GetName());
|
||||||
|
|
||||||
|
if ( info.HasVersion() )
|
||||||
|
opts.Set(kHIAboutBoxVersionKey, info.GetVersion());
|
||||||
|
|
||||||
|
if ( info.HasCopyright() )
|
||||||
|
opts.Set(kHIAboutBoxCopyrightKey, info.GetCopyright());
|
||||||
|
|
||||||
|
opts.Set(kHIAboutBoxDescriptionKey, info.GetDescriptionAndCredits());
|
||||||
|
|
||||||
|
HIAboutBox(opts);
|
||||||
|
}
|
||||||
|
else // simple "native" version is not enough
|
||||||
|
{
|
||||||
|
// we need to use the full-blown generic version
|
||||||
|
wxGenericAboutBox(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_ABOUTDLG
|
@@ -35,32 +35,13 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// helper function: returns all array elements in a single comma-separated and
|
|
||||||
// newline-terminated string
|
|
||||||
static wxString AllAsString(const wxArrayString& a)
|
|
||||||
{
|
|
||||||
wxString s;
|
|
||||||
const size_t count = a.size();
|
|
||||||
for ( size_t n = 0; n < count; n++ )
|
|
||||||
{
|
|
||||||
s << a[n] << (n == count - 1 ? _T("\n") : _T(", "));
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
// our public entry point
|
// our public entry point
|
||||||
void wxAboutBox(const wxAboutDialogInfo& info)
|
void wxAboutBox(const wxAboutDialogInfo& info)
|
||||||
{
|
{
|
||||||
// we prefer to show a simple message box if we don't have any fields which
|
// we prefer to show a simple message box if we don't have any fields which
|
||||||
// can't be shown in it because as much as there is a standard about box
|
// can't be shown in it because as much as there is a standard about box
|
||||||
// under MSW at all, this is it
|
// under MSW at all, this is it
|
||||||
if ( info.HasWebSite() || info.HasIcon() || info.HasLicence() )
|
if ( info.IsSimple() )
|
||||||
{
|
|
||||||
// we need to use the full-blown generic version
|
|
||||||
wxGenericAboutBox(info);
|
|
||||||
}
|
|
||||||
else // simple "native" version should do
|
|
||||||
{
|
{
|
||||||
// build the text to show in the box
|
// build the text to show in the box
|
||||||
const wxString name = info.GetName();
|
const wxString name = info.GetName();
|
||||||
@@ -73,22 +54,16 @@ void wxAboutBox(const wxAboutDialogInfo& info)
|
|||||||
if ( info.HasCopyright() )
|
if ( info.HasCopyright() )
|
||||||
msg << info.GetCopyright() << _T('\n');
|
msg << info.GetCopyright() << _T('\n');
|
||||||
|
|
||||||
msg << info.GetDescription() << _T('\n');
|
// add everything remaining
|
||||||
|
msg << info.GetDescriptionAndCredits();
|
||||||
if ( info.HasDevelopers() )
|
|
||||||
msg << _("Developed by ") << AllAsString(info.GetDevelopers());
|
|
||||||
|
|
||||||
if ( info.HasDocWriters() )
|
|
||||||
msg << _("Documentation by ") << AllAsString(info.GetDocWriters());
|
|
||||||
|
|
||||||
if ( info.HasArtists() )
|
|
||||||
msg << _("Graphics art by ") << AllAsString(info.GetArtists());
|
|
||||||
|
|
||||||
if ( info.HasTranslators() )
|
|
||||||
msg << _("Translations by ") << AllAsString(info.GetTranslators());
|
|
||||||
|
|
||||||
wxMessageBox(msg, _T("About ") + name);
|
wxMessageBox(msg, _T("About ") + name);
|
||||||
}
|
}
|
||||||
|
else // simple "native" version is not enough
|
||||||
|
{
|
||||||
|
// we need to use the full-blown generic version
|
||||||
|
wxGenericAboutBox(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_ABOUTDLG
|
#endif // wxUSE_ABOUTDLG
|
||||||
|
Reference in New Issue
Block a user