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.RecentAction; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.Action; 31 private import gtk.RecentChooserIF; 32 private import gtk.RecentChooserT; 33 private import gtk.RecentManager; 34 private import gtkc.gtk; 35 public import gtkc.gtktypes; 36 37 38 /** 39 * A #GtkRecentAction represents a list of recently used files, which 40 * can be shown by widgets such as #GtkRecentChooserDialog or 41 * #GtkRecentChooserMenu. 42 * 43 * To construct a submenu showing recently used files, use a #GtkRecentAction 44 * as the action for a <menuitem>. To construct a menu toolbutton showing 45 * the recently used files in the popup menu, use a #GtkRecentAction as the 46 * action for a <toolitem> element. 47 */ 48 public class RecentAction : Action, RecentChooserIF 49 { 50 /** the main Gtk struct */ 51 protected GtkRecentAction* gtkRecentAction; 52 53 /** Get the main Gtk struct */ 54 public GtkRecentAction* getRecentActionStruct(bool transferOwnership = false) 55 { 56 if (transferOwnership) 57 ownedRef = false; 58 return gtkRecentAction; 59 } 60 61 /** the main Gtk struct as a void* */ 62 protected override void* getStruct() 63 { 64 return cast(void*)gtkRecentAction; 65 } 66 67 protected override void setStruct(GObject* obj) 68 { 69 gtkRecentAction = cast(GtkRecentAction*)obj; 70 super.setStruct(obj); 71 } 72 73 /** 74 * Sets our main struct and passes it to the parent class. 75 */ 76 public this (GtkRecentAction* gtkRecentAction, bool ownedRef = false) 77 { 78 this.gtkRecentAction = gtkRecentAction; 79 super(cast(GtkAction*)gtkRecentAction, ownedRef); 80 } 81 82 // add the RecentChooser capabilities 83 mixin RecentChooserT!(GtkRecentAction); 84 85 /** 86 * Creates a new RecentAction object. To add the action to 87 * a ActionGroup and set the accelerator for the action, 88 * call gtk.ActionGroup.ActionGroup.addActionwWithAccel(). 89 * 90 * Since: 2.12 91 * 92 * Params: 93 * name = a unique name for the action 94 * label = the label displayed in menu items and on buttons, or null 95 * tooltip = a tooltip for the action, or null 96 * stockID = the stock icon to display in widgets representing the 97 * action, or null 98 * Throws: ConstructionException GTK+ fails to create the object. 99 */ 100 public this (string name, string label, string tooltip, StockID stockID) 101 { 102 this(name, label, tooltip, cast(string)stockID); 103 } 104 105 /** 106 * Creates a new RecentAction object. To add the action to 107 * a ActionGroup and set the accelerator for the action, 108 * call gtk.ActionGroup.ActionGroup.addActionwWithAccel(). 109 * 110 * Since: 2.12 111 * 112 * Params: 113 * name = a unique name for the action 114 * label = the label displayed in menu items and on buttons, or null 115 * tooltip = a tooltip for the action, or null 116 * stockID = the stock icon to display in widgets representing the 117 * action, or null 118 * manager = a GtkRecentManager, or null for using the default 119 * RecentManager 120 * Throws: ConstructionException GTK+ fails to create the object. 121 */ 122 public this (string name, string label, string tooltip, StockID stockID, RecentManager manager) 123 { 124 this(name, label, tooltip, cast(string)stockID, manager); 125 } 126 127 /** 128 */ 129 130 /** */ 131 public static GType getType() 132 { 133 return gtk_recent_action_get_type(); 134 } 135 136 /** 137 * Creates a new #GtkRecentAction object. To add the action to 138 * a #GtkActionGroup and set the accelerator for the action, 139 * call gtk_action_group_add_action_with_accel(). 140 * 141 * Params: 142 * name = a unique name for the action 143 * label = the label displayed in menu items and on buttons, 144 * or %NULL 145 * tooltip = a tooltip for the action, or %NULL 146 * stockId = the stock icon to display in widgets representing 147 * the action, or %NULL 148 * 149 * Returns: the newly created #GtkRecentAction. 150 * 151 * Since: 2.12 152 * 153 * Throws: ConstructionException GTK+ fails to create the object. 154 */ 155 public this(string name, string label, string tooltip, string stockId) 156 { 157 auto p = gtk_recent_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId)); 158 159 if(p is null) 160 { 161 throw new ConstructionException("null returned by new"); 162 } 163 164 this(cast(GtkRecentAction*) p, true); 165 } 166 167 /** 168 * Creates a new #GtkRecentAction object. To add the action to 169 * a #GtkActionGroup and set the accelerator for the action, 170 * call gtk_action_group_add_action_with_accel(). 171 * 172 * Params: 173 * name = a unique name for the action 174 * label = the label displayed in menu items and on buttons, 175 * or %NULL 176 * tooltip = a tooltip for the action, or %NULL 177 * stockId = the stock icon to display in widgets representing 178 * the action, or %NULL 179 * manager = a #GtkRecentManager, or %NULL for using the default 180 * #GtkRecentManager 181 * 182 * Returns: the newly created #GtkRecentAction 183 * 184 * Since: 2.12 185 * 186 * Throws: ConstructionException GTK+ fails to create the object. 187 */ 188 public this(string name, string label, string tooltip, string stockId, RecentManager manager) 189 { 190 auto p = gtk_recent_action_new_for_manager(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(stockId), (manager is null) ? null : manager.getRecentManagerStruct()); 191 192 if(p is null) 193 { 194 throw new ConstructionException("null returned by new_for_manager"); 195 } 196 197 this(cast(GtkRecentAction*) p, true); 198 } 199 200 /** 201 * Returns the value set by gtk_recent_chooser_menu_set_show_numbers(). 202 * 203 * Returns: %TRUE if numbers should be shown. 204 * 205 * Since: 2.12 206 */ 207 public bool getShowNumbers() 208 { 209 return gtk_recent_action_get_show_numbers(gtkRecentAction) != 0; 210 } 211 212 /** 213 * Sets whether a number should be added to the items shown by the 214 * widgets representing @action. The numbers are shown to provide 215 * a unique character for a mnemonic to be used inside the menu item's 216 * label. Only the first ten items get a number to avoid clashes. 217 * 218 * Params: 219 * showNumbers = %TRUE if the shown items should be numbered 220 * 221 * Since: 2.12 222 */ 223 public void setShowNumbers(bool showNumbers) 224 { 225 gtk_recent_action_set_show_numbers(gtkRecentAction, showNumbers); 226 } 227 }