1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = GtkAboutDialog.html
27  * outPack = gtk
28  * outFile = AboutDialog
29  * strct   = GtkAboutDialog
30  * realStrct=
31  * ctorStrct=
32  * clss    = AboutDialog
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_about_dialog_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gdk.Pixbuf
49  * 	- gtk.Window
50  * structWrap:
51  * 	- GdkPixbuf* -> Pixbuf
52  * 	- GtkWindow* -> Window
53  * module aliases:
54  * local aliases:
55  * overrides:
56  * 	- getName
57  * 	- setName
58  */
59 
60 module gtk.AboutDialog;
61 
62 public  import gtkc.gtktypes;
63 
64 private import gtkc.gtk;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 private import gobject.Signals;
69 public  import gtkc.gdktypes;
70 private import glib.Str;
71 private import gdk.Pixbuf;
72 private import gtk.Window;
73 
74 
75 private import gtk.Dialog;
76 
77 /**
78  * The GtkAboutDialog offers a simple way to display information about
79  * a program like its logo, name, copyright, website and license. It is
80  * also possible to give credits to the authors, documenters, translators
81  * and artists who have worked on the program. An about dialog is typically
82  * opened when the user selects the About option from
83  * the Help menu. All parts of the dialog are optional.
84  *
85  * About dialog often contain links and email addresses. GtkAboutDialog
86  * displays these as clickable links. By default, it calls gtk_show_uri()
87  * when a user clicks one. The behaviour can be overridden with the
88  * "activate-link" signal.
89  *
90  * To make constructing a GtkAboutDialog as convenient as possible, you can
91  * use the function gtk_show_about_dialog() which constructs and shows a dialog
92  * and keeps it around so that it can be shown again.
93  *
94  * Note that GTK+ sets a default title of _("About %s")
95  * on the dialog window (where %s is replaced by the name of the
96  * application, but in order to ensure proper translation of the title,
97  * applications should set the title property explicitly when constructing
98  * a GtkAboutDialog, as shown in the following example:
99  *
100  * $(DDOC_COMMENT example)
101  *
102  * It is also possible to show a GtkAboutDialog like any other GtkDialog,
103  * e.g. using gtk_dialog_run(). In this case, you might need to know that
104  * the 'Close' button returns the GTK_RESPONSE_CANCEL response id.
105  */
106 public class AboutDialog : Dialog
107 {
108 	
109 	/** the main Gtk struct */
110 	protected GtkAboutDialog* gtkAboutDialog;
111 	
112 	
113 	/** Get the main Gtk struct */
114 	public GtkAboutDialog* getAboutDialogStruct()
115 	{
116 		return gtkAboutDialog;
117 	}
118 	
119 	
120 	/** the main Gtk struct as a void* */
121 	protected override void* getStruct()
122 	{
123 		return cast(void*)gtkAboutDialog;
124 	}
125 	
126 	/**
127 	 * Sets our main struct and passes it to the parent class
128 	 */
129 	public this (GtkAboutDialog* gtkAboutDialog)
130 	{
131 		super(cast(GtkDialog*)gtkAboutDialog);
132 		this.gtkAboutDialog = gtkAboutDialog;
133 	}
134 	
135 	protected override void setStruct(GObject* obj)
136 	{
137 		super.setStruct(obj);
138 		gtkAboutDialog = cast(GtkAboutDialog*)obj;
139 	}
140 	
141 	/**
142 	 */
143 	int[string] connectedSignals;
144 	
145 	bool delegate(string, AboutDialog)[] onActivateLinkListeners;
146 	/**
147 	 * The signal which gets emitted to activate a URI.
148 	 * Applications may connect to it to override the default behaviour,
149 	 * which is to call gtk_show_uri().
150 	 * TRUE if the link has been activated
151 	 * Since 2.24
152 	 */
153 	void addOnActivateLink(bool delegate(string, AboutDialog) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
154 	{
155 		if ( !("activate-link" in connectedSignals) )
156 		{
157 			Signals.connectData(
158 			getStruct(),
159 			"activate-link",
160 			cast(GCallback)&callBackActivateLink,
161 			cast(void*)this,
162 			null,
163 			connectFlags);
164 			connectedSignals["activate-link"] = 1;
165 		}
166 		onActivateLinkListeners ~= dlg;
167 	}
168 	extern(C) static gboolean callBackActivateLink(GtkAboutDialog* labelStruct, gchar* uri, AboutDialog _aboutDialog)
169 	{
170 		foreach ( bool delegate(string, AboutDialog) dlg ; _aboutDialog.onActivateLinkListeners )
171 		{
172 			if ( dlg(Str.toString(uri), _aboutDialog) )
173 			{
174 				return 1;
175 			}
176 		}
177 		
178 		return 0;
179 	}
180 	
181 	
182 	/**
183 	 * Creates a new GtkAboutDialog.
184 	 * Since 2.6
185 	 * Throws: ConstructionException GTK+ fails to create the object.
186 	 */
187 	public this ()
188 	{
189 		// GtkWidget * gtk_about_dialog_new (void);
190 		auto p = gtk_about_dialog_new();
191 		if(p is null)
192 		{
193 			throw new ConstructionException("null returned by gtk_about_dialog_new()");
194 		}
195 		this(cast(GtkAboutDialog*) p);
196 	}
197 	
198 	/**
199 	 * Returns the program name displayed in the about dialog.
200 	 * Since 2.12
201 	 * Returns: The program name. The string is owned by the about dialog and must not be modified.
202 	 */
203 	public string getProgramName()
204 	{
205 		// const gchar * gtk_about_dialog_get_program_name (GtkAboutDialog *about);
206 		return Str.toString(gtk_about_dialog_get_program_name(gtkAboutDialog));
207 	}
208 	
209 	/**
210 	 * Sets the name to display in the about dialog.
211 	 * If this is not set, it defaults to g_get_application_name().
212 	 * Since 2.12
213 	 * Params:
214 	 * name = the program name
215 	 */
216 	public void setProgramName(string name)
217 	{
218 		// void gtk_about_dialog_set_program_name (GtkAboutDialog *about,  const gchar *name);
219 		gtk_about_dialog_set_program_name(gtkAboutDialog, Str.toStringz(name));
220 	}
221 	
222 	/**
223 	 * Returns the version string.
224 	 * Since 2.6
225 	 * Returns: The version string. The string is owned by the about dialog and must not be modified.
226 	 */
227 	public string getVersion()
228 	{
229 		// const gchar * gtk_about_dialog_get_version (GtkAboutDialog *about);
230 		return Str.toString(gtk_about_dialog_get_version(gtkAboutDialog));
231 	}
232 	
233 	/**
234 	 * Sets the version string to display in the about dialog.
235 	 * Since 2.6
236 	 */
237 	public void setVersion(string versio)
238 	{
239 		// void gtk_about_dialog_set_version (GtkAboutDialog *about,  const gchar *version);
240 		gtk_about_dialog_set_version(gtkAboutDialog, Str.toStringz(versio));
241 	}
242 	
243 	/**
244 	 * Returns the copyright string.
245 	 * Since 2.6
246 	 * Returns: The copyright string. The string is owned by the about dialog and must not be modified.
247 	 */
248 	public string getCopyright()
249 	{
250 		// const gchar * gtk_about_dialog_get_copyright (GtkAboutDialog *about);
251 		return Str.toString(gtk_about_dialog_get_copyright(gtkAboutDialog));
252 	}
253 	
254 	/**
255 	 * Sets the copyright string to display in the about dialog.
256 	 * This should be a short string of one or two lines.
257 	 * Since 2.6
258 	 * Params:
259 	 * copyright = (allow-none) the copyright string
260 	 */
261 	public void setCopyright(string copyright)
262 	{
263 		// void gtk_about_dialog_set_copyright (GtkAboutDialog *about,  const gchar *copyright);
264 		gtk_about_dialog_set_copyright(gtkAboutDialog, Str.toStringz(copyright));
265 	}
266 	
267 	/**
268 	 * Returns the comments string.
269 	 * Since 2.6
270 	 * Returns: The comments. The string is owned by the about dialog and must not be modified.
271 	 */
272 	public string getComments()
273 	{
274 		// const gchar * gtk_about_dialog_get_comments (GtkAboutDialog *about);
275 		return Str.toString(gtk_about_dialog_get_comments(gtkAboutDialog));
276 	}
277 	
278 	/**
279 	 * Sets the comments string to display in the about dialog.
280 	 * This should be a short string of one or two lines.
281 	 * Since 2.6
282 	 * Params:
283 	 * comments = a comments string. [allow-none]
284 	 */
285 	public void setComments(string comments)
286 	{
287 		// void gtk_about_dialog_set_comments (GtkAboutDialog *about,  const gchar *comments);
288 		gtk_about_dialog_set_comments(gtkAboutDialog, Str.toStringz(comments));
289 	}
290 	
291 	/**
292 	 * Returns the license information.
293 	 * Since 2.6
294 	 * Returns: The license information. The string is owned by the about dialog and must not be modified.
295 	 */
296 	public string getLicense()
297 	{
298 		// const gchar * gtk_about_dialog_get_license (GtkAboutDialog *about);
299 		return Str.toString(gtk_about_dialog_get_license(gtkAboutDialog));
300 	}
301 	
302 	/**
303 	 * Sets the license information to be displayed in the secondary
304 	 * license dialog. If license is NULL, the license button is
305 	 * hidden.
306 	 * Since 2.6
307 	 * Params:
308 	 * license = the license information or NULL. [allow-none]
309 	 */
310 	public void setLicense(string license)
311 	{
312 		// void gtk_about_dialog_set_license (GtkAboutDialog *about,  const gchar *license);
313 		gtk_about_dialog_set_license(gtkAboutDialog, Str.toStringz(license));
314 	}
315 	
316 	/**
317 	 * Returns whether the license text in about is
318 	 * automatically wrapped.
319 	 * Since 2.8
320 	 * Returns: TRUE if the license text is wrapped
321 	 */
322 	public int getWrapLicense()
323 	{
324 		// gboolean gtk_about_dialog_get_wrap_license (GtkAboutDialog *about);
325 		return gtk_about_dialog_get_wrap_license(gtkAboutDialog);
326 	}
327 	
328 	/**
329 	 * Sets whether the license text in about is
330 	 * automatically wrapped.
331 	 * Since 2.8
332 	 * Params:
333 	 * wrapLicense = whether to wrap the license
334 	 */
335 	public void setWrapLicense(int wrapLicense)
336 	{
337 		// void gtk_about_dialog_set_wrap_license (GtkAboutDialog *about,  gboolean wrap_license);
338 		gtk_about_dialog_set_wrap_license(gtkAboutDialog, wrapLicense);
339 	}
340 	
341 	/**
342 	 * Retrieves the license set using gtk_about_dialog_set_license_type()
343 	 * Returns: a GtkLicense value Since 3.0
344 	 */
345 	public GtkLicense getLicenseType()
346 	{
347 		// GtkLicense gtk_about_dialog_get_license_type (GtkAboutDialog *about);
348 		return gtk_about_dialog_get_license_type(gtkAboutDialog);
349 	}
350 	
351 	/**
352 	 * Sets the license of the application showing the about dialog from a
353 	 * list of known licenses.
354 	 * This function overrides the license set using
355 	 * gtk_about_dialog_set_license().
356 	 * Params:
357 	 * licenseType = the type of license
358 	 * Since 3.0
359 	 */
360 	public void setLicenseType(GtkLicense licenseType)
361 	{
362 		// void gtk_about_dialog_set_license_type (GtkAboutDialog *about,  GtkLicense license_type);
363 		gtk_about_dialog_set_license_type(gtkAboutDialog, licenseType);
364 	}
365 	
366 	/**
367 	 * Returns the website URL.
368 	 * Since 2.6
369 	 * Returns: The website URL. The string is owned by the about dialog and must not be modified.
370 	 */
371 	public string getWebsite()
372 	{
373 		// const gchar * gtk_about_dialog_get_website (GtkAboutDialog *about);
374 		return Str.toString(gtk_about_dialog_get_website(gtkAboutDialog));
375 	}
376 	
377 	/**
378 	 * Sets the URL to use for the website link.
379 	 * Since 2.6
380 	 * Params:
381 	 * website = a URL string starting with "http://". [allow-none]
382 	 */
383 	public void setWebsite(string website)
384 	{
385 		// void gtk_about_dialog_set_website (GtkAboutDialog *about,  const gchar *website);
386 		gtk_about_dialog_set_website(gtkAboutDialog, Str.toStringz(website));
387 	}
388 	
389 	/**
390 	 * Returns the label used for the website link.
391 	 * Since 2.6
392 	 * Returns: The label used for the website link. The string is owned by the about dialog and must not be modified.
393 	 */
394 	public string getWebsiteLabel()
395 	{
396 		// const gchar * gtk_about_dialog_get_website_label (GtkAboutDialog *about);
397 		return Str.toString(gtk_about_dialog_get_website_label(gtkAboutDialog));
398 	}
399 	
400 	/**
401 	 * Sets the label to be used for the website link.
402 	 * Since 2.6
403 	 * Params:
404 	 * websiteLabel = the label used for the website link
405 	 */
406 	public void setWebsiteLabel(string websiteLabel)
407 	{
408 		// void gtk_about_dialog_set_website_label (GtkAboutDialog *about,  const gchar *website_label);
409 		gtk_about_dialog_set_website_label(gtkAboutDialog, Str.toStringz(websiteLabel));
410 	}
411 	
412 	/**
413 	 * Returns the string which are displayed in the authors tab
414 	 * of the secondary credits dialog.
415 	 * Since 2.6
416 	 * Returns: A NULL-terminated string array containing the authors. The array is owned by the about dialog and must not be modified. [array zero-terminated=1][transfer none]
417 	 */
418 	public string[] getAuthors()
419 	{
420 		// const gchar * const * gtk_about_dialog_get_authors (GtkAboutDialog *about);
421 		return Str.toStringArray(gtk_about_dialog_get_authors(gtkAboutDialog));
422 	}
423 	
424 	/**
425 	 * Sets the strings which are displayed in the authors tab
426 	 * of the secondary credits dialog.
427 	 * Since 2.6
428 	 * Params:
429 	 * authors = a NULL-terminated array of strings. [array zero-terminated=1]
430 	 */
431 	public void setAuthors(string[] authors)
432 	{
433 		// void gtk_about_dialog_set_authors (GtkAboutDialog *about,  const gchar **authors);
434 		gtk_about_dialog_set_authors(gtkAboutDialog, Str.toStringzArray(authors));
435 	}
436 	
437 	/**
438 	 * Returns the string which are displayed in the artists tab
439 	 * of the secondary credits dialog.
440 	 * Since 2.6
441 	 * Returns: A NULL-terminated string array containing the artists. The array is owned by the about dialog and must not be modified. [array zero-terminated=1][transfer none]
442 	 */
443 	public string[] getArtists()
444 	{
445 		// const gchar * const * gtk_about_dialog_get_artists (GtkAboutDialog *about);
446 		return Str.toStringArray(gtk_about_dialog_get_artists(gtkAboutDialog));
447 	}
448 	
449 	/**
450 	 * Sets the strings which are displayed in the artists tab
451 	 * of the secondary credits dialog.
452 	 * Since 2.6
453 	 * Params:
454 	 * artists = a NULL-terminated array of strings. [array zero-terminated=1]
455 	 */
456 	public void setArtists(string[] artists)
457 	{
458 		// void gtk_about_dialog_set_artists (GtkAboutDialog *about,  const gchar **artists);
459 		gtk_about_dialog_set_artists(gtkAboutDialog, Str.toStringzArray(artists));
460 	}
461 	
462 	/**
463 	 * Returns the string which are displayed in the documenters
464 	 * tab of the secondary credits dialog.
465 	 * Since 2.6
466 	 * Returns: A NULL-terminated string array containing the documenters. The array is owned by the about dialog and must not be modified. [array zero-terminated=1][transfer none]
467 	 */
468 	public string[] getDocumenters()
469 	{
470 		// const gchar * const * gtk_about_dialog_get_documenters (GtkAboutDialog *about);
471 		return Str.toStringArray(gtk_about_dialog_get_documenters(gtkAboutDialog));
472 	}
473 	
474 	/**
475 	 * Sets the strings which are displayed in the documenters tab
476 	 * of the secondary credits dialog.
477 	 * Since 2.6
478 	 * Params:
479 	 * documenters = a NULL-terminated array of strings. [array zero-terminated=1]
480 	 */
481 	public void setDocumenters(string[] documenters)
482 	{
483 		// void gtk_about_dialog_set_documenters (GtkAboutDialog *about,  const gchar **documenters);
484 		gtk_about_dialog_set_documenters(gtkAboutDialog, Str.toStringzArray(documenters));
485 	}
486 	
487 	/**
488 	 * Returns the translator credits string which is displayed
489 	 * in the translators tab of the secondary credits dialog.
490 	 * Since 2.6
491 	 * Returns: The translator credits string. The string is owned by the about dialog and must not be modified.
492 	 */
493 	public string getTranslatorCredits()
494 	{
495 		// const gchar * gtk_about_dialog_get_translator_credits  (GtkAboutDialog *about);
496 		return Str.toString(gtk_about_dialog_get_translator_credits(gtkAboutDialog));
497 	}
498 	
499 	/**
500 	 * Sets the translator credits string which is displayed in
501 	 * the translators tab of the secondary credits dialog.
502 	 * The intended use for this string is to display the translator
503 	 * of the language which is currently used in the user interface.
504 	 * Using gettext(), a simple way to achieve that is to mark the
505 	 * Since 2.6
506 	 * Params:
507 	 * translatorCredits = the translator credits. [allow-none]
508 	 */
509 	public void setTranslatorCredits(string translatorCredits)
510 	{
511 		// void gtk_about_dialog_set_translator_credits  (GtkAboutDialog *about,  const gchar *translator_credits);
512 		gtk_about_dialog_set_translator_credits(gtkAboutDialog, Str.toStringz(translatorCredits));
513 	}
514 	
515 	/**
516 	 * Returns the pixbuf displayed as logo in the about dialog.
517 	 * Since 2.6
518 	 * Returns: the pixbuf displayed as logo. The pixbuf is owned by the about dialog. If you want to keep a reference to it, you have to call g_object_ref() on it. [transfer none]
519 	 */
520 	public Pixbuf getLogo()
521 	{
522 		// GdkPixbuf * gtk_about_dialog_get_logo (GtkAboutDialog *about);
523 		auto p = gtk_about_dialog_get_logo(gtkAboutDialog);
524 		
525 		if(p is null)
526 		{
527 			return null;
528 		}
529 		
530 		import gtkc.gobject : g_object_ref;
531 		g_object_ref(cast(GObject*)p);
532 		
533 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
534 	}
535 	
536 	/**
537 	 * Sets the pixbuf to be displayed as logo in the about dialog.
538 	 * If it is NULL, the default window icon set with
539 	 * gtk_window_set_default_icon() will be used.
540 	 * Since 2.6
541 	 * Params:
542 	 * logo = a GdkPixbuf, or NULL. [allow-none]
543 	 */
544 	public void setLogo(Pixbuf logo)
545 	{
546 		// void gtk_about_dialog_set_logo (GtkAboutDialog *about,  GdkPixbuf *logo);
547 		gtk_about_dialog_set_logo(gtkAboutDialog, (logo is null) ? null : logo.getPixbufStruct());
548 	}
549 	
550 	/**
551 	 * Returns the icon name displayed as logo in the about dialog.
552 	 * Since 2.6
553 	 * Returns: the icon name displayed as logo. The string is owned by the dialog. If you want to keep a reference to it, you have to call g_strdup() on it.
554 	 */
555 	public string getLogoIconName()
556 	{
557 		// const gchar * gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about);
558 		return Str.toString(gtk_about_dialog_get_logo_icon_name(gtkAboutDialog));
559 	}
560 	
561 	/**
562 	 * Sets the pixbuf to be displayed as logo in the about dialog.
563 	 * If it is NULL, the default window icon set with
564 	 * gtk_window_set_default_icon() will be used.
565 	 * Since 2.6
566 	 * Params:
567 	 * iconName = an icon name, or NULL. [allow-none]
568 	 */
569 	public void setLogoIconName(string iconName)
570 	{
571 		// void gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,  const gchar *icon_name);
572 		gtk_about_dialog_set_logo_icon_name(gtkAboutDialog, Str.toStringz(iconName));
573 	}
574 	
575 	/**
576 	 * Creates a new section in the Credits page.
577 	 * Params:
578 	 * sectionName = The name of the section
579 	 * people = The people who belong to that section. [array zero-terminated=1]
580 	 * Since 3.4
581 	 */
582 	public void addCreditSection(string sectionName, string[] people)
583 	{
584 		// void gtk_about_dialog_add_credit_section (GtkAboutDialog *about,  const gchar *section_name,  const gchar **people);
585 		gtk_about_dialog_add_credit_section(gtkAboutDialog, Str.toStringz(sectionName), Str.toStringzArray(people));
586 	}
587 }