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