changed trivial accessors to return const wxString& instead of wxString object
[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 wxApp::GetAppName()
35 void SetName(const wxString& name) { m_name = name; }
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)
40 void SetVersion(const wxString& version) { m_version = version; }
41 bool HasVersion() const { return !m_version.empty(); }
42 const wxString& GetVersion() const { return m_version; }
43
44 // brief, but possibly multiline, description of the program
45 void SetDescription(const wxString& desc) { m_description = desc; }
46 bool HasDescription() const { return !m_description.empty(); }
47 const wxString& GetDescription() const { return m_description; }
48
49 // short string containing the program copyright information
50 void SetCopyright(const wxString& copyright) { m_copyright = copyright; }
51 bool HasCopyright() const { return !m_copyright.empty(); }
52 const wxString& GetCopyright() const { return m_copyright; }
53
54 // long, multiline string containing the text of the program licence
55 void SetLicence(const wxString& licence) { m_licence = licence; }
56 void SetLicense(const wxString& licence) { m_licence = licence; }
57 bool HasLicence() const { return !m_licence.empty(); }
58 const wxString& GetLicence() const { return m_licence; }
59
60 // icon to be shown in the dialog, defaults to the main frame icon
61 void SetIcon(const wxIcon& icon) { m_icon = icon; }
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
73 bool HasWebSite() const { return !m_url.empty(); }
74
75 const wxString& GetWebSiteURL() const { return m_url; }
76 const wxString& GetWebSiteDescription() const { return m_urlDesc; }
77
78 // accessors for the arrays
79 // ------------------------
80
81 // the list of developers of the program
82 void SetDevelopers(const wxArrayString& developers)
83 { m_developers = developers; }
84 void AddDeveloper(const wxString& developer)
85 { m_developers.push_back(developer); }
86
87 bool HasDevelopers() const { return !m_developers.empty(); }
88 const wxArrayString& GetDevelopers() const { return m_developers; }
89
90 // the list of documentation writers
91 void SetDocWriters(const wxArrayString& docwriters)
92 { m_docwriters = docwriters; }
93 void AddDocWriter(const wxString& docwriter)
94 { m_docwriters.push_back(docwriter); }
95
96 bool HasDocWriters() const { return !m_docwriters.empty(); }
97 const wxArrayString& GetDocWriters() const { return m_docwriters; }
98
99 // the list of artists for the program art
100 void SetArtists(const wxArrayString& artists)
101 { m_artists = artists; }
102 void AddArtist(const wxString& artist)
103 { m_artists.push_back(artist); }
104
105 bool HasArtists() const { return !m_artists.empty(); }
106 const wxArrayString& GetArtists() const { return m_artists; }
107
108 // the list of translators
109 void SetTranslators(const wxArrayString& translators)
110 { m_translators = translators; }
111 void AddTranslator(const wxString& translator)
112 { m_translators.push_back(translator); }
113
114 bool HasTranslators() const { return !m_translators.empty(); }
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)
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 private:
132 wxString m_name,
133 m_version,
134 m_description,
135 m_copyright,
136 m_licence;
137
138 wxIcon m_icon;
139
140 wxString m_url,
141 m_urlDesc;
142
143 wxArrayString m_developers,
144 m_docwriters,
145 m_artists,
146 m_translators;
147 };
148
149 // functions to show the about dialog box
150 WXDLLIMPEXP_ADV void wxAboutBox(const wxAboutDialogInfo& info);
151
152 #endif // wxUSE_ABOUTDLG
153
154 #endif // _WX_ABOUTDLG_H_
155