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.RecentChooserMenu;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.ActivatableIF;
30 private import gtk.ActivatableT;
31 private import gtk.Menu;
32 private import gtk.RecentChooserIF;
33 private import gtk.RecentChooserT;
34 private import gtk.RecentManager;
35 private import gtk.Widget;
36 private import gtk.c.functions;
37 public  import gtk.c.types;
38 public  import gtkc.gtktypes;
39 
40 
41 /**
42  * #GtkRecentChooserMenu is a widget suitable for displaying recently used files
43  * inside a menu.  It can be used to set a sub-menu of a #GtkMenuItem using
44  * gtk_menu_item_set_submenu(), or as the menu of a #GtkMenuToolButton.
45  * 
46  * Note that #GtkRecentChooserMenu does not have any methods of its own. Instead,
47  * you should use the functions that work on a #GtkRecentChooser.
48  * 
49  * Note also that #GtkRecentChooserMenu does not support multiple filters, as it
50  * has no way to let the user choose between them as the #GtkRecentChooserWidget
51  * and #GtkRecentChooserDialog widgets do. Thus using gtk_recent_chooser_add_filter()
52  * on a #GtkRecentChooserMenu widget will yield the same effects as using
53  * gtk_recent_chooser_set_filter(), replacing any currently set filter
54  * with the supplied filter; gtk_recent_chooser_remove_filter() will remove
55  * any currently set #GtkRecentFilter object and will unset the current filter;
56  * gtk_recent_chooser_list_filters() will return a list containing a single
57  * #GtkRecentFilter object.
58  * 
59  * Recently used files are supported since GTK+ 2.10.
60  */
61 public class RecentChooserMenu : Menu, ActivatableIF, RecentChooserIF
62 {
63 	/** the main Gtk struct */
64 	protected GtkRecentChooserMenu* gtkRecentChooserMenu;
65 
66 	/** Get the main Gtk struct */
67 	public GtkRecentChooserMenu* getRecentChooserMenuStruct(bool transferOwnership = false)
68 	{
69 		if (transferOwnership)
70 			ownedRef = false;
71 		return gtkRecentChooserMenu;
72 	}
73 
74 	/** the main Gtk struct as a void* */
75 	protected override void* getStruct()
76 	{
77 		return cast(void*)gtkRecentChooserMenu;
78 	}
79 
80 	/**
81 	 * Sets our main struct and passes it to the parent class.
82 	 */
83 	public this (GtkRecentChooserMenu* gtkRecentChooserMenu, bool ownedRef = false)
84 	{
85 		this.gtkRecentChooserMenu = gtkRecentChooserMenu;
86 		super(cast(GtkMenu*)gtkRecentChooserMenu, ownedRef);
87 	}
88 
89 	// add the Activatable capabilities
90 	mixin ActivatableT!(GtkRecentChooserMenu);
91 
92 	// add the RecentChooser capabilities
93 	mixin RecentChooserT!(GtkRecentChooserMenu);
94 
95 
96 	/** */
97 	public static GType getType()
98 	{
99 		return gtk_recent_chooser_menu_get_type();
100 	}
101 
102 	/**
103 	 * Creates a new #GtkRecentChooserMenu widget.
104 	 *
105 	 * This kind of widget shows the list of recently used resources as
106 	 * a menu, each item as a menu item.  Each item inside the menu might
107 	 * have an icon, representing its MIME type, and a number, for mnemonic
108 	 * access.
109 	 *
110 	 * This widget implements the #GtkRecentChooser interface.
111 	 *
112 	 * This widget creates its own #GtkRecentManager object.  See the
113 	 * gtk_recent_chooser_menu_new_for_manager() function to know how to create
114 	 * a #GtkRecentChooserMenu widget bound to another #GtkRecentManager object.
115 	 *
116 	 * Returns: a new #GtkRecentChooserMenu
117 	 *
118 	 * Since: 2.10
119 	 *
120 	 * Throws: ConstructionException GTK+ fails to create the object.
121 	 */
122 	public this()
123 	{
124 		auto p = gtk_recent_chooser_menu_new();
125 
126 		if(p is null)
127 		{
128 			throw new ConstructionException("null returned by new");
129 		}
130 
131 		this(cast(GtkRecentChooserMenu*) p);
132 	}
133 
134 	/**
135 	 * Creates a new #GtkRecentChooserMenu widget using @manager as
136 	 * the underlying recently used resources manager.
137 	 *
138 	 * This is useful if you have implemented your own recent manager,
139 	 * or if you have a customized instance of a #GtkRecentManager
140 	 * object or if you wish to share a common #GtkRecentManager object
141 	 * among multiple #GtkRecentChooser widgets.
142 	 *
143 	 * Params:
144 	 *     manager = a #GtkRecentManager
145 	 *
146 	 * Returns: a new #GtkRecentChooserMenu, bound to @manager.
147 	 *
148 	 * Since: 2.10
149 	 *
150 	 * Throws: ConstructionException GTK+ fails to create the object.
151 	 */
152 	public this(RecentManager manager)
153 	{
154 		auto p = gtk_recent_chooser_menu_new_for_manager((manager is null) ? null : manager.getRecentManagerStruct());
155 
156 		if(p is null)
157 		{
158 			throw new ConstructionException("null returned by new_for_manager");
159 		}
160 
161 		this(cast(GtkRecentChooserMenu*) p);
162 	}
163 
164 	/**
165 	 * Returns the value set by gtk_recent_chooser_menu_set_show_numbers().
166 	 *
167 	 * Returns: %TRUE if numbers should be shown.
168 	 *
169 	 * Since: 2.10
170 	 */
171 	public bool getShowNumbers()
172 	{
173 		return gtk_recent_chooser_menu_get_show_numbers(gtkRecentChooserMenu) != 0;
174 	}
175 
176 	/**
177 	 * Sets whether a number should be added to the items of @menu.  The
178 	 * numbers are shown to provide a unique character for a mnemonic to
179 	 * be used inside ten menu item’s label.  Only the first the items
180 	 * get a number to avoid clashes.
181 	 *
182 	 * Params:
183 	 *     showNumbers = whether to show numbers
184 	 *
185 	 * Since: 2.10
186 	 */
187 	public void setShowNumbers(bool showNumbers)
188 	{
189 		gtk_recent_chooser_menu_set_show_numbers(gtkRecentChooserMenu, showNumbers);
190 	}
191 }