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