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