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.RecentChooserIF;
26 
27 private import glib.ErrorG;
28 private import glib.GException;
29 private import glib.ListG;
30 private import glib.ListSG;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 private import gobject.Signals;
34 private import gtk.RecentFilter;
35 private import gtk.RecentInfo;
36 private import gtk.c.functions;
37 public  import gtk.c.types;
38 public  import gtkc.gtktypes;
39 private import std.algorithm;
40 
41 
42 /**
43  * #GtkRecentChooser is an interface that can be implemented by widgets
44  * displaying the list of recently used files.  In GTK+, the main objects
45  * that implement this interface are #GtkRecentChooserWidget,
46  * #GtkRecentChooserDialog and #GtkRecentChooserMenu.
47  * 
48  * Recently used files are supported since GTK+ 2.10.
49  */
50 public interface RecentChooserIF{
51 	/** Get the main Gtk struct */
52 	public GtkRecentChooser* getRecentChooserStruct(bool transferOwnership = false);
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct();
56 
57 
58 	/** */
59 	public static GType getType()
60 	{
61 		return gtk_recent_chooser_get_type();
62 	}
63 
64 	/**
65 	 * Adds @filter to the list of #GtkRecentFilter objects held by @chooser.
66 	 *
67 	 * If no previous filter objects were defined, this function will call
68 	 * gtk_recent_chooser_set_filter().
69 	 *
70 	 * Params:
71 	 *     filter = a #GtkRecentFilter
72 	 *
73 	 * Since: 2.10
74 	 */
75 	public void addFilter(RecentFilter filter);
76 
77 	/**
78 	 * Gets the #GtkRecentInfo currently selected by @chooser.
79 	 *
80 	 * Returns: a #GtkRecentInfo.  Use gtk_recent_info_unref() when
81 	 *     when you have finished using it.
82 	 *
83 	 * Since: 2.10
84 	 */
85 	public RecentInfo getCurrentItem();
86 
87 	/**
88 	 * Gets the URI currently selected by @chooser.
89 	 *
90 	 * Returns: a newly allocated string holding a URI.
91 	 *
92 	 * Since: 2.10
93 	 */
94 	public string getCurrentUri();
95 
96 	/**
97 	 * Gets the #GtkRecentFilter object currently used by @chooser to affect
98 	 * the display of the recently used resources.
99 	 *
100 	 * Returns: a #GtkRecentFilter object.
101 	 *
102 	 * Since: 2.10
103 	 */
104 	public RecentFilter getFilter();
105 
106 	/**
107 	 * Gets the list of recently used resources in form of #GtkRecentInfo objects.
108 	 *
109 	 * The return value of this function is affected by the “sort-type” and
110 	 * “limit” properties of @chooser.
111 	 *
112 	 * Returns: A newly allocated
113 	 *     list of #GtkRecentInfo objects.  You should
114 	 *     use gtk_recent_info_unref() on every item of the list, and then free
115 	 *     the list itself using g_list_free().
116 	 *
117 	 * Since: 2.10
118 	 */
119 	public ListG getItems();
120 
121 	/**
122 	 * Gets the number of items returned by gtk_recent_chooser_get_items()
123 	 * and gtk_recent_chooser_get_uris().
124 	 *
125 	 * Returns: A positive integer, or -1 meaning that all items are
126 	 *     returned.
127 	 *
128 	 * Since: 2.10
129 	 */
130 	public int getLimit();
131 
132 	/**
133 	 * Gets whether only local resources should be shown in the recently used
134 	 * resources selector.  See gtk_recent_chooser_set_local_only()
135 	 *
136 	 * Returns: %TRUE if only local resources should be shown.
137 	 *
138 	 * Since: 2.10
139 	 */
140 	public bool getLocalOnly();
141 
142 	/**
143 	 * Gets whether @chooser can select multiple items.
144 	 *
145 	 * Returns: %TRUE if @chooser can select more than one item.
146 	 *
147 	 * Since: 2.10
148 	 */
149 	public bool getSelectMultiple();
150 
151 	/**
152 	 * Retrieves whether @chooser should show an icon near the resource.
153 	 *
154 	 * Returns: %TRUE if the icons should be displayed, %FALSE otherwise.
155 	 *
156 	 * Since: 2.10
157 	 */
158 	public bool getShowIcons();
159 
160 	/**
161 	 * Retrieves whether @chooser should show the recently used resources that
162 	 * were not found.
163 	 *
164 	 * Returns: %TRUE if the resources not found should be displayed, and
165 	 *     %FALSE otheriwse.
166 	 *
167 	 * Since: 2.10
168 	 */
169 	public bool getShowNotFound();
170 
171 	/**
172 	 * Returns whether @chooser should display recently used resources
173 	 * registered as private.
174 	 *
175 	 * Returns: %TRUE if the recent chooser should show private items,
176 	 *     %FALSE otherwise.
177 	 *
178 	 * Since: 2.10
179 	 */
180 	public bool getShowPrivate();
181 
182 	/**
183 	 * Gets whether @chooser should display tooltips containing the full path
184 	 * of a recently user resource.
185 	 *
186 	 * Returns: %TRUE if the recent chooser should show tooltips,
187 	 *     %FALSE otherwise.
188 	 *
189 	 * Since: 2.10
190 	 */
191 	public bool getShowTips();
192 
193 	/**
194 	 * Gets the value set by gtk_recent_chooser_set_sort_type().
195 	 *
196 	 * Returns: the sorting order of the @chooser.
197 	 *
198 	 * Since: 2.10
199 	 */
200 	public GtkRecentSortType getSortType();
201 
202 	/**
203 	 * Gets the URI of the recently used resources.
204 	 *
205 	 * The return value of this function is affected by the “sort-type” and “limit”
206 	 * properties of @chooser.
207 	 *
208 	 * Since the returned array is %NULL terminated, @length may be %NULL.
209 	 *
210 	 * Returns: A newly allocated, %NULL-terminated array of strings. Use
211 	 *     g_strfreev() to free it.
212 	 *
213 	 * Since: 2.10
214 	 */
215 	public string[] getUris();
216 
217 	/**
218 	 * Gets the #GtkRecentFilter objects held by @chooser.
219 	 *
220 	 * Returns: A singly linked list
221 	 *     of #GtkRecentFilter objects.  You
222 	 *     should just free the returned list using g_slist_free().
223 	 *
224 	 * Since: 2.10
225 	 */
226 	public ListSG listFilters();
227 
228 	/**
229 	 * Removes @filter from the list of #GtkRecentFilter objects held by @chooser.
230 	 *
231 	 * Params:
232 	 *     filter = a #GtkRecentFilter
233 	 *
234 	 * Since: 2.10
235 	 */
236 	public void removeFilter(RecentFilter filter);
237 
238 	/**
239 	 * Selects all the items inside @chooser, if the @chooser supports
240 	 * multiple selection.
241 	 *
242 	 * Since: 2.10
243 	 */
244 	public void selectAll();
245 
246 	/**
247 	 * Selects @uri inside @chooser.
248 	 *
249 	 * Params:
250 	 *     uri = a URI
251 	 *
252 	 * Returns: %TRUE if @uri was found.
253 	 *
254 	 * Since: 2.10
255 	 *
256 	 * Throws: GException on failure.
257 	 */
258 	public bool selectUri(string uri);
259 
260 	/**
261 	 * Sets @uri as the current URI for @chooser.
262 	 *
263 	 * Params:
264 	 *     uri = a URI
265 	 *
266 	 * Returns: %TRUE if the URI was found.
267 	 *
268 	 * Since: 2.10
269 	 *
270 	 * Throws: GException on failure.
271 	 */
272 	public bool setCurrentUri(string uri);
273 
274 	/**
275 	 * Sets @filter as the current #GtkRecentFilter object used by @chooser
276 	 * to affect the displayed recently used resources.
277 	 *
278 	 * Params:
279 	 *     filter = a #GtkRecentFilter
280 	 *
281 	 * Since: 2.10
282 	 */
283 	public void setFilter(RecentFilter filter);
284 
285 	/**
286 	 * Sets the number of items that should be returned by
287 	 * gtk_recent_chooser_get_items() and gtk_recent_chooser_get_uris().
288 	 *
289 	 * Params:
290 	 *     limit = a positive integer, or -1 for all items
291 	 *
292 	 * Since: 2.10
293 	 */
294 	public void setLimit(int limit);
295 
296 	/**
297 	 * Sets whether only local resources, that is resources using the file:// URI
298 	 * scheme, should be shown in the recently used resources selector.  If
299 	 * @local_only is %TRUE (the default) then the shown resources are guaranteed
300 	 * to be accessible through the operating system native file system.
301 	 *
302 	 * Params:
303 	 *     localOnly = %TRUE if only local files can be shown
304 	 *
305 	 * Since: 2.10
306 	 */
307 	public void setLocalOnly(bool localOnly);
308 
309 	/**
310 	 * Sets whether @chooser can select multiple items.
311 	 *
312 	 * Params:
313 	 *     selectMultiple = %TRUE if @chooser can select more than one item
314 	 *
315 	 * Since: 2.10
316 	 */
317 	public void setSelectMultiple(bool selectMultiple);
318 
319 	/**
320 	 * Sets whether @chooser should show an icon near the resource when
321 	 * displaying it.
322 	 *
323 	 * Params:
324 	 *     showIcons = whether to show an icon near the resource
325 	 *
326 	 * Since: 2.10
327 	 */
328 	public void setShowIcons(bool showIcons);
329 
330 	/**
331 	 * Sets whether @chooser should display the recently used resources that
332 	 * it didn’t find.  This only applies to local resources.
333 	 *
334 	 * Params:
335 	 *     showNotFound = whether to show the local items we didn’t find
336 	 *
337 	 * Since: 2.10
338 	 */
339 	public void setShowNotFound(bool showNotFound);
340 
341 	/**
342 	 * Whether to show recently used resources marked registered as private.
343 	 *
344 	 * Params:
345 	 *     showPrivate = %TRUE to show private items, %FALSE otherwise
346 	 *
347 	 * Since: 2.10
348 	 */
349 	public void setShowPrivate(bool showPrivate);
350 
351 	/**
352 	 * Sets whether to show a tooltips containing the full path of each
353 	 * recently used resource in a #GtkRecentChooser widget.
354 	 *
355 	 * Params:
356 	 *     showTips = %TRUE if tooltips should be shown
357 	 *
358 	 * Since: 2.10
359 	 */
360 	public void setShowTips(bool showTips);
361 
362 	/**
363 	 * Sets the comparison function used when sorting to be @sort_func.  If
364 	 * the @chooser has the sort type set to #GTK_RECENT_SORT_CUSTOM then
365 	 * the chooser will sort using this function.
366 	 *
367 	 * To the comparison function will be passed two #GtkRecentInfo structs and
368 	 * @sort_data;  @sort_func should return a positive integer if the first
369 	 * item comes before the second, zero if the two items are equal and
370 	 * a negative integer if the first item comes after the second.
371 	 *
372 	 * Params:
373 	 *     sortFunc = the comparison function
374 	 *     sortData = user data to pass to @sort_func, or %NULL
375 	 *     dataDestroy = destroy notifier for @sort_data, or %NULL
376 	 *
377 	 * Since: 2.10
378 	 */
379 	public void setSortFunc(GtkRecentSortFunc sortFunc, void* sortData, GDestroyNotify dataDestroy);
380 
381 	/**
382 	 * Changes the sorting order of the recently used resources list displayed by
383 	 * @chooser.
384 	 *
385 	 * Params:
386 	 *     sortType = sort order that the chooser should use
387 	 *
388 	 * Since: 2.10
389 	 */
390 	public void setSortType(GtkRecentSortType sortType);
391 
392 	/**
393 	 * Unselects all the items inside @chooser.
394 	 *
395 	 * Since: 2.10
396 	 */
397 	public void unselectAll();
398 
399 	/**
400 	 * Unselects @uri inside @chooser.
401 	 *
402 	 * Params:
403 	 *     uri = a URI
404 	 *
405 	 * Since: 2.10
406 	 */
407 	public void unselectUri(string uri);
408 
409 	/**
410 	 * This signal is emitted when the user "activates" a recent item
411 	 * in the recent chooser.  This can happen by double-clicking on an item
412 	 * in the recently used resources list, or by pressing
413 	 * `Enter`.
414 	 *
415 	 * Since: 2.10
416 	 */
417 	gulong addOnItemActivated(void delegate(RecentChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
418 
419 	/**
420 	 * This signal is emitted when there is a change in the set of
421 	 * selected recently used resources.  This can happen when a user
422 	 * modifies the selection with the mouse or the keyboard, or when
423 	 * explicitly calling functions to change the selection.
424 	 *
425 	 * Since: 2.10
426 	 */
427 	gulong addOnSelectionChanged(void delegate(RecentChooserIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0);
428 }