File: aboutdlg.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (377 lines) | stat: -rw-r--r-- 11,871 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
/////////////////////////////////////////////////////////////////////////////
// Name:        aboutdlg.h
// Purpose:     interface of wxAboutDialogInfo
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxAboutDialogInfo

    wxAboutDialogInfo contains information shown in the standard @e About
    dialog displayed by the wxAboutBox() function.

    This class contains the general information about the program, such as its
    name, version, copyright and so on, as well as lists of the program developers,
    documentation writers, artists and translators. The simple properties from the
    former group are represented as a string with the exception of the program icon
    and the program web site, while the lists from the latter group are stored as
    wxArrayString and can be either set entirely at once using
    wxAboutDialogInfo::SetDevelopers and similar functions or built one by one using
    wxAboutDialogInfo::AddDeveloper etc.

    Please also notice that while all the main platforms have the native
    implementation of the about dialog, they are often more limited than the
    generic version provided by wxWidgets and so the generic version is used if
    wxAboutDialogInfo has any fields not supported by the native version. Currently
    GTK+ version supports all the possible fields natively but MSW and Mac versions
    don't support URLs, licence text nor custom icons in the about dialog and if
    either of those is used, wxAboutBox() will automatically use the generic version
    so you should avoid specifying these fields to achieve more native look and feel.
    
    Example of usage:
    @code
    void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
    {
        wxAboutDialogInfo aboutInfo;
        aboutInfo.SetName("MyApp");
        aboutInfo.SetVersion(MY_APP_VERSION_STRING);
        aboutInfo.SetDescription(_("My wxWidgets-based application!"));
        aboutInfo.SetCopyright("(C) 1992-2010");
        aboutInfo.SetWebSite("http://myapp.org");
        aboutInfo.AddDeveloper("My Self");

        wxAboutBox(aboutInfo);
    }
    @endcode

    @library{wxadv}
    @category{cmndlg,data}

    @see wxAboutDialogInfo::SetArtists
*/
class wxAboutDialogInfo
{
public:
    /**
        Default constructor leaves all fields are initially uninitialized, in general
        you should call at least SetVersion(), SetCopyright() and SetDescription().
    */
    wxAboutDialogInfo();

    /**
        Adds an artist name to be shown in the program credits.

        @see SetArtists()
    */
    void AddArtist(const wxString& artist);

    /**
        Adds a developer name to be shown in the program credits.

        @see SetDevelopers()
    */
    void AddDeveloper(const wxString& developer);

    /**
        Adds a documentation writer name to be shown in the program credits.

        @see SetDocWriters()
    */
    void AddDocWriter(const wxString& docwriter);

    /**
        Adds a translator name to be shown in the program credits. Notice that if no
        translator names are specified explicitly, wxAboutBox() will try to use the
        translation of the string @c translator-credits from the currently used message
        catalog -- this can be used to show just the name of the translator of the
        program in the current language.

        @see SetTranslators()
    */
    void AddTranslator(const wxString& translator);

    /**
        Get the name of the program.

        @return Name of the program
        @see SetName()
    */
    wxString GetName() const;

    /**
        Returns @true if a description string has been specified.

        @see GetDescription()
    */
    bool HasDescription() const;

    /**
        Get the description string.

        @return The description string, free-form.
    */
    const wxString& GetDescription();

    /**
        Returns @true if a copyright string has been specified.

        @see GetCopyright()
    */
    bool HasCopyright() const;

    /**
        Get the copyright string.

        @return The copyright string
    */
    const wxString& GetCopyright() const;

    /**
        Sets the list of artists to be shown in the program credits.

        @see AddArtist()
    */
    void SetArtists(const wxArrayString& artists);

    /**
        Set the short string containing the program copyright information. Notice that
        any occurrences of @c "(C)" in @a copyright will be replaced by the
        copyright symbol (circled C) automatically, which means that you can avoid
        using this symbol in the program source code which can be problematic,
    */
    void SetCopyright(const wxString& copyright);

    /**
        Set brief, but possibly multiline, description of the program.
    */
    void SetDescription(const wxString& desc);

    /**
        Set the list of developers of the program.

        @see AddDeveloper()
    */
    void SetDevelopers(const wxArrayString& developers);

    /**
        Set the list of documentation writers.

        @see AddDocWriter()
    */
    void SetDocWriters(const wxArrayString& docwriters);

    /**
       Returns @true if an icon has been set for the about dialog.
    */
    bool HasIcon() const;

    /**
       Returns the icon set by SetIcon().
    */
    wxIcon GetIcon() const;
    
    /**
        Set the icon to be shown in the dialog. By default the icon of the main frame
        will be shown if the native about dialog supports custom icons. If it doesn't
        but a valid icon is specified using this method, the generic about dialog is
        used instead so you should avoid calling this function for maximally native
        look and feel.
    */
    void SetIcon(const wxIcon& icon);

    /**
       Returns @true if the licence string has been set.
    */
    bool HasLicence() const;

    /**
       Returns the licence string.

       @see SetLicence()
    */
    const wxString& GetLicence() const;

    /**
        Set the long, multiline string containing the text of the program licence.

        Only GTK+ version supports showing the licence text in the native about dialog
        currently so the generic version will be used under all the other platforms if
        this method is called. To preserve the native look and feel it is advised that
        you do not call this method but provide a separate menu item in the
        @c "Help" menu for displaying the text of your program licence.
    */
    void SetLicence(const wxString& licence);

    /**
        This is the same as SetLicence().
    */
    void SetLicense(const wxString& licence);

    /**
        Set the name of the program. If this method is not called, the string returned
        by wxApp::GetAppName will be shown in the dialog.
    */
    void SetName(const wxString& name);

    /**
        Set the list of translators. Please see AddTranslator() for additional
        discussion.
    */
    void SetTranslators(const wxArrayString& translators);

    /**
        Set the version of the program. The word "version" shouldn't be included
        in @a version. Example @a version values: "1.2" and "RC2". In about dialogs
        with more space set aside for version information, @a longVersion is used.
        Example @a longVersion values: "Version 1.2" and "Release Candidate 2".
        If @a version is non-empty but @a longVersion is empty, a long version
        is constructed automatically, using @a version (by simply prepending
        "Version " to @a version).

        The generic about dialog and native GTK+ dialog use @a version only,
        as a suffix to the program name. The native MSW and OS X about dialogs
        use the long version.
    */
    void SetVersion(const wxString& version, const wxString& longVersion = wxString());

    /**
       Return the short version string.

       @see SetVersion()
    */
    const wxString& GetVersion() const;
    
    /**
       Return the long version string if set.

       @see SetVersion()
    */
    const wxString& GetLongVersion() const;

    /**
       Returns @true if the website info has been set.
    */
    bool HasWebSite() const;

    /**
       Returns the website URL set for the dialog.
     */
    const wxString& GetWebSiteURL() const;

    /**
       Returns the description of the website URL set for the dialog.
     */
    const wxString& GetWebSiteDescription() const;
    
    /**
        Set the web site for the program and its description (which defaults to @a url
        itself if empty).

        Please notice that only GTK+ version currently supports showing the link in the
        native about dialog so if this method is called, the generic version will be
        used under all the other platforms.
    */
    void SetWebSite(const wxString& url,
                    const wxString& desc = wxEmptyString);

    
    /**
       Returns @true if developers have been set in the dialog info.
    */
    bool HasDevelopers() const;

    /**
       Returns an array of the developer strings set in the dialog info.
    */
    const wxArrayString& GetDevelopers() const;

    /**
       Returns @true if writers have been set in the dialog info.
    */
    bool HasDocWriters() const;

    /**
       Returns an array of the writer strings set in the dialog info.
    */
    const wxArrayString& GetDocWriters() const;

    /**
       Returns @true if artists have been set in the dialog info.
    */
    bool HasArtists() const;

    /**
       Returns an array of the artist strings set in the dialog info.
    */
    const wxArrayString& GetArtists() const;

    /**
       Returns @true if translators have been set in the dialog info.
    */
    bool HasTranslators() const;

    /**
       Returns an array of the translator strings set in the dialog info.
    */
    const wxArrayString& GetTranslators() const;

    
};


// ============================================================================
// Global functions/macros
// ============================================================================

/** @addtogroup group_funcmacro_dialog */
//@{

/**
    This function shows the standard about dialog containing the information
    specified in @a info. If the current platform has a native about dialog
    which is capable of showing all the fields in @a info, the native dialog is
    used, otherwise the function falls back to the generic wxWidgets version of
    the dialog, i.e. does the same thing as wxGenericAboutBox.

    Here is an example of how this function may be used:

    @code
    void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
    {
        wxAboutDialogInfo info;
        info.SetName(_("My Program"));
        info.SetVersion(_("1.2.3 Beta"));
        info.SetDescription(_("This program does something great."));
        info.SetCopyright(wxT("(C) 2007 Me <my@email.addre.ss>"));

        wxAboutBox(info);
    }
    @endcode

    Please see the @ref page_samples_dialogs for more examples of using this
    function and wxAboutDialogInfo for the description of the information which
    can be shown in the about dialog.

    @header{wx/aboutdlg.h}
*/
void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);

/**
    This function does the same thing as wxAboutBox() except that it always uses
    the generic wxWidgets version of the dialog instead of the native one.

    This is mainly useful if you need to customize the dialog by e.g. adding
    custom controls to it (customizing the native dialog is not currently
    supported).

    See the @ref page_samples_dialogs for an example of about dialog
    customization.

    @see wxAboutDialogInfo

    @header{wx/aboutdlg.h}
*/
void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent = NULL);

//@}