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 gio.SimpleActionGroup;
26 
27 private import gio.Action;
28 private import gio.ActionGroupIF;
29 private import gio.ActionGroupT;
30 private import gio.ActionIF;
31 private import gio.ActionMapIF;
32 private import gio.ActionMapT;
33 private import glib.ConstructionException;
34 private import glib.Str;
35 private import gobject.ObjectG;
36 private import gtkc.gio;
37 public  import gtkc.giotypes;
38 
39 
40 /**
41  * #GSimpleActionGroup is a hash table filled with #GAction objects,
42  * implementing the #GActionGroup and #GActionMap interfaces.
43  *
44  * Since: 2.28
45  */
46 public class SimpleActionGroup : ObjectG, ActionGroupIF, ActionMapIF
47 {
48 	/** the main Gtk struct */
49 	protected GSimpleActionGroup* gSimpleActionGroup;
50 
51 	/** Get the main Gtk struct */
52 	public GSimpleActionGroup* getSimpleActionGroupStruct()
53 	{
54 		return gSimpleActionGroup;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected override void* getStruct()
59 	{
60 		return cast(void*)gSimpleActionGroup;
61 	}
62 
63 	protected override void setStruct(GObject* obj)
64 	{
65 		gSimpleActionGroup = cast(GSimpleActionGroup*)obj;
66 		super.setStruct(obj);
67 	}
68 
69 	/**
70 	 * Sets our main struct and passes it to the parent class.
71 	 */
72 	public this (GSimpleActionGroup* gSimpleActionGroup, bool ownedRef = false)
73 	{
74 		this.gSimpleActionGroup = gSimpleActionGroup;
75 		super(cast(GObject*)gSimpleActionGroup, ownedRef);
76 	}
77 
78 	// add the ActionGroup capabilities
79 	mixin ActionGroupT!(GSimpleActionGroup);
80 
81 	// add the ActionMap capabilities
82 	mixin ActionMapT!(GSimpleActionGroup);
83 
84 
85 	/** */
86 	public static GType getType()
87 	{
88 		return g_simple_action_group_get_type();
89 	}
90 
91 	/**
92 	 * Creates a new, empty, #GSimpleActionGroup.
93 	 *
94 	 * Returns: a new #GSimpleActionGroup
95 	 *
96 	 * Since: 2.28
97 	 *
98 	 * Throws: ConstructionException GTK+ fails to create the object.
99 	 */
100 	public this()
101 	{
102 		auto p = g_simple_action_group_new();
103 		
104 		if(p is null)
105 		{
106 			throw new ConstructionException("null returned by new");
107 		}
108 		
109 		this(cast(GSimpleActionGroup*) p, true);
110 	}
111 
112 	/**
113 	 * A convenience function for creating multiple #GSimpleAction instances
114 	 * and adding them to the action group.
115 	 *
116 	 * Deprecated: Use g_action_map_add_action_entries()
117 	 *
118 	 * Params:
119 	 *     entries = a pointer to the first item in
120 	 *         an array of #GActionEntry structs
121 	 *     nEntries = the length of @entries, or -1
122 	 *     userData = the user data for signal connections
123 	 *
124 	 * Since: 2.30
125 	 */
126 	public void addEntries(GActionEntry[] entries, void* userData)
127 	{
128 		g_simple_action_group_add_entries(gSimpleActionGroup, entries.ptr, cast(int)entries.length, userData);
129 	}
130 
131 	/**
132 	 * Adds an action to the action group.
133 	 *
134 	 * If the action group already contains an action with the same name as
135 	 * @action then the old action is dropped from the group.
136 	 *
137 	 * The action group takes its own reference on @action.
138 	 *
139 	 * Deprecated: Use g_action_map_add_action()
140 	 *
141 	 * Params:
142 	 *     action = a #GAction
143 	 *
144 	 * Since: 2.28
145 	 */
146 	public void insert(ActionIF action)
147 	{
148 		g_simple_action_group_insert(gSimpleActionGroup, (action is null) ? null : action.getActionStruct());
149 	}
150 
151 	/**
152 	 * Looks up the action with the name @action_name in the group.
153 	 *
154 	 * If no such action exists, returns %NULL.
155 	 *
156 	 * Deprecated: Use g_action_map_lookup_action()
157 	 *
158 	 * Params:
159 	 *     actionName = the name of an action
160 	 *
161 	 * Returns: a #GAction, or %NULL
162 	 *
163 	 * Since: 2.28
164 	 */
165 	public ActionIF lookup(string actionName)
166 	{
167 		auto p = g_simple_action_group_lookup(gSimpleActionGroup, Str.toStringz(actionName));
168 		
169 		if(p is null)
170 		{
171 			return null;
172 		}
173 		
174 		return ObjectG.getDObject!(Action, ActionIF)(cast(GAction*) p);
175 	}
176 
177 	/**
178 	 * Removes the named action from the action group.
179 	 *
180 	 * If no action of this name is in the group then nothing happens.
181 	 *
182 	 * Deprecated: Use g_action_map_remove_action()
183 	 *
184 	 * Params:
185 	 *     actionName = the name of the action
186 	 *
187 	 * Since: 2.28
188 	 */
189 	public void remove(string actionName)
190 	{
191 		g_simple_action_group_remove(gSimpleActionGroup, Str.toStringz(actionName));
192 	}
193 }