1 /////////////////////////////////////////////////////////////////////////////// 2 // Name: wx/aboutdlg.h 3 // Purpose: declaration of wxAboutDialog class 4 // Author: Vadim Zeitlin 5 // Created: 2006-10-07 6 // RCS-ID: $Id: aboutdlg.h 58748 2009-02-08 09:46:03Z VZ $ 7 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org> 8 // Licence: wxWindows licence 9 /////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef _WX_ABOUTDLG_H_ 12 #define _WX_ABOUTDLG_H_ 13 14 #include "wx/defs.h" 15 16 #if wxUSE_ABOUTDLG 17 18 #include "wx/app.h" 19 #include "wx/icon.h" 20 21 // ---------------------------------------------------------------------------- 22 // wxAboutDialogInfo: information shown by the standard "About" dialog 23 // ---------------------------------------------------------------------------- 24 25 class WXDLLIMPEXP_ADV wxAboutDialogInfo 26 { 27 public: 28 // all fields are initially uninitialized wxAboutDialogInfo()29 wxAboutDialogInfo() { } 30 31 // accessors for various simply fields 32 // ----------------------------------- 33 34 // name of the program, if not used defaults wxApp::GetAppName() SetName(const wxString & name)35 void SetName(const wxString& name) { m_name = name; } GetName()36 wxString GetName() const 37 { return m_name.empty() ? wxTheApp->GetAppName() : m_name; } 38 39 // version of the program, in free format (but without "version" word) SetVersion(const wxString & version)40 void SetVersion(const wxString& version) { m_version = version; } HasVersion()41 bool HasVersion() const { return !m_version.empty(); } GetVersion()42 wxString GetVersion() const { return m_version; } 43 44 // brief, but possibly multiline, description of the program SetDescription(const wxString & desc)45 void SetDescription(const wxString& desc) { m_description = desc; } HasDescription()46 bool HasDescription() const { return !m_description.empty(); } GetDescription()47 wxString GetDescription() const { return m_description; } 48 49 // short string containing the program copyright information SetCopyright(const wxString & copyright)50 void SetCopyright(const wxString& copyright) { m_copyright = copyright; } HasCopyright()51 bool HasCopyright() const { return !m_copyright.empty(); } GetCopyright()52 wxString GetCopyright() const { return m_copyright; } 53 54 // long, multiline string containing the text of the program licence SetLicence(const wxString & licence)55 void SetLicence(const wxString& licence) { m_licence = licence; } SetLicense(const wxString & licence)56 void SetLicense(const wxString& licence) { m_licence = licence; } HasLicence()57 bool HasLicence() const { return !m_licence.empty(); } GetLicence()58 wxString GetLicence() const { return m_licence; } 59 60 // icon to be shown in the dialog, defaults to the main frame icon SetIcon(const wxIcon & icon)61 void SetIcon(const wxIcon& icon) { m_icon = icon; } HasIcon()62 bool HasIcon() const { return m_icon.Ok(); } 63 wxIcon GetIcon() const; 64 65 // web site for the program and its description (defaults to URL itself if 66 // empty) 67 void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString) 68 { 69 m_url = url; 70 m_urlDesc = desc.empty() ? url : desc; 71 } 72 HasWebSite()73 bool HasWebSite() const { return !m_url.empty(); } 74 GetWebSiteURL()75 wxString GetWebSiteURL() const { return m_url; } GetWebSiteDescription()76 wxString GetWebSiteDescription() const { return m_urlDesc; } 77 78 // accessors for the arrays 79 // ------------------------ 80 81 // the list of developers of the program SetDevelopers(const wxArrayString & developers)82 void SetDevelopers(const wxArrayString& developers) 83 { m_developers = developers; } AddDeveloper(const wxString & developer)84 void AddDeveloper(const wxString& developer) 85 { m_developers.push_back(developer); } 86 HasDevelopers()87 bool HasDevelopers() const { return !m_developers.empty(); } GetDevelopers()88 const wxArrayString& GetDevelopers() const { return m_developers; } 89 90 // the list of documentation writers SetDocWriters(const wxArrayString & docwriters)91 void SetDocWriters(const wxArrayString& docwriters) 92 { m_docwriters = docwriters; } AddDocWriter(const wxString & docwriter)93 void AddDocWriter(const wxString& docwriter) 94 { m_docwriters.push_back(docwriter); } 95 HasDocWriters()96 bool HasDocWriters() const { return !m_docwriters.empty(); } GetDocWriters()97 const wxArrayString& GetDocWriters() const { return m_docwriters; } 98 99 // the list of artists for the program art SetArtists(const wxArrayString & artists)100 void SetArtists(const wxArrayString& artists) 101 { m_artists = artists; } AddArtist(const wxString & artist)102 void AddArtist(const wxString& artist) 103 { m_artists.push_back(artist); } 104 HasArtists()105 bool HasArtists() const { return !m_artists.empty(); } GetArtists()106 const wxArrayString& GetArtists() const { return m_artists; } 107 108 // the list of translators SetTranslators(const wxArrayString & translators)109 void SetTranslators(const wxArrayString& translators) 110 { m_translators = translators; } AddTranslator(const wxString & translator)111 void AddTranslator(const wxString& translator) 112 { m_translators.push_back(translator); } 113 HasTranslators()114 bool HasTranslators() const { return !m_translators.empty(); } GetTranslators()115 const wxArrayString& GetTranslators() const { return m_translators; } 116 117 118 // implementation only 119 // ------------------- 120 121 // "simple" about dialog shows only textual information (with possibly 122 // default icon but without hyperlink nor any long texts such as the 123 // licence text) IsSimple()124 bool IsSimple() const 125 { return !HasWebSite() && !HasIcon() && !HasLicence(); } 126 127 // get the description and credits (i.e. all of developers, doc writers, 128 // artists and translators) as a one long multiline string 129 wxString GetDescriptionAndCredits() const; 130 131 #if wxABI_VERSION >= 20810 132 // returns the copyright with the (C) string substituted by the Unicode 133 // character U+00A9 134 wxString GetCopyrightToDisplay() const; 135 #endif // wx 2.8.10+ 136 137 private: 138 wxString m_name, 139 m_version, 140 m_description, 141 m_copyright, 142 m_licence; 143 144 wxIcon m_icon; 145 146 wxString m_url, 147 m_urlDesc; 148 149 wxArrayString m_developers, 150 m_docwriters, 151 m_artists, 152 m_translators; 153 }; 154 155 // functions to show the about dialog box 156 WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info); 157 158 #endif // wxUSE_ABOUTDLG 159 160 #endif // _WX_ABOUTDLG_H_ 161 162