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