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