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 	public static GType getType()
89 	{
90 		return gtk_app_chooser_dialog_get_type();
91 	}
92 
93 	/**
94 	 * Creates a new #GtkAppChooserDialog for the provided #GFile,
95 	 * to allow the user to select an application for it.
96 	 *
97 	 * Params:
98 	 *     parent = a #GtkWindow, or %NULL
99 	 *     flags = flags for this dialog
100 	 *     file = a #GFile
101 	 *
102 	 * Returns: a newly created #GtkAppChooserDialog
103 	 *
104 	 * Since: 3.0
105 	 *
106 	 * Throws: ConstructionException GTK+ fails to create the object.
107 	 */
108 	public this(Window parent, GtkDialogFlags flags, FileIF file)
109 	{
110 		auto p = gtk_app_chooser_dialog_new((parent is null) ? null : parent.getWindowStruct(), flags, (file is null) ? null : file.getFileStruct());
111 		
112 		if(p is null)
113 		{
114 			throw new ConstructionException("null returned by new");
115 		}
116 		
117 		this(cast(GtkAppChooserDialog*) p);
118 	}
119 
120 	/**
121 	 * Creates a new #GtkAppChooserDialog for the provided content type,
122 	 * to allow the user to select an application for it.
123 	 *
124 	 * Params:
125 	 *     parent = a #GtkWindow, or %NULL
126 	 *     flags = flags for this dialog
127 	 *     contentType = a content type string
128 	 *
129 	 * Returns: a newly created #GtkAppChooserDialog
130 	 *
131 	 * Since: 3.0
132 	 *
133 	 * Throws: ConstructionException GTK+ fails to create the object.
134 	 */
135 	public this(Window parent, GtkDialogFlags flags, string contentType)
136 	{
137 		auto p = gtk_app_chooser_dialog_new_for_content_type((parent is null) ? null : parent.getWindowStruct(), flags, Str.toStringz(contentType));
138 		
139 		if(p is null)
140 		{
141 			throw new ConstructionException("null returned by new_for_content_type");
142 		}
143 		
144 		this(cast(GtkAppChooserDialog*) p);
145 	}
146 
147 	/**
148 	 * Returns the text to display at the top of the dialog.
149 	 *
150 	 * Returns: the text to display at the top of the dialog, or %NULL, in which
151 	 *     case a default text is displayed
152 	 */
153 	public string getHeading()
154 	{
155 		return Str.toString(gtk_app_chooser_dialog_get_heading(gtkAppChooserDialog));
156 	}
157 
158 	/**
159 	 * Returns the #GtkAppChooserWidget of this dialog.
160 	 *
161 	 * Returns: the #GtkAppChooserWidget of @self
162 	 *
163 	 * Since: 3.0
164 	 */
165 	public Widget getWidget()
166 	{
167 		auto p = gtk_app_chooser_dialog_get_widget(gtkAppChooserDialog);
168 		
169 		if(p is null)
170 		{
171 			return null;
172 		}
173 		
174 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
175 	}
176 
177 	/**
178 	 * Sets the text to display at the top of the dialog.
179 	 * If the heading is not set, the dialog displays a default text.
180 	 *
181 	 * Params:
182 	 *     heading = a string containing Pango markup
183 	 */
184 	public void setHeading(string heading)
185 	{
186 		gtk_app_chooser_dialog_set_heading(gtkAppChooserDialog, Str.toStringz(heading));
187 	}
188 }