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  = GtkWindowGroup.html
27  * outPack = gtk
28  * outFile = WindowGroup
29  * strct   = GtkWindowGroup
30  * realStrct=
31  * ctorStrct=
32  * clss    = WindowGroup
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_window_group_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.ListG
47  * 	- gdk.Device
48  * 	- gtk.Widget
49  * 	- gtk.Window
50  * structWrap:
51  * 	- GList* -> ListG
52  * 	- GdkDevice* -> Device
53  * 	- GtkWidget* -> Widget
54  * 	- GtkWindow* -> Window
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gtk.WindowGroup;
61 
62 public  import gtkc.gtktypes;
63 
64 private import gtkc.gtk;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.ListG;
70 private import gdk.Device;
71 private import gtk.Widget;
72 private import gtk.Window;
73 
74 
75 
76 private import gobject.ObjectG;
77 
78 /**
79  * GtkWindowGroup objects are referenced by each window in the group,
80  * so once you have added all windows to a GtkWindowGroup, you can drop
81  * the initial reference to the window group with g_object_unref(). If the
82  * windows in the window group are subsequently destroyed, then they will
83  * be removed from the window group and drop their references on the window
84  * group; when all window have been removed, the window group will be
85  * freed.
86  */
87 public class WindowGroup : ObjectG
88 {
89 	
90 	/** the main Gtk struct */
91 	protected GtkWindowGroup* gtkWindowGroup;
92 	
93 	
94 	public GtkWindowGroup* getWindowGroupStruct()
95 	{
96 		return gtkWindowGroup;
97 	}
98 	
99 	
100 	/** the main Gtk struct as a void* */
101 	protected override void* getStruct()
102 	{
103 		return cast(void*)gtkWindowGroup;
104 	}
105 	
106 	/**
107 	 * Sets our main struct and passes it to the parent class
108 	 */
109 	public this (GtkWindowGroup* gtkWindowGroup)
110 	{
111 		super(cast(GObject*)gtkWindowGroup);
112 		this.gtkWindowGroup = gtkWindowGroup;
113 	}
114 	
115 	protected override void setStruct(GObject* obj)
116 	{
117 		super.setStruct(obj);
118 		gtkWindowGroup = cast(GtkWindowGroup*)obj;
119 	}
120 	
121 	/**
122 	 */
123 	
124 	/**
125 	 * Creates a new GtkWindowGroup object. Grabs added with
126 	 * gtk_grab_add() only affect windows within the same GtkWindowGroup.
127 	 * Throws: ConstructionException GTK+ fails to create the object.
128 	 */
129 	public this ()
130 	{
131 		// GtkWindowGroup * gtk_window_group_new (void);
132 		auto p = gtk_window_group_new();
133 		if(p is null)
134 		{
135 			throw new ConstructionException("null returned by gtk_window_group_new()");
136 		}
137 		this(cast(GtkWindowGroup*) p);
138 	}
139 	
140 	/**
141 	 * Adds a window to a GtkWindowGroup.
142 	 * Params:
143 	 * window = the GtkWindow to add
144 	 */
145 	public void addWindow(Window window)
146 	{
147 		// void gtk_window_group_add_window (GtkWindowGroup *window_group,  GtkWindow *window);
148 		gtk_window_group_add_window(gtkWindowGroup, (window is null) ? null : window.getWindowStruct());
149 	}
150 	
151 	/**
152 	 * Removes a window from a GtkWindowGroup.
153 	 * Params:
154 	 * window = the GtkWindow to remove
155 	 */
156 	public void removeWindow(Window window)
157 	{
158 		// void gtk_window_group_remove_window (GtkWindowGroup *window_group,  GtkWindow *window);
159 		gtk_window_group_remove_window(gtkWindowGroup, (window is null) ? null : window.getWindowStruct());
160 	}
161 	
162 	/**
163 	 * Returns a list of the GtkWindows that belong to window_group.
164 	 * Since 2.14
165 	 * Returns: A newly-allocated list of windows inside the group. [element-type GtkWindow][transfer container]
166 	 */
167 	public ListG listWindows()
168 	{
169 		// GList * gtk_window_group_list_windows (GtkWindowGroup *window_group);
170 		auto p = gtk_window_group_list_windows(gtkWindowGroup);
171 		
172 		if(p is null)
173 		{
174 			return null;
175 		}
176 		
177 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
178 	}
179 	
180 	/**
181 	 * Gets the current grab widget of the given group,
182 	 * see gtk_grab_add().
183 	 * Since 2.22
184 	 * Returns: the current grab widget of the group. [transfer none]
185 	 */
186 	public Widget getCurrentGrab()
187 	{
188 		// GtkWidget * gtk_window_group_get_current_grab (GtkWindowGroup *window_group);
189 		auto p = gtk_window_group_get_current_grab(gtkWindowGroup);
190 		
191 		if(p is null)
192 		{
193 			return null;
194 		}
195 		
196 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
197 	}
198 	
199 	/**
200 	 * Returns the current grab widget for device, or NULL if none.
201 	 * Params:
202 	 * device = a GdkDevice
203 	 * Returns: The grab widget, or NULL. [transfer none] Since 3.0
204 	 */
205 	public Widget getCurrentDeviceGrab(Device device)
206 	{
207 		// GtkWidget * gtk_window_group_get_current_device_grab  (GtkWindowGroup *window_group,  GdkDevice *device);
208 		auto p = gtk_window_group_get_current_device_grab(gtkWindowGroup, (device is null) ? null : device.getDeviceStruct());
209 		
210 		if(p is null)
211 		{
212 			return null;
213 		}
214 		
215 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
216 	}
217 }