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