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