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