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  * 	- gtk_recent_action_new
46  * 	- gtk_recent_action_new_for_manager
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- gtk.RecentManager
51  * structWrap:
52  * 	- GtkRecentManager* -> RecentManager
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gtk.RecentAction;
59 
60 public  import gtkc.gtktypes;
61 
62 private import gtkc.gtk;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import glib.Str;
68 private import gtk.RecentManager;
69 
70 
71 
72 private import gtk.Action;
73 
74 /**
75  * Description
76  * A GtkRecentAction represents a list of recently used files, which
77  * can be shown by widgets such as GtkRecentChooserDialog or
78  * GtkRecentChooserMenu.
79  * To construct a submenu showing recently used files, use a GtkRecentAction
80  * as the action for a <menuitem>. To construct a menu toolbutton showing
81  * the recently used files in the popup menu, use a GtkRecentAction as the
82  * action for a <toolitem> element.
83  */
84 public class RecentAction : Action
85 {
86 	
87 	/** the main Gtk struct */
88 	protected GtkRecentAction* gtkRecentAction;
89 	
90 	
91 	public GtkRecentAction* getRecentActionStruct()
92 	{
93 		return gtkRecentAction;
94 	}
95 	
96 	
97 	/** the main Gtk struct as a void* */
98 	protected override void* getStruct()
99 	{
100 		return cast(void*)gtkRecentAction;
101 	}
102 	
103 	/**
104 	 * Sets our main struct and passes it to the parent class
105 	 */
106 	public this (GtkRecentAction* gtkRecentAction)
107 	{
108 		super(cast(GtkAction*)gtkRecentAction);
109 		this.gtkRecentAction = gtkRecentAction;
110 	}
111 	
112 	protected override void setStruct(GObject* obj)
113 	{
114 		super.setStruct(obj);
115 		gtkRecentAction = cast(GtkRecentAction*)obj;
116 	}
117 	
118 	/**
119 	 * Creates a new GtkRecentAction object. To add the action to
120 	 * a GtkActionGroup and set the accelerator for the action,
121 	 * call gtk_action_group_add_action_with_accel().
122 	 * Since 2.12
123 	 * Params:
124 	 * name =  a unique name for the action
125 	 * label =  the label displayed in menu items and on buttons, or NULL
126 	 * tooltip =  a tooltip for the action, or NULL
127 	 * stockID =  the stock icon to display in widgets representing the
128 	 *  action, or NULL
129 	 * Throws: ConstructionException GTK+ fails to create the object.
130 	 */
131 	public this (string name, string label, string tooltip, StockID stockID)
132 	{
133 		// GtkAction* gtk_recent_action_new (const gchar *name,  const gchar *label,  const gchar *tooltip,  const gchar *stock_id);
134 		auto p = gtk_recent_action_new(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(StockDesc[stockID]));
135 		if(p is null)
136 		{
137 			throw new ConstructionException("null returned by gtk_recent_action_new");
138 		}
139 		this(cast(GtkRecentAction*) p);
140 	}
141 	
142 	/**
143 	 * Creates a new GtkRecentAction object. To add the action to
144 	 * a GtkActionGroup and set the accelerator for the action,
145 	 * call gtk_action_group_add_action_with_accel().
146 	 * Since 2.12
147 	 * Params:
148 	 * name =  a unique name for the action
149 	 * label =  the label displayed in menu items and on buttons, or NULL
150 	 * tooltip =  a tooltip for the action, or NULL
151 	 * stockID =  the stock icon to display in widgets representing the
152 	 *  action, or NULL
153 	 * manager =  a GtkRecentManager, or NULL for using the default
154 	 *  GtkRecentManager
155 	 * Throws: ConstructionException GTK+ fails to create the object.
156 	 */
157 	public this (string name, string label, string tooltip, StockID stockID, RecentManager manager)
158 	{
159 		// GtkAction* gtk_recent_action_new_for_manager (const gchar *name,  const gchar *label,  const gchar *tooltip,  const gchar *stock_id,  GtkRecentManager *manager);
160 		auto p = gtk_recent_action_new_for_manager(Str.toStringz(name), Str.toStringz(label), Str.toStringz(tooltip), Str.toStringz(StockDesc[stockID]), (manager is null) ? null : manager.getRecentManagerStruct());
161 		if(p is null)
162 		{
163 			throw new ConstructionException("null returned by gtk_recent_action_new_for_manager");
164 		}
165 		this(cast(GtkRecentAction*) p);
166 	}
167 	
168 	/**
169 	 */
170 	
171 	/**
172 	 * Returns the value set by gtk_recent_chooser_menu_set_show_numbers().
173 	 * Since 2.12
174 	 * Returns: TRUE if numbers should be shown.
175 	 */
176 	public int getShowNumbers()
177 	{
178 		// gboolean gtk_recent_action_get_show_numbers (GtkRecentAction *action);
179 		return gtk_recent_action_get_show_numbers(gtkRecentAction);
180 	}
181 	
182 	/**
183 	 * Sets whether a number should be added to the items shown by the
184 	 * widgets representing action. The numbers are shown to provide
185 	 * a unique character for a mnemonic to be used inside the menu item's
186 	 * label. Only the first ten items get a number to avoid clashes.
187 	 * Since 2.12
188 	 * Params:
189 	 * showNumbers = TRUE if the shown items should be numbered
190 	 */
191 	public void setShowNumbers(int showNumbers)
192 	{
193 		// void gtk_recent_action_set_show_numbers (GtkRecentAction *action,  gboolean show_numbers);
194 		gtk_recent_action_set_show_numbers(gtkRecentAction, showNumbers);
195 	}
196 }