alternative to assert
[gtkD.git] / gtkD / src / gtk / AboutDialog.d
blobfaa94a548d2de798992daffe8b695833257ad556
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkAboutDialog.html
26 * outPack = gtk
27 * outFile = AboutDialog
28 * strct = GtkAboutDialog
29 * realStrct=
30 * ctorStrct=
31 * clss = AboutDialog
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_about_dialog_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Pixbuf
47 * - gtk.Window
48 * structWrap:
49 * - GdkPixbuf* -> Pixbuf
50 * - GtkWindow* -> Window
51 * module aliases:
52 * local aliases:
55 module gtk.AboutDialog;
57 version(noAssert)
59 version(Tango)
61 import tango.io.Stdout; // use the tango loging?
65 private import gtkc.gtktypes;
67 private import gtkc.gtk;
70 private import glib.Str;
71 private import gdk.Pixbuf;
72 private import gtk.Window;
77 /**
78 * Description
79 * The GtkAboutDialog offers a simple way to display information about
80 * a program like its logo, name, copyright, website and license. It is
81 * also possible to give credits to the authors, documenters, translators
82 * and artists who have worked on the program. An about dialog is typically
83 * opened when the user selects the About option from
84 * the Help menu. All parts of the dialog are optional.
85 * About dialog often contain links and email addresses. GtkAboutDialog
86 * supports this by offering global hooks, which are called when the user
87 * clicks on a link or email address, see gtk_about_dialog_set_email_hook()
88 * and gtk_about_dialog_set_url_hook(). Email addresses in the
89 * authors, documenters and artists properties are recognized by looking for
90 * <user@host>, URLs are
91 * recognized by looking for http://url, with
92 * url extending to the next space, tab or line break.
93 * To make constructing a GtkAboutDialog as convenient as possible, you can
94 * use the function gtk_show_about_dialog() which constructs and shows a dialog
95 * and keeps it around so that it can be shown again.
97 private import gtk.Dialog;
98 public class AboutDialog : Dialog
101 /** the main Gtk struct */
102 protected GtkAboutDialog* gtkAboutDialog;
105 public GtkAboutDialog* getAboutDialogStruct()
107 return gtkAboutDialog;
111 /** the main Gtk struct as a void* */
112 protected void* getStruct()
114 return cast(void*)gtkAboutDialog;
118 * Sets our main struct and passes it to the parent class
120 public this (GtkAboutDialog* gtkAboutDialog)
122 version(noAssert)
124 if ( gtkAboutDialog is null )
126 int zero = 0;
127 version(Tango)
129 Stdout("struct gtkAboutDialog is null on constructor").newline;
131 else
133 printf("struct gtkAboutDialog is null on constructor");
135 zero = zero / zero;
138 else
140 assert(gtkAboutDialog !is null, "struct gtkAboutDialog is null on constructor");
142 super(cast(GtkDialog*)gtkAboutDialog);
143 this.gtkAboutDialog = gtkAboutDialog;
151 * Creates a new GtkAboutDialog.
152 * Returns:
153 * a newly created GtkAboutDialog
154 * Since 2.6
156 public this ()
158 // GtkWidget* gtk_about_dialog_new (void);
159 this(cast(GtkAboutDialog*)gtk_about_dialog_new() );
163 * Returns the program name displayed in the about dialog.
164 * about:
165 * a GtkAboutDialog
166 * Returns:
167 * The program name. The string is owned by the about
168 * dialog and must not be modified.
169 * Since 2.6
171 public char[] getName()
173 // const gchar* gtk_about_dialog_get_name (GtkAboutDialog *about);
174 return Str.toString(gtk_about_dialog_get_name(gtkAboutDialog) );
178 * Sets the name to display in the about dialog.
179 * If this is not set, it defaults to g_get_application_name().
180 * about:
181 * a GtkAboutDialog
182 * name:
183 * the program name
184 * Since 2.6
186 public void setName(char[] name)
188 // void gtk_about_dialog_set_name (GtkAboutDialog *about, const gchar *name);
189 gtk_about_dialog_set_name(gtkAboutDialog, Str.toStringz(name));
193 * Returns the version string.
194 * about:
195 * a GtkAboutDialog
196 * Returns:
197 * The version string. The string is owned by the about
198 * dialog and must not be modified.
199 * Since 2.6
201 public char[] getVersion()
203 // const gchar* gtk_about_dialog_get_version (GtkAboutDialog *about);
204 return Str.toString(gtk_about_dialog_get_version(gtkAboutDialog) );
208 * Sets the version string to display in the about dialog.
209 * about:
210 * a GtkAboutDialog
211 * version:
212 * the version string
213 * Since 2.6
215 public void setVersion(char[] versio)
217 // void gtk_about_dialog_set_version (GtkAboutDialog *about, const gchar *version);
218 gtk_about_dialog_set_version(gtkAboutDialog, Str.toStringz(versio));
222 * Returns the copyright string.
223 * about:
224 * a GtkAboutDialog
225 * Returns:
226 * The copyright string. The string is owned by the about
227 * dialog and must not be modified.
228 * Since 2.6
230 public char[] getCopyright()
232 // const gchar* gtk_about_dialog_get_copyright (GtkAboutDialog *about);
233 return Str.toString(gtk_about_dialog_get_copyright(gtkAboutDialog) );
237 * Sets the copyright string to display in the about dialog.
238 * This should be a short string of one or two lines.
239 * about:
240 * a GtkAboutDialog
241 * copyright:
242 * the copyright string
243 * Since 2.6
245 public void setCopyright(char[] copyright)
247 // void gtk_about_dialog_set_copyright (GtkAboutDialog *about, const gchar *copyright);
248 gtk_about_dialog_set_copyright(gtkAboutDialog, Str.toStringz(copyright));
252 * Returns the comments string.
253 * about:
254 * a GtkAboutDialog
255 * Returns:
256 * The comments. The string is owned by the about
257 * dialog and must not be modified.
258 * Since 2.6
260 public char[] getComments()
262 // const gchar* gtk_about_dialog_get_comments (GtkAboutDialog *about);
263 return Str.toString(gtk_about_dialog_get_comments(gtkAboutDialog) );
267 * Sets the comments string to display in the about
268 * dialog. This should be a short string of one or
269 * two lines.
270 * about:
271 * a GtkAboutDialog
272 * comments:
273 * a comments string
274 * Since 2.6
276 public void setComments(char[] comments)
278 // void gtk_about_dialog_set_comments (GtkAboutDialog *about, const gchar *comments);
279 gtk_about_dialog_set_comments(gtkAboutDialog, Str.toStringz(comments));
283 * Returns the license information.
284 * about:
285 * a GtkAboutDialog
286 * Returns:
287 * The license information. The string is owned by the about
288 * dialog and must not be modified.
289 * Since 2.6
291 public char[] getLicense()
293 // const gchar* gtk_about_dialog_get_license (GtkAboutDialog *about);
294 return Str.toString(gtk_about_dialog_get_license(gtkAboutDialog) );
298 * Sets the license information to be displayed in the secondary
299 * license dialog. If license is NULL, the license button is
300 * hidden.
301 * about:
302 * a GtkAboutDialog
303 * license:
304 * the license information or NULL
305 * Since 2.6
307 public void setLicense(char[] license)
309 // void gtk_about_dialog_set_license (GtkAboutDialog *about, const gchar *license);
310 gtk_about_dialog_set_license(gtkAboutDialog, Str.toStringz(license));
314 * Returns whether the license text in about is
315 * automatically wrapped.
316 * about:
317 * a GtkAboutDialog
318 * Returns:
319 * TRUE if the license text is wrapped
320 * Since 2.8
322 public int getWrapLicense()
324 // gboolean gtk_about_dialog_get_wrap_license (GtkAboutDialog *about);
325 return gtk_about_dialog_get_wrap_license(gtkAboutDialog);
329 * Sets whether the license text in about is
330 * automatically wrapped.
331 * about:
332 * a GtkAboutDialog
333 * wrap_license:
334 * whether to wrap the license
335 * Since 2.8
337 public void setWrapLicense(int wrapLicense)
339 // void gtk_about_dialog_set_wrap_license (GtkAboutDialog *about, gboolean wrap_license);
340 gtk_about_dialog_set_wrap_license(gtkAboutDialog, wrapLicense);
344 * Returns the website URL.
345 * about:
346 * a GtkAboutDialog
347 * Returns:
348 * The website URL. The string is owned by the about
349 * dialog and must not be modified.
350 * Since 2.6
352 public char[] getWebsite()
354 // const gchar* gtk_about_dialog_get_website (GtkAboutDialog *about);
355 return Str.toString(gtk_about_dialog_get_website(gtkAboutDialog) );
359 * Sets the URL to use for the website link.
360 * about:
361 * a GtkAboutDialog
362 * website:
363 * a URL string starting with "http://"
364 * Since 2.6
366 public void setWebsite(char[] website)
368 // void gtk_about_dialog_set_website (GtkAboutDialog *about, const gchar *website);
369 gtk_about_dialog_set_website(gtkAboutDialog, Str.toStringz(website));
373 * Returns the label used for the website link.
374 * about:
375 * a GtkAboutDialog
376 * Returns:
377 * The label used for the website link. The string is owned by the about
378 * dialog and must not be modified.
379 * Since 2.6
381 public char[] getWebsiteLabel()
383 // const gchar* gtk_about_dialog_get_website_label (GtkAboutDialog *about);
384 return Str.toString(gtk_about_dialog_get_website_label(gtkAboutDialog) );
388 * Sets the label to be used for the website link.
389 * It defaults to the website URL.
390 * about:
391 * a GtkAboutDialog
392 * website_label:
393 * the label used for the website link
394 * Since 2.6
396 public void setWebsiteLabel(char[] websiteLabel)
398 // void gtk_about_dialog_set_website_label (GtkAboutDialog *about, const gchar *website_label);
399 gtk_about_dialog_set_website_label(gtkAboutDialog, Str.toStringz(websiteLabel));
403 * Returns the string which are displayed in the authors tab
404 * of the secondary credits dialog.
405 * about:
406 * a GtkAboutDialog
407 * Returns:
408 * A NULL-terminated string array containing
409 * the authors. The array is owned by the about dialog
410 * and must not be modified.
411 * Since 2.6
413 public char** getAuthors()
415 // const gchar* const * gtk_about_dialog_get_authors (GtkAboutDialog *about);
416 return gtk_about_dialog_get_authors(gtkAboutDialog);
420 * Sets the strings which are displayed in the authors tab
421 * of the secondary credits dialog.
422 * about:
423 * a GtkAboutDialog
424 * authors:
425 * a NULL-terminated array of strings
426 * Since 2.6
428 public void setAuthors(char** authors)
430 // void gtk_about_dialog_set_authors (GtkAboutDialog *about, const gchar **authors);
431 gtk_about_dialog_set_authors(gtkAboutDialog, authors);
435 * Returns the string which are displayed in the artists tab
436 * of the secondary credits dialog.
437 * about:
438 * a GtkAboutDialog
439 * Returns:
440 * A NULL-terminated string array containing
441 * the artists. The array is owned by the about dialog
442 * and must not be modified.
443 * Since 2.6
445 public char** getArtists()
447 // const gchar* const * gtk_about_dialog_get_artists (GtkAboutDialog *about);
448 return gtk_about_dialog_get_artists(gtkAboutDialog);
452 * Sets the strings which are displayed in the artists tab
453 * of the secondary credits dialog.
454 * about:
455 * a GtkAboutDialog
456 * artists:
457 * a NULL-terminated array of strings
458 * Since 2.6
460 public void setArtists(char** artists)
462 // void gtk_about_dialog_set_artists (GtkAboutDialog *about, const gchar **artists);
463 gtk_about_dialog_set_artists(gtkAboutDialog, artists);
467 * Returns the string which are displayed in the documenters
468 * tab of the secondary credits dialog.
469 * about:
470 * a GtkAboutDialog
471 * Returns:
472 * A NULL-terminated string array containing
473 * the documenters. The array is owned by the about dialog
474 * and must not be modified.
475 * Since 2.6
477 public char** getDocumenters()
479 // const gchar* const * gtk_about_dialog_get_documenters (GtkAboutDialog *about);
480 return gtk_about_dialog_get_documenters(gtkAboutDialog);
484 * Sets the strings which are displayed in the documenters tab
485 * of the secondary credits dialog.
486 * about:
487 * a GtkAboutDialog
488 * documenters:
489 * a NULL-terminated array of strings
490 * Since 2.6
492 public void setDocumenters(char** documenters)
494 // void gtk_about_dialog_set_documenters (GtkAboutDialog *about, const gchar **documenters);
495 gtk_about_dialog_set_documenters(gtkAboutDialog, documenters);
499 * Returns the translator credits string which is displayed
500 * in the translators tab of the secondary credits dialog.
501 * about:
502 * a GtkAboutDialog
503 * Returns:
504 * The translator credits string. The string is
505 * owned by the about dialog and must not be modified.
506 * Since 2.6
508 public char[] getTranslatorCredits()
510 // const gchar* gtk_about_dialog_get_translator_credits (GtkAboutDialog *about);
511 return Str.toString(gtk_about_dialog_get_translator_credits(gtkAboutDialog) );
515 * Sets the translator credits string which is displayed in
516 * the translators tab of the secondary credits dialog.
517 * The intended use for this string is to display the translator
518 * of the language which is currently used in the user interface.
519 * Using gettext(), a simple way to achieve that is to mark the
520 * string for translation:
521 * gtk_about_dialog_set_translator_credits (about, _("translator-credits"));
522 * It is a good idea to use the customary msgid "translator-credits" for this
523 * purpose, since translators will already know the purpose of that msgid, and
524 * since GtkAboutDialog will detect if "translator-credits" is untranslated
525 * and hide the tab.
526 * about:
527 * a GtkAboutDialog
528 * translator_credits:
529 * the translator credits
530 * Since 2.6
532 public void setTranslatorCredits(char[] translatorCredits)
534 // void gtk_about_dialog_set_translator_credits (GtkAboutDialog *about, const gchar *translator_credits);
535 gtk_about_dialog_set_translator_credits(gtkAboutDialog, Str.toStringz(translatorCredits));
539 * Returns the pixbuf displayed as logo in the about dialog.
540 * about:
541 * a GtkAboutDialog
542 * Returns:
543 * the pixbuf displayed as logo. The pixbuf is
544 * owned by the about dialog. If you want to keep a reference
545 * to it, you have to call g_object_ref() on it.
546 * Since 2.6
548 public Pixbuf getLogo()
550 // GdkPixbuf* gtk_about_dialog_get_logo (GtkAboutDialog *about);
551 return new Pixbuf( gtk_about_dialog_get_logo(gtkAboutDialog) );
555 * Sets the pixbuf to be displayed as logo in
556 * the about dialog. If it is NULL, the default
557 * window icon set with gtk_window_set_default_icon()
558 * will be used.
559 * about:
560 * a GtkAboutDialog
561 * logo:
562 * a GdkPixbuf, or NULL
563 * Since 2.6
565 public void setLogo(Pixbuf logo)
567 // void gtk_about_dialog_set_logo (GtkAboutDialog *about, GdkPixbuf *logo);
568 gtk_about_dialog_set_logo(gtkAboutDialog, (logo is null) ? null : logo.getPixbufStruct());
572 * Returns the icon name displayed as logo in the about dialog.
573 * about:
574 * a GtkAboutDialog
575 * Returns:
576 * the icon name displayed as logo. The string is
577 * owned by the dialog. If you want to keep a reference
578 * to it, you have to call g_strdup() on it.
579 * Since 2.6
581 public char[] getLogoIconName()
583 // const gchar* gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about);
584 return Str.toString(gtk_about_dialog_get_logo_icon_name(gtkAboutDialog) );
588 * Sets the pixbuf to be displayed as logo in
589 * the about dialog. If it is NULL, the default
590 * window icon set with gtk_window_set_default_icon()
591 * will be used.
592 * about:
593 * a GtkAboutDialog
594 * icon_name:
595 * an icon name, or NULL
596 * Since 2.6
598 public void setLogoIconName(char[] iconName)
600 // void gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about, const gchar *icon_name);
601 gtk_about_dialog_set_logo_icon_name(gtkAboutDialog, Str.toStringz(iconName));
606 * Installs a global function to be called whenever the user activates an
607 * email link in an about dialog.
608 * func:
609 * a function to call when an email link is activated.
610 * data:
611 * data to pass to func
612 * destroy:
613 * GDestroyNotify for data
614 * Returns:
615 * the previous email hook.
616 * Since 2.6
618 public static GtkAboutDialogActivateLinkFunc setEmailHook(GtkAboutDialogActivateLinkFunc func, void* data, GDestroyNotify destroy)
620 // GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_email_hook (GtkAboutDialogActivateLinkFunc func, gpointer data, GDestroyNotify destroy);
621 return gtk_about_dialog_set_email_hook(func, data, destroy);
625 * Installs a global function to be called whenever the user activates a
626 * URL link in an about dialog.
627 * func:
628 * a function to call when a URL link is activated.
629 * data:
630 * data to pass to func
631 * destroy:
632 * GDestroyNotify for data
633 * Returns:
634 * the previous URL hook.
635 * Since 2.6
637 public static GtkAboutDialogActivateLinkFunc setUrlHook(GtkAboutDialogActivateLinkFunc func, void* data, GDestroyNotify destroy)
639 // GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func, gpointer data, GDestroyNotify destroy);
640 return gtk_about_dialog_set_url_hook(func, data, destroy);
644 * This is a convenience function for showing an application's about box.
645 * The constructed dialog is associated with the parent window and
646 * reused for future invocations of this function.
647 * parent:
648 * transient parent, or NULL for none
649 * first_property_name:
650 * the name of the first property
651 * ...:
652 * value of first property, followed by more properties, NULL-terminated
653 * Since 2.6
654 * Property Details
655 * The "artists" property
656 * "artists" GStrv : Read / Write
657 * The people who contributed artwork to the program, as a NULL-terminated array of strings.
658 * Each string may contain email addresses and URLs, which will be displayed
659 * as links, see the introduction for more details.
660 * Since 2.6
662 public static void showAboutDialog(Window parent, char[] firstPropertyName, ... )
664 // void gtk_show_about_dialog (GtkWindow *parent, const gchar *first_property_name, ...);
665 gtk_show_about_dialog((parent is null) ? null : parent.getWindowStruct(), Str.toStringz(firstPropertyName));