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