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