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.FileChooserWidget;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.Box;
32 private import gtk.FileChooserIF;
33 private import gtk.FileChooserT;
34 private import gtk.Widget;
35 private import gtk.c.functions;
36 public  import gtk.c.types;
37 public  import gtkc.gtktypes;
38 private import std.algorithm;
39 
40 
41 /**
42  * #GtkFileChooserWidget is a widget for choosing files.
43  * It exposes the #GtkFileChooser interface, and you should
44  * use the methods of this interface to interact with the
45  * widget.
46  * 
47  * # CSS nodes
48  * 
49  * GtkFileChooserWidget has a single CSS node with name filechooser.
50  */
51 public class FileChooserWidget : Box, FileChooserIF
52 {
53 	/** the main Gtk struct */
54 	protected GtkFileChooserWidget* gtkFileChooserWidget;
55 
56 	/** Get the main Gtk struct */
57 	public GtkFileChooserWidget* getFileChooserWidgetStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gtkFileChooserWidget;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gtkFileChooserWidget;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GtkFileChooserWidget* gtkFileChooserWidget, bool ownedRef = false)
74 	{
75 		this.gtkFileChooserWidget = gtkFileChooserWidget;
76 		super(cast(GtkBox*)gtkFileChooserWidget, ownedRef);
77 	}
78 
79 	// add the FileChooser capabilities
80 	mixin FileChooserT!(GtkFileChooserWidget);
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_file_chooser_widget_get_type();
87 	}
88 
89 	/**
90 	 * Creates a new #GtkFileChooserWidget. This is a file chooser widget that can
91 	 * be embedded in custom windows, and it is the same widget that is used by
92 	 * #GtkFileChooserDialog.
93 	 *
94 	 * Params:
95 	 *     action = Open or save mode for the widget
96 	 *
97 	 * Returns: a new #GtkFileChooserWidget
98 	 *
99 	 * Since: 2.4
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(GtkFileChooserAction action)
104 	{
105 		auto p = gtk_file_chooser_widget_new(action);
106 
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 
112 		this(cast(GtkFileChooserWidget*) p);
113 	}
114 
115 	/**
116 	 * The ::desktop-folder signal is a [keybinding signal][GtkBindingSignal]
117 	 * which gets emitted when the user asks for it.
118 	 *
119 	 * This is used to make the file chooser show the user's Desktop
120 	 * folder in the file list.
121 	 *
122 	 * The default binding for this signal is `Alt + D`.
123 	 */
124 	gulong addOnDesktopFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
125 	{
126 		return Signals.connect(this, "desktop-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED);
127 	}
128 
129 	/**
130 	 * The ::down-folder signal is a [keybinding signal][GtkBindingSignal]
131 	 * which gets emitted when the user asks for it.
132 	 *
133 	 * This is used to make the file chooser go to a child of the current folder
134 	 * in the file hierarchy. The subfolder that will be used is displayed in the
135 	 * path bar widget of the file chooser. For example, if the path bar is showing
136 	 * "/foo/bar/baz", with bar currently displayed, then this will cause the file
137 	 * chooser to switch to the "baz" subfolder.
138 	 *
139 	 * The default binding for this signal is `Alt + Down`.
140 	 */
141 	gulong addOnDownFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
142 	{
143 		return Signals.connect(this, "down-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED);
144 	}
145 
146 	/**
147 	 * The ::home-folder signal is a [keybinding signal][GtkBindingSignal]
148 	 * which gets emitted when the user asks for it.
149 	 *
150 	 * This is used to make the file chooser show the user's home
151 	 * folder in the file list.
152 	 *
153 	 * The default binding for this signal is `Alt + Home`.
154 	 */
155 	gulong addOnHomeFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
156 	{
157 		return Signals.connect(this, "home-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED);
158 	}
159 
160 	/**
161 	 * The ::location-popup signal is a [keybinding signal][GtkBindingSignal]
162 	 * which gets emitted when the user asks for it.
163 	 *
164 	 * This is used to make the file chooser show a "Location" prompt which
165 	 * the user can use to manually type the name of the file he wishes to select.
166 	 *
167 	 * The default bindings for this signal are `Control + L` with a @path string
168 	 * of "" (the empty string).  It is also bound to `/` with a @path string of
169 	 * "`/`" (a slash):  this lets you type `/` and immediately type a path name.
170 	 * On Unix systems, this is bound to `~` (tilde) with a @path string of "~"
171 	 * itself for access to home directories.
172 	 *
173 	 * Params:
174 	 *     path = a string that gets put in the text entry for the file name
175 	 */
176 	gulong addOnLocationPopup(void delegate(string, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
177 	{
178 		return Signals.connect(this, "location-popup", dlg, connectFlags ^ ConnectFlags.SWAPPED);
179 	}
180 
181 	/**
182 	 * The ::location-popup-on-paste signal is a [keybinding signal][GtkBindingSignal]
183 	 * which gets emitted when the user asks for it.
184 	 *
185 	 * This is used to make the file chooser show a "Location" prompt when the user
186 	 * pastes into a #GtkFileChooserWidget.
187 	 *
188 	 * The default binding for this signal is `Control + V`.
189 	 */
190 	gulong addOnLocationPopupOnPaste(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
191 	{
192 		return Signals.connect(this, "location-popup-on-paste", dlg, connectFlags ^ ConnectFlags.SWAPPED);
193 	}
194 
195 	/**
196 	 * The ::location-toggle-popup signal is a [keybinding signal][GtkBindingSignal]
197 	 * which gets emitted when the user asks for it.
198 	 *
199 	 * This is used to toggle the visibility of a "Location" prompt which the user
200 	 * can use to manually type the name of the file he wishes to select.
201 	 *
202 	 * The default binding for this signal is `Control + L`.
203 	 */
204 	gulong addOnLocationTogglePopup(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
205 	{
206 		return Signals.connect(this, "location-toggle-popup", dlg, connectFlags ^ ConnectFlags.SWAPPED);
207 	}
208 
209 	/**
210 	 * The ::places-shortcut signal is a [keybinding signal][GtkBindingSignal]
211 	 * which gets emitted when the user asks for it.
212 	 *
213 	 * This is used to move the focus to the places sidebar.
214 	 *
215 	 * The default binding for this signal is `Alt + P`.
216 	 */
217 	gulong addOnPlacesShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
218 	{
219 		return Signals.connect(this, "places-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED);
220 	}
221 
222 	/**
223 	 * The ::quick-bookmark signal is a [keybinding signal][GtkBindingSignal]
224 	 * which gets emitted when the user asks for it.
225 	 *
226 	 * This is used to make the file chooser switch to the bookmark specified
227 	 * in the @bookmark_index parameter. For example, if you have three bookmarks,
228 	 * you can pass 0, 1, 2 to this signal to switch to each of them, respectively.
229 	 *
230 	 * The default binding for this signal is `Alt + 1`, `Alt + 2`,
231 	 * etc. until `Alt + 0`.  Note that in the default binding, that
232 	 * `Alt + 1` is actually defined to switch to the bookmark at index
233 	 * 0, and so on successively; `Alt + 0` is defined to switch to the
234 	 * bookmark at index 10.
235 	 *
236 	 * Params:
237 	 *     bookmarkIndex = the number of the bookmark to switch to
238 	 */
239 	gulong addOnQuickBookmark(void delegate(int, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
240 	{
241 		return Signals.connect(this, "quick-bookmark", dlg, connectFlags ^ ConnectFlags.SWAPPED);
242 	}
243 
244 	/**
245 	 * The ::recent-shortcut signal is a [keybinding signal][GtkBindingSignal]
246 	 * which gets emitted when the user asks for it.
247 	 *
248 	 * This is used to make the file chooser show the Recent location.
249 	 *
250 	 * The default binding for this signal is `Alt + R`.
251 	 */
252 	gulong addOnRecentShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
253 	{
254 		return Signals.connect(this, "recent-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED);
255 	}
256 
257 	/**
258 	 * The ::search-shortcut signal is a [keybinding signal][GtkBindingSignal]
259 	 * which gets emitted when the user asks for it.
260 	 *
261 	 * This is used to make the file chooser show the search entry.
262 	 *
263 	 * The default binding for this signal is `Alt + S`.
264 	 */
265 	gulong addOnSearchShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
266 	{
267 		return Signals.connect(this, "search-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED);
268 	}
269 
270 	/**
271 	 * The ::show-hidden signal is a [keybinding signal][GtkBindingSignal]
272 	 * which gets emitted when the user asks for it.
273 	 *
274 	 * This is used to make the file chooser display hidden files.
275 	 *
276 	 * The default binding for this signal is `Control + H`.
277 	 */
278 	gulong addOnShowHidden(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
279 	{
280 		return Signals.connect(this, "show-hidden", dlg, connectFlags ^ ConnectFlags.SWAPPED);
281 	}
282 
283 	/**
284 	 * The ::up-folder signal is a [keybinding signal][GtkBindingSignal]
285 	 * which gets emitted when the user asks for it.
286 	 *
287 	 * This is used to make the file chooser go to the parent of the current folder
288 	 * in the file hierarchy.
289 	 *
290 	 * The default binding for this signal is `Alt + Up`.
291 	 */
292 	gulong addOnUpFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
293 	{
294 		return Signals.connect(this, "up-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED);
295 	}
296 }