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