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 glib.c.functions;
31 private import gobject.ObjectG;
32 private import gtk.AppChooserIF;
33 private import gtk.AppChooserT;
34 private import gtk.Dialog;
35 private import gtk.Widget;
36 private import gtk.Window;
37 private import gtk.c.functions;
38 public  import gtk.c.types;
39 
40 
41 /**
42  * `GtkAppChooserDialog` shows a `GtkAppChooserWidget` inside a `GtkDialog`.
43  * 
44  * ![An example GtkAppChooserDialog](appchooserdialog.png)
45  * 
46  * Note that `GtkAppChooserDialog` does not have any interesting methods
47  * of its own. Instead, you should get the embedded `GtkAppChooserWidget`
48  * using [method@Gtk.AppChooserDialog.get_widget] and call its methods if
49  * the generic [iface@Gtk.AppChooser] interface is not sufficient for
50  * your needs.
51  * 
52  * To set the heading that is shown above the `GtkAppChooserWidget`,
53  * use [method@Gtk.AppChooserDialog.set_heading].
54  */
55 public class AppChooserDialog : Dialog, AppChooserIF
56 {
57 	/** the main Gtk struct */
58 	protected GtkAppChooserDialog* gtkAppChooserDialog;
59 
60 	/** Get the main Gtk struct */
61 	public GtkAppChooserDialog* getAppChooserDialogStruct(bool transferOwnership = false)
62 	{
63 		if (transferOwnership)
64 			ownedRef = false;
65 		return gtkAppChooserDialog;
66 	}
67 
68 	/** the main Gtk struct as a void* */
69 	protected override void* getStruct()
70 	{
71 		return cast(void*)gtkAppChooserDialog;
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 	 *
96 	 * The dialog will show applications that can open the file.
97 	 *
98 	 * Params:
99 	 *     parent = a `GtkWindow`, or %NULL
100 	 *     flags = flags for this dialog
101 	 *     file = a `GFile`
102 	 *
103 	 * Returns: a newly created `GtkAppChooserDialog`
104 	 *
105 	 * Throws: ConstructionException GTK+ fails to create the object.
106 	 */
107 	public this(Window parent, GtkDialogFlags flags, FileIF file)
108 	{
109 		auto __p = gtk_app_chooser_dialog_new((parent is null) ? null : parent.getWindowStruct(), flags, (file is null) ? null : file.getFileStruct());
110 
111 		if(__p is null)
112 		{
113 			throw new ConstructionException("null returned by new");
114 		}
115 
116 		this(cast(GtkAppChooserDialog*) __p);
117 	}
118 
119 	/**
120 	 * Creates a new `GtkAppChooserDialog` for the provided content type.
121 	 *
122 	 * The dialog will show applications that can open the content type.
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 	 * Throws: ConstructionException GTK+ fails to create the object.
132 	 */
133 	public this(Window parent, GtkDialogFlags flags, string contentType)
134 	{
135 		auto __p = gtk_app_chooser_dialog_new_for_content_type((parent is null) ? null : parent.getWindowStruct(), flags, Str.toStringz(contentType));
136 
137 		if(__p is null)
138 		{
139 			throw new ConstructionException("null returned by new_for_content_type");
140 		}
141 
142 		this(cast(GtkAppChooserDialog*) __p);
143 	}
144 
145 	/**
146 	 * Returns the text to display at the top of the dialog.
147 	 *
148 	 * Returns: the text to display at the top of the dialog,
149 	 *     or %NULL, in which case a default text is displayed
150 	 */
151 	public string getHeading()
152 	{
153 		return Str.toString(gtk_app_chooser_dialog_get_heading(gtkAppChooserDialog));
154 	}
155 
156 	/**
157 	 * Returns the `GtkAppChooserWidget` of this dialog.
158 	 *
159 	 * Returns: the `GtkAppChooserWidget` of @self
160 	 */
161 	public Widget getWidget()
162 	{
163 		auto __p = gtk_app_chooser_dialog_get_widget(gtkAppChooserDialog);
164 
165 		if(__p is null)
166 		{
167 			return null;
168 		}
169 
170 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
171 	}
172 
173 	/**
174 	 * Sets the text to display at the top of the dialog.
175 	 *
176 	 * If the heading is not set, the dialog displays a default text.
177 	 *
178 	 * Params:
179 	 *     heading = a string containing Pango markup
180 	 */
181 	public void setHeading(string heading)
182 	{
183 		gtk_app_chooser_dialog_set_heading(gtkAppChooserDialog, Str.toStringz(heading));
184 	}
185 }