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