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(bool transferOwnership = false) 67 { 68 if (transferOwnership) 69 ownedRef = false; 70 return gtkRecentChooserMenu; 71 } 72 73 /** the main Gtk struct as a void* */ 74 protected override void* getStruct() 75 { 76 return cast(void*)gtkRecentChooserMenu; 77 } 78 79 protected override void setStruct(GObject* obj) 80 { 81 gtkRecentChooserMenu = cast(GtkRecentChooserMenu*)obj; 82 super.setStruct(obj); 83 } 84 85 /** 86 * Sets our main struct and passes it to the parent class. 87 */ 88 public this (GtkRecentChooserMenu* gtkRecentChooserMenu, bool ownedRef = false) 89 { 90 this.gtkRecentChooserMenu = gtkRecentChooserMenu; 91 super(cast(GtkMenu*)gtkRecentChooserMenu, ownedRef); 92 } 93 94 // add the Activatable capabilities 95 mixin ActivatableT!(GtkRecentChooserMenu); 96 97 // add the RecentChooser capabilities 98 mixin RecentChooserT!(GtkRecentChooserMenu); 99 100 101 /** */ 102 public static GType getType() 103 { 104 return gtk_recent_chooser_menu_get_type(); 105 } 106 107 /** 108 * Creates a new #GtkRecentChooserMenu widget. 109 * 110 * This kind of widget shows the list of recently used resources as 111 * a menu, each item as a menu item. Each item inside the menu might 112 * have an icon, representing its MIME type, and a number, for mnemonic 113 * access. 114 * 115 * This widget implements the #GtkRecentChooser interface. 116 * 117 * This widget creates its own #GtkRecentManager object. See the 118 * gtk_recent_chooser_menu_new_for_manager() function to know how to create 119 * a #GtkRecentChooserMenu widget bound to another #GtkRecentManager object. 120 * 121 * Returns: a new #GtkRecentChooserMenu 122 * 123 * Since: 2.10 124 * 125 * Throws: ConstructionException GTK+ fails to create the object. 126 */ 127 public this() 128 { 129 auto p = gtk_recent_chooser_menu_new(); 130 131 if(p is null) 132 { 133 throw new ConstructionException("null returned by new"); 134 } 135 136 this(cast(GtkRecentChooserMenu*) p); 137 } 138 139 /** 140 * Creates a new #GtkRecentChooserMenu widget using @manager as 141 * the underlying recently used resources manager. 142 * 143 * This is useful if you have implemented your own recent manager, 144 * or if you have a customized instance of a #GtkRecentManager 145 * object or if you wish to share a common #GtkRecentManager object 146 * among multiple #GtkRecentChooser widgets. 147 * 148 * Params: 149 * manager = a #GtkRecentManager 150 * 151 * Returns: a new #GtkRecentChooserMenu, bound to @manager. 152 * 153 * Since: 2.10 154 * 155 * Throws: ConstructionException GTK+ fails to create the object. 156 */ 157 public this(RecentManager manager) 158 { 159 auto p = gtk_recent_chooser_menu_new_for_manager((manager is null) ? null : manager.getRecentManagerStruct()); 160 161 if(p is null) 162 { 163 throw new ConstructionException("null returned by new_for_manager"); 164 } 165 166 this(cast(GtkRecentChooserMenu*) p); 167 } 168 169 /** 170 * Returns the value set by gtk_recent_chooser_menu_set_show_numbers(). 171 * 172 * Returns: %TRUE if numbers should be shown. 173 * 174 * Since: 2.10 175 */ 176 public bool getShowNumbers() 177 { 178 return gtk_recent_chooser_menu_get_show_numbers(gtkRecentChooserMenu) != 0; 179 } 180 181 /** 182 * Sets whether a number should be added to the items of @menu. The 183 * numbers are shown to provide a unique character for a mnemonic to 184 * be used inside ten menu item’s label. Only the first the items 185 * get a number to avoid clashes. 186 * 187 * Params: 188 * showNumbers = whether to show numbers 189 * 190 * Since: 2.10 191 */ 192 public void setShowNumbers(bool showNumbers) 193 { 194 gtk_recent_chooser_menu_set_show_numbers(gtkRecentChooserMenu, showNumbers); 195 } 196 }