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