Allow setting long version field in About dialog.
[wxWidgets.git] / include / wx / aboutdlg.h
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$
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
29 wxAboutDialogInfo() { }
30
31 // accessors for various simply fields
32 // -----------------------------------
33
34 // name of the program, if not used defaults to wxApp::GetAppDisplayName()
35 void SetName(const wxString& name) { m_name = name; }
36 wxString GetName() const
37 { return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
38
39 // version should contain program version without "version" word (e.g.,
40 // "1.2" or "RC2") while longVersion may contain the full version including
41 // "version" word (e.g., "Version 1.2" or "Release Candidate 2")
42 //
43 // if longVersion is empty, it is automatically constructed from version
44 //
45 // generic and gtk native: use short version only, as a suffix to the
46 // program name msw and osx native: use long version
47 void SetVersion(const wxString& version,
48 const wxString& longVersion = wxString());
49
50 bool HasVersion() const { return !m_version.empty(); }
51 const wxString& GetVersion() const { return m_version; }
52 const wxString& GetLongVersion() const { return m_longVersion; }
53
54 // brief, but possibly multiline, description of the program
55 void SetDescription(const wxString& desc) { m_description = desc; }
56 bool HasDescription() const { return !m_description.empty(); }
57 const wxString& GetDescription() const { return m_description; }
58
59 // short string containing the program copyright information
60 void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
61 bool HasCopyright() const { return !m_copyright.empty(); }
62 const wxString& GetCopyright() const { return m_copyright; }
63
64 // long, multiline string containing the text of the program licence
65 void SetLicence(const wxString& licence) { m_licence = licence; }
66 void SetLicense(const wxString& licence) { m_licence = licence; }
67 bool HasLicence() const { return !m_licence.empty(); }
68 const wxString& GetLicence() const { return m_licence; }
69
70 // icon to be shown in the dialog, defaults to the main frame icon
71 void SetIcon(const wxIcon& icon) { m_icon = icon; }
72 bool HasIcon() const { return m_icon.Ok(); }
73 wxIcon GetIcon() const;
74
75 // web site for the program and its description (defaults to URL itself if
76 // empty)
77 void SetWebSite(const wxString& url, const wxString& desc = wxEmptyString)
78 {
79 m_url = url;
80 m_urlDesc = desc.empty() ? url : desc;
81 }
82
83 bool HasWebSite() const { return !m_url.empty(); }
84
85 const wxString& GetWebSiteURL() const { return m_url; }
86 const wxString& GetWebSiteDescription() const { return m_urlDesc; }
87
88 // accessors for the arrays
89 // ------------------------
90
91 // the list of developers of the program
92 void SetDevelopers(const wxArrayString& developers)
93 { m_developers = developers; }
94 void AddDeveloper(const wxString& developer)
95 { m_developers.push_back(developer); }
96
97 bool HasDevelopers() const { return !m_developers.empty(); }
98 const wxArrayString& GetDevelopers() const { return m_developers; }
99
100 // the list of documentation writers
101 void SetDocWriters(const wxArrayString& docwriters)
102 { m_docwriters = docwriters; }
103 void AddDocWriter(const wxString& docwriter)
104 { m_docwriters.push_back(docwriter); }
105
106 bool HasDocWriters() const { return !m_docwriters.empty(); }
107 const wxArrayString& GetDocWriters() const { return m_docwriters; }
108
109 // the list of artists for the program art
110 void SetArtists(const wxArrayString& artists)
111 { m_artists = artists; }
112 void AddArtist(const wxString& artist)
113 { m_artists.push_back(artist); }
114
115 bool HasArtists() const { return !m_artists.empty(); }
116 const wxArrayString& GetArtists() const { return m_artists; }
117
118 // the list of translators
119 void SetTranslators(const wxArrayString& translators)
120 { m_translators = translators; }
121 void AddTranslator(const wxString& translator)
122 { m_translators.push_back(translator); }
123
124 bool HasTranslators() const { return !m_translators.empty(); }
125 const wxArrayString& GetTranslators() const { return m_translators; }
126
127
128 // implementation only
129 // -------------------
130
131 // "simple" about dialog shows only textual information (with possibly
132 // default icon but without hyperlink nor any long texts such as the
133 // licence text)
134 bool IsSimple() const
135 { return !HasWebSite() && !HasIcon() && !HasLicence(); }
136
137 // get the description and credits (i.e. all of developers, doc writers,
138 // artists and translators) as a one long multiline string
139 wxString GetDescriptionAndCredits() const;
140
141 // returns the copyright with the (C) string substituted by the Unicode
142 // character U+00A9
143 wxString GetCopyrightToDisplay() const;
144
145 private:
146 wxString m_name,
147 m_version,
148 m_longVersion,
149 m_description,
150 m_copyright,
151 m_licence;
152
153 wxIcon m_icon;
154
155 wxString m_url,
156 m_urlDesc;
157
158 wxArrayString m_developers,
159 m_docwriters,
160 m_artists,
161 m_translators;
162 };
163
164 // functions to show the about dialog box
165 WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);
166
167 #endif // wxUSE_ABOUTDLG
168
169 #endif // _WX_ABOUTDLG_H_
170