wxPython / src / _about.i

Full commit
// Name:        _about.i
// Purpose:     SWIG interface for wxAboutDialog
// Author:      Robin Dunn
// Created:     08-Oct-2006
// RCS-ID:      $Id: _about.i 63453 2010-02-09 21:54:05Z RD $
// Copyright:   (c) 2006 by Total Control Software
// Licence:     wxWindows license

// Not a %module

#include <wx/aboutdlg.h>


"`wx.AboutDialogInfo` contains information to be shown in the standard
About dialog displayed by the `wx.AboutBox` function.  This class
contains the general information about the program, such as its name,
version, copyright and so on, as well as lists of the program
developers, documentation writers, artists and translators.

While all the main platforms have a native implementation of the about
dialog, they are often more limited than the generic version provided
by wxWidgets and so the generic version is used if
`wx.AboutDialogInfo` has any fields not supported by the native
version. Currently GTK+ version supports all the possible fields
natively but MSW and Mac versions don't support URLs, licence text nor
custom icons in the about dialog and if either of those is used,
wxAboutBox() will automatically use the generic version so you should
avoid specifying these fields to achieve more native look and feel.
", "");

class wxAboutDialogInfo

        void , SetName(const wxString& name),
        "Set the name of the program. If this method is not called, the string
returned by `wx.App.GetAppName` will be shown in the dialog.", "");
        wxString , GetName() const,
        "Returns the program name.", "");
    %property(Name, GetName, SetName);

        void , SetVersion(const wxString& version,
                          const wxString& longVersion = wxEmptyString),
        "Set the version of the program. The version is in free format,
i.e. not necessarily in the x.y.z form but it shouldn't contain the
\"version\" word.", "");
        bool , HasVersion() const,
        "Returns ``True`` if the version property has been set.", "");
        wxString , GetVersion() const,
        "Returns the version value.", "");
    %property(Version, GetVersion, SetVersion);

        wxString , GetLongVersion() const,
        "", "");
    %property(LongVersion, GetLongVersion);

        void , SetDescription(const wxString& desc),
        "Set brief, but possibly multiline, description of the program.", "");
        bool , HasDescription() const,
        "Returns ``True`` if the description property has been set.", "");
        wxString , GetDescription() const,
        "Returns the description value.", "");
    %property(Description, GetDescription, SetDescription);

        void , SetCopyright(const wxString& copyright),
        "Set the short string containing the program copyright
information. Notice that any occurrences of \"(C)\" in ``copyright``
will be replaced by the copyright symbol (circled C) automatically,
which means that you can avoid using this symbol in the program source
code which can be problematic.", "");
        bool , HasCopyright() const,
        "Returns ``True`` if the copyright property has been set.", "");
        wxString , GetCopyright() const,
        "Returns the copyright value.", "");
    %property(Copyright, GetCopyright, SetCopyright);

        void , SetLicence(const wxString& licence),
        "Set the long, multiline string containing the text of the program

Only GTK+ version supports showing the licence text in the native
about dialog currently so the generic version will be used under all
the other platforms if this method is called. To preserve the native
look and feel it is advised that you do not call this method but
provide a separate menu item in the \"Help\" menu for displaying the
text of your program licence.
", "");
        void , SetLicense(const wxString& licence),
        "This is the same as `SetLicence`.", "");
        bool , HasLicence() const,
        "Returns ``True`` if the licence property has been set.", "");
        wxString , GetLicence() const,
        "Returns the licence value.", "");
    %property(Licence, GetLicence, SetLicence);
    %pythoncode { License = Licence }

        void , SetIcon(const wxIcon& icon),
        "Set the icon to be shown in the dialog. By default the icon of the
main frame will be shown if the native about dialog supports custom
icons. If it doesn't but a valid icon is specified using this method,
the generic about dialog is used instead so you should avoid calling
this function for maximally native look and feel.", "");
        bool , HasIcon() const,
        "Returns ``True`` if the icon property has been set.", "");
        wxIcon , GetIcon() const,
        "Return the current icon value.", "");
    %property(Icon, GetIcon, SetIcon);    

    // web site for the program and its description (defaults to URL itself if
    // empty)
            void , SetWebSite(const wxString& url, const wxString& desc = wxEmptyString));
            wxString , GetWebSiteURL() const);
            wxString , GetWebSiteDescription() const);
    bool HasWebSite() const;

    %pythoncode {
        def SetWebSite(self, args):
            SetWebSite(self, URL, [Description])

            Set the web site property.  The ``args`` parameter can
            either be a single string for the URL, to a 2-tuple of
            (URL, Description) strings.
            if type(args) in [str, unicode]:
                self._SetWebSite(args[0], args[1])
        def GetWebSite(self):
            GetWebSite(self) --> (URL, Description)
            return (self._GetWebSiteURL(), self._GetWebSiteDescription())
    %property(WebSite, GetWebSite, SetWebSite)

        void , SetDevelopers(const wxArrayString& developers),
        "SetDevelopers(self, list developers)",
        "Set the list of the developers of the program.", "");
        void , AddDeveloper(const wxString& developer),
        "Add a string to the list of developers.", "");
        bool , HasDevelopers() const,
        "Returns ``True if any developers have been set.", "");
        const wxArrayString& , GetDevelopers() const,
        "GetDevelopers(self) --> list",
        "Returns the list of developers.", "");
    %property(Developers, GetDevelopers, SetDevelopers);

        void , SetDocWriters(const wxArrayString& docwriters),
        "SetDocWriters(self, list docwriters)",
        "Set the list of the documentation writers.", "");
        void , AddDocWriter(const wxString& docwriter),
        "Add a string to the list of documentation writers.", "");
        bool , HasDocWriters() const,
        "Returns ``True if any documentation writers have been set.", "");
        const wxArrayString& , GetDocWriters() const,
        "GetDocWriters(self) --> list",
        "Returns the list of documentation writers.", "");

    %property(DocWriters, GetDocWriters, SetDocWriters);

        void , SetArtists(const wxArrayString& artists),
        "SetArtists(self, list artists)", 
        "Set the list of artists for the program.", "");
        void , AddArtist(const wxString& artist),
        "Add a string to the list of artists.", "");
        bool , HasArtists() const,
        "Returns ``True`` if any artists have been set.", "");
        const wxArrayString& , GetArtists() const,
        "GetArtists(self) --> list",
        "Returns the list od artists.", "");
    %property(Artists, GetArtists, SetArtists);

        void , SetTranslators(const wxArrayString& translators),
        "SetTranslators(self, list translators)",
        "Sets the list of program translators.", "");
        void , AddTranslator(const wxString& translator),
        "Add a string to the list of translators.", "");
        bool , HasTranslators() const,
        "Returns ``True`` if any translators have been set.", "");
        const wxArrayString& , GetTranslators() const,
        "GetTranslators(self) --> list",
        "Returns the list of program translators.", "");
    %property(Translators, GetTranslators, SetTranslators);

    // 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;

    // get the description and credits (i.e. all of developers, doc writers,
    // artists and translators) as a one long multiline string
    wxString GetDescriptionAndCredits() const;

    // returns the copyright with the (C) string substituted by the Unicode
    // character U+00A9
    wxString GetCopyrightToDisplay() const;


       "This function shows the standard about dialog containing the
information specified in ``info``. If the current platform has a
native about dialog which is capable of showing all the fields in
`wx.AboutDialogInfo`, the native dialog is used, otherwise the
function falls back to the generic wxWidgets version of the dialog.", "");

void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);