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 module gtk.AppChooserDialog; 26 27 private import gio.FileIF; 28 private import glib.ConstructionException; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import gtk.AppChooserIF; 32 private import gtk.AppChooserT; 33 private import gtk.Dialog; 34 private import gtk.Widget; 35 private import gtk.Window; 36 private import gtk.c.functions; 37 public import gtk.c.types; 38 public import gtkc.gtktypes; 39 40 41 /** 42 * #GtkAppChooserDialog shows a #GtkAppChooserWidget inside a #GtkDialog. 43 * 44 * Note that #GtkAppChooserDialog does not have any interesting methods 45 * of its own. Instead, you should get the embedded #GtkAppChooserWidget 46 * using gtk_app_chooser_dialog_get_widget() and call its methods if 47 * the generic #GtkAppChooser interface is not sufficient for your needs. 48 * 49 * To set the heading that is shown above the #GtkAppChooserWidget, 50 * use gtk_app_chooser_dialog_set_heading(). 51 */ 52 public class AppChooserDialog : Dialog, AppChooserIF 53 { 54 /** the main Gtk struct */ 55 protected GtkAppChooserDialog* gtkAppChooserDialog; 56 57 /** Get the main Gtk struct */ 58 public GtkAppChooserDialog* getAppChooserDialogStruct(bool transferOwnership = false) 59 { 60 if (transferOwnership) 61 ownedRef = false; 62 return gtkAppChooserDialog; 63 } 64 65 /** the main Gtk struct as a void* */ 66 protected override void* getStruct() 67 { 68 return cast(void*)gtkAppChooserDialog; 69 } 70 71 protected override void setStruct(GObject* obj) 72 { 73 gtkAppChooserDialog = cast(GtkAppChooserDialog*)obj; 74 super.setStruct(obj); 75 } 76 77 /** 78 * Sets our main struct and passes it to the parent class. 79 */ 80 public this (GtkAppChooserDialog* gtkAppChooserDialog, bool ownedRef = false) 81 { 82 this.gtkAppChooserDialog = gtkAppChooserDialog; 83 super(cast(GtkDialog*)gtkAppChooserDialog, ownedRef); 84 } 85 86 // add the AppChooser capabilities 87 mixin AppChooserT!(GtkAppChooserDialog); 88 89 90 /** */ 91 public static GType getType() 92 { 93 return gtk_app_chooser_dialog_get_type(); 94 } 95 96 /** 97 * Creates a new #GtkAppChooserDialog for the provided #GFile, 98 * to allow the user to select an application for it. 99 * 100 * Params: 101 * parent = a #GtkWindow, or %NULL 102 * flags = flags for this dialog 103 * file = a #GFile 104 * 105 * Returns: a newly created #GtkAppChooserDialog 106 * 107 * Since: 3.0 108 * 109 * Throws: ConstructionException GTK+ fails to create the object. 110 */ 111 public this(Window parent, GtkDialogFlags flags, FileIF file) 112 { 113 auto p = gtk_app_chooser_dialog_new((parent is null) ? null : parent.getWindowStruct(), flags, (file is null) ? null : file.getFileStruct()); 114 115 if(p is null) 116 { 117 throw new ConstructionException("null returned by new"); 118 } 119 120 this(cast(GtkAppChooserDialog*) p); 121 } 122 123 /** 124 * Creates a new #GtkAppChooserDialog for the provided content type, 125 * to allow the user to select an application for it. 126 * 127 * Params: 128 * parent = a #GtkWindow, or %NULL 129 * flags = flags for this dialog 130 * contentType = a content type string 131 * 132 * Returns: a newly created #GtkAppChooserDialog 133 * 134 * Since: 3.0 135 * 136 * Throws: ConstructionException GTK+ fails to create the object. 137 */ 138 public this(Window parent, GtkDialogFlags flags, string contentType) 139 { 140 auto p = gtk_app_chooser_dialog_new_for_content_type((parent is null) ? null : parent.getWindowStruct(), flags, Str.toStringz(contentType)); 141 142 if(p is null) 143 { 144 throw new ConstructionException("null returned by new_for_content_type"); 145 } 146 147 this(cast(GtkAppChooserDialog*) p); 148 } 149 150 /** 151 * Returns the text to display at the top of the dialog. 152 * 153 * Returns: the text to display at the top of the dialog, or %NULL, in which 154 * case a default text is displayed 155 */ 156 public string getHeading() 157 { 158 return Str.toString(gtk_app_chooser_dialog_get_heading(gtkAppChooserDialog)); 159 } 160 161 /** 162 * Returns the #GtkAppChooserWidget of this dialog. 163 * 164 * Returns: the #GtkAppChooserWidget of @self 165 * 166 * Since: 3.0 167 */ 168 public Widget getWidget() 169 { 170 auto p = gtk_app_chooser_dialog_get_widget(gtkAppChooserDialog); 171 172 if(p is null) 173 { 174 return null; 175 } 176 177 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 178 } 179 180 /** 181 * Sets the text to display at the top of the dialog. 182 * If the heading is not set, the dialog displays a default text. 183 * 184 * Params: 185 * heading = a string containing Pango markup 186 */ 187 public void setHeading(string heading) 188 { 189 gtk_app_chooser_dialog_set_heading(gtkAppChooserDialog, Str.toStringz(heading)); 190 } 191 }