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