]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: aboutdlg.h | |
463b4bfa | 3 | // Purpose: interface of wxAboutDialogInfo |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxAboutDialogInfo | |
7c913512 | 11 | |
23324ae1 | 12 | wxAboutDialogInfo contains information shown in the standard @e About |
3a65144e | 13 | dialog displayed by the wxAboutBox() function. |
7c913512 | 14 | |
23324ae1 FM |
15 | This class contains the general information about the program, such as its |
16 | name, version, copyright and so on, as well as lists of the program developers, | |
17 | documentation writers, artists and translators. The simple properties from the | |
18 | former group are represented as a string with the exception of the program icon | |
7c913512 | 19 | and the program web site, while the lists from the latter group are stored as |
463b4bfa FM |
20 | wxArrayString and can be either set entirely at once using |
21 | wxAboutDialogInfo::SetDevelopers and similar functions or built one by one using | |
22 | wxAboutDialogInfo::AddDeveloper etc. | |
7c913512 | 23 | |
23324ae1 FM |
24 | Please also notice that while all the main platforms have the native |
25 | implementation of the about dialog, they are often more limited than the | |
26 | generic version provided by wxWidgets and so the generic version is used if | |
27 | wxAboutDialogInfo has any fields not supported by the native version. Currently | |
28 | GTK+ version supports all the possible fields natively but MSW and Mac versions | |
29 | don't support URLs, licence text nor custom icons in the about dialog and if | |
3a65144e FM |
30 | either of those is used, wxAboutBox() will automatically use the generic version |
31 | so you should avoid specifying these fields to achieve more native look and feel. | |
7cfac8c8 FM |
32 | |
33 | Example of usage: | |
34 | @code | |
35 | void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) | |
36 | { | |
37 | wxAboutDialogInfo aboutInfo; | |
38 | aboutInfo.SetName("MyApp"); | |
39 | aboutInfo.SetVersion(MY_APP_VERSION_STRING); | |
40 | aboutInfo.SetDescription(_("My wxWidgets-based application!")); | |
41 | aboutInfo.SetCopyright("(C) 1992-2010"); | |
42 | aboutInfo.SetWebSite("http://myapp.org"); | |
43 | aboutInfo.AddDeveloper("My Self"); | |
44 | ||
45 | wxAboutBox(aboutInfo); | |
46 | } | |
47 | @endcode | |
7c913512 | 48 | |
23324ae1 | 49 | @library{wxadv} |
3c99e2fd | 50 | @category{cmndlg,data} |
7c913512 | 51 | |
3a65144e | 52 | @see wxAboutDialogInfo::SetArtists |
23324ae1 | 53 | */ |
7c913512 | 54 | class wxAboutDialogInfo |
23324ae1 FM |
55 | { |
56 | public: | |
57 | /** | |
58 | Default constructor leaves all fields are initially uninitialized, in general | |
463b4bfa | 59 | you should call at least SetVersion(), SetCopyright() and SetDescription(). |
23324ae1 FM |
60 | */ |
61 | wxAboutDialogInfo(); | |
62 | ||
63 | /** | |
64 | Adds an artist name to be shown in the program credits. | |
3c4f71cc | 65 | |
4cc4bfaf | 66 | @see SetArtists() |
23324ae1 FM |
67 | */ |
68 | void AddArtist(const wxString& artist); | |
69 | ||
70 | /** | |
71 | Adds a developer name to be shown in the program credits. | |
3c4f71cc | 72 | |
4cc4bfaf | 73 | @see SetDevelopers() |
23324ae1 FM |
74 | */ |
75 | void AddDeveloper(const wxString& developer); | |
76 | ||
77 | /** | |
78 | Adds a documentation writer name to be shown in the program credits. | |
3c4f71cc | 79 | |
4cc4bfaf | 80 | @see SetDocWriters() |
23324ae1 FM |
81 | */ |
82 | void AddDocWriter(const wxString& docwriter); | |
83 | ||
84 | /** | |
85 | Adds a translator name to be shown in the program credits. Notice that if no | |
57ab6f23 | 86 | translator names are specified explicitly, wxAboutBox() will try to use the |
463b4bfa FM |
87 | translation of the string @c translator-credits from the currently used message |
88 | catalog -- this can be used to show just the name of the translator of the | |
89 | program in the current language. | |
3c4f71cc | 90 | |
4cc4bfaf | 91 | @see SetTranslators() |
23324ae1 FM |
92 | */ |
93 | void AddTranslator(const wxString& translator); | |
94 | ||
5b70f2de VZ |
95 | /** |
96 | Get the name of the program. | |
97 | ||
98 | @return Name of the program | |
99 | @see SetName() | |
100 | */ | |
9d384299 | 101 | wxString GetName() const; |
5b70f2de VZ |
102 | |
103 | /** | |
104 | Returns @true if a description string has been specified. | |
105 | ||
106 | @see GetDescription() | |
107 | */ | |
108 | bool HasDescription() const; | |
109 | ||
110 | /** | |
111 | Get the description string. | |
112 | ||
113 | @return The description string, free-form. | |
114 | */ | |
115 | const wxString& GetDescription(); | |
116 | ||
117 | /** | |
118 | Returns @true if a copyright string has been specified. | |
119 | ||
120 | @see GetCopyright() | |
121 | */ | |
122 | bool HasCopyright() const; | |
123 | ||
124 | /** | |
125 | Get the copyright string. | |
126 | ||
127 | @return The copyright string | |
128 | */ | |
129 | const wxString& GetCopyright() const; | |
130 | ||
23324ae1 | 131 | /** |
57ab6f23 | 132 | Sets the list of artists to be shown in the program credits. |
3c4f71cc | 133 | |
4cc4bfaf | 134 | @see AddArtist() |
23324ae1 FM |
135 | */ |
136 | void SetArtists(const wxArrayString& artists); | |
137 | ||
138 | /** | |
4cc4bfaf FM |
139 | Set the short string containing the program copyright information. Notice that |
140 | any occurrences of @c "(C)" in @a copyright will be replaced by the | |
23324ae1 FM |
141 | copyright symbol (circled C) automatically, which means that you can avoid |
142 | using this symbol in the program source code which can be problematic, | |
143 | */ | |
144 | void SetCopyright(const wxString& copyright); | |
145 | ||
146 | /** | |
147 | Set brief, but possibly multiline, description of the program. | |
148 | */ | |
149 | void SetDescription(const wxString& desc); | |
150 | ||
151 | /** | |
152 | Set the list of developers of the program. | |
3c4f71cc | 153 | |
4cc4bfaf | 154 | @see AddDeveloper() |
23324ae1 FM |
155 | */ |
156 | void SetDevelopers(const wxArrayString& developers); | |
157 | ||
158 | /** | |
159 | Set the list of documentation writers. | |
3c4f71cc | 160 | |
4cc4bfaf | 161 | @see AddDocWriter() |
23324ae1 FM |
162 | */ |
163 | void SetDocWriters(const wxArrayString& docwriters); | |
164 | ||
165 | /** | |
166 | Set the icon to be shown in the dialog. By default the icon of the main frame | |
167 | will be shown if the native about dialog supports custom icons. If it doesn't | |
168 | but a valid icon is specified using this method, the generic about dialog is | |
169 | used instead so you should avoid calling this function for maximally native | |
170 | look and feel. | |
171 | */ | |
172 | void SetIcon(const wxIcon& icon); | |
173 | ||
174 | /** | |
175 | Set the long, multiline string containing the text of the program licence. | |
463b4bfa | 176 | |
23324ae1 FM |
177 | Only GTK+ version supports showing the licence text in the native about dialog |
178 | currently so the generic version will be used under all the other platforms if | |
179 | this method is called. To preserve the native look and feel it is advised that | |
7c913512 | 180 | you do not call this method but provide a separate menu item in the |
23324ae1 FM |
181 | @c "Help" menu for displaying the text of your program licence. |
182 | */ | |
183 | void SetLicence(const wxString& licence); | |
184 | ||
185 | /** | |
186 | This is the same as SetLicence(). | |
187 | */ | |
188 | void SetLicense(const wxString& licence); | |
189 | ||
190 | /** | |
191 | Set the name of the program. If this method is not called, the string returned | |
192 | by wxApp::GetAppName will be shown in the dialog. | |
193 | */ | |
194 | void SetName(const wxString& name); | |
195 | ||
196 | /** | |
463b4bfa | 197 | Set the list of translators. Please see AddTranslator() for additional |
23324ae1 FM |
198 | discussion. |
199 | */ | |
200 | void SetTranslators(const wxArrayString& translators); | |
201 | ||
202 | /** | |
704006b3 VZ |
203 | Set the version of the program. The word "version" shouldn't be included |
204 | in @a version. Example @a version values: "1.2" and "RC2". In about dialogs | |
205 | with more space set aside for version information, @a longVersion is used. | |
206 | Example @a longVersion values: "Version 1.2" and "Release Candidate 2". | |
207 | If @a version is non-empty but @a longVersion is empty, a long version | |
208 | is constructed automatically, using @a version (by simply prepending | |
209 | "Version " to @a version). | |
210 | ||
211 | The generic about dialog and native GTK+ dialog use @a version only, | |
212 | as a suffix to the program name. The native MSW and OS X about dialogs | |
213 | use the long version. | |
214 | */ | |
215 | void SetVersion(const wxString& version, const wxString& longVersion = wxString()); | |
23324ae1 FM |
216 | |
217 | /** | |
463b4bfa | 218 | Set the web site for the program and its description (which defaults to @a url |
23324ae1 | 219 | itself if empty). |
463b4bfa | 220 | |
23324ae1 FM |
221 | Please notice that only GTK+ version currently supports showing the link in the |
222 | native about dialog so if this method is called, the generic version will be | |
223 | used under all the other platforms. | |
224 | */ | |
225 | void SetWebSite(const wxString& url, | |
226 | const wxString& desc = wxEmptyString); | |
227 | }; | |
228 | ||
229 | ||
230 | // ============================================================================ | |
231 | // Global functions/macros | |
232 | // ============================================================================ | |
233 | ||
b21126db | 234 | /** @addtogroup group_funcmacro_dialog */ |
39fb8056 FM |
235 | //@{ |
236 | ||
23324ae1 FM |
237 | /** |
238 | This function shows the standard about dialog containing the information | |
463b4bfa FM |
239 | specified in @a info. If the current platform has a native about dialog |
240 | which is capable of showing all the fields in @a info, the native dialog is | |
241 | used, otherwise the function falls back to the generic wxWidgets version of | |
242 | the dialog, i.e. does the same thing as wxGenericAboutBox. | |
243 | ||
23324ae1 | 244 | Here is an example of how this function may be used: |
7c913512 | 245 | |
23324ae1 FM |
246 | @code |
247 | void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event)) | |
248 | { | |
249 | wxAboutDialogInfo info; | |
250 | info.SetName(_("My Program")); | |
251 | info.SetVersion(_("1.2.3 Beta")); | |
252 | info.SetDescription(_("This program does something great.")); | |
9a83f860 | 253 | info.SetCopyright(wxT("(C) 2007 Me <my@email.addre.ss>")); |
7c913512 | 254 | |
23324ae1 FM |
255 | wxAboutBox(info); |
256 | } | |
257 | @endcode | |
7c913512 | 258 | |
e4f1d811 FM |
259 | Please see the @ref page_samples_dialogs for more examples of using this |
260 | function and wxAboutDialogInfo for the description of the information which | |
261 | can be shown in the about dialog. | |
ba2874ff BP |
262 | |
263 | @header{wx/aboutdlg.h} | |
23324ae1 | 264 | */ |
c173e541 | 265 | void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); |
23324ae1 FM |
266 | |
267 | /** | |
3a65144e | 268 | This function does the same thing as wxAboutBox() except that it always uses |
463b4bfa FM |
269 | the generic wxWidgets version of the dialog instead of the native one. |
270 | ||
271 | This is mainly useful if you need to customize the dialog by e.g. adding | |
272 | custom controls to it (customizing the native dialog is not currently | |
23324ae1 | 273 | supported). |
463b4bfa | 274 | |
e4f1d811 | 275 | See the @ref page_samples_dialogs for an example of about dialog |
4cc4bfaf | 276 | customization. |
7c913512 | 277 | |
4cc4bfaf | 278 | @see wxAboutDialogInfo |
ba2874ff BP |
279 | |
280 | @header{wx/aboutdlg.h} | |
23324ae1 | 281 | */ |
c173e541 | 282 | void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL); |
23324ae1 | 283 | |
39fb8056 | 284 | //@} |