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