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