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