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.RecentChooserWidget;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Box;
30 private import gtk.RecentChooserIF;
31 private import gtk.RecentChooserT;
32 private import gtk.RecentManager;
33 private import gtk.Widget;
34 private import gtk.c.functions;
35 public  import gtk.c.types;
36 public  import gtkc.gtktypes;
37 
38 
39 /**
40  * #GtkRecentChooserWidget is a widget suitable for selecting recently used
41  * files.  It is the main building block of a #GtkRecentChooserDialog.  Most
42  * applications will only need to use the latter; you can use
43  * #GtkRecentChooserWidget as part of a larger window if you have special needs.
44  * 
45  * Note that #GtkRecentChooserWidget does not have any methods of its own.
46  * Instead, you should use the functions that work on a #GtkRecentChooser.
47  * 
48  * Recently used files are supported since GTK+ 2.10.
49  */
50 public class RecentChooserWidget : Box, RecentChooserIF
51 {
52 	/** the main Gtk struct */
53 	protected GtkRecentChooserWidget* gtkRecentChooserWidget;
54 
55 	/** Get the main Gtk struct */
56 	public GtkRecentChooserWidget* getRecentChooserWidgetStruct(bool transferOwnership = false)
57 	{
58 		if (transferOwnership)
59 			ownedRef = false;
60 		return gtkRecentChooserWidget;
61 	}
62 
63 	/** the main Gtk struct as a void* */
64 	protected override void* getStruct()
65 	{
66 		return cast(void*)gtkRecentChooserWidget;
67 	}
68 
69 	protected override void setStruct(GObject* obj)
70 	{
71 		gtkRecentChooserWidget = cast(GtkRecentChooserWidget*)obj;
72 		super.setStruct(obj);
73 	}
74 
75 	/**
76 	 * Sets our main struct and passes it to the parent class.
77 	 */
78 	public this (GtkRecentChooserWidget* gtkRecentChooserWidget, bool ownedRef = false)
79 	{
80 		this.gtkRecentChooserWidget = gtkRecentChooserWidget;
81 		super(cast(GtkBox*)gtkRecentChooserWidget, ownedRef);
82 	}
83 
84 	// add the RecentChooser capabilities
85 	mixin RecentChooserT!(GtkRecentChooserWidget);
86 
87 
88 	/** */
89 	public static GType getType()
90 	{
91 		return gtk_recent_chooser_widget_get_type();
92 	}
93 
94 	/**
95 	 * Creates a new #GtkRecentChooserWidget object.  This is an embeddable widget
96 	 * used to access the recently used resources list.
97 	 *
98 	 * Returns: a new #GtkRecentChooserWidget
99 	 *
100 	 * Since: 2.10
101 	 *
102 	 * Throws: ConstructionException GTK+ fails to create the object.
103 	 */
104 	public this()
105 	{
106 		auto p = gtk_recent_chooser_widget_new();
107 
108 		if(p is null)
109 		{
110 			throw new ConstructionException("null returned by new");
111 		}
112 
113 		this(cast(GtkRecentChooserWidget*) p);
114 	}
115 
116 	/**
117 	 * Creates a new #GtkRecentChooserWidget with a specified recent manager.
118 	 *
119 	 * This is useful if you have implemented your own recent manager, or if you
120 	 * have a customized instance of a #GtkRecentManager object.
121 	 *
122 	 * Params:
123 	 *     manager = a #GtkRecentManager
124 	 *
125 	 * Returns: a new #GtkRecentChooserWidget
126 	 *
127 	 * Since: 2.10
128 	 *
129 	 * Throws: ConstructionException GTK+ fails to create the object.
130 	 */
131 	public this(RecentManager manager)
132 	{
133 		auto p = gtk_recent_chooser_widget_new_for_manager((manager is null) ? null : manager.getRecentManagerStruct());
134 
135 		if(p is null)
136 		{
137 			throw new ConstructionException("null returned by new_for_manager");
138 		}
139 
140 		this(cast(GtkRecentChooserWidget*) p);
141 	}
142 }