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 gdk.Seat;
26 
27 private import gdk.Device;
28 private import gdk.DeviceTool;
29 private import gdk.Display;
30 private import gdk.c.functions;
31 public  import gdk.c.types;
32 private import glib.ListG;
33 private import gobject.ObjectG;
34 private import gobject.Signals;
35 private import std.algorithm;
36 
37 
38 /**
39  * The `GdkSeat` object represents a collection of input devices
40  * that belong to a user.
41  */
42 public class Seat : ObjectG
43 {
44 	/** the main Gtk struct */
45 	protected GdkSeat* gdkSeat;
46 
47 	/** Get the main Gtk struct */
48 	public GdkSeat* getSeatStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return gdkSeat;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)gdkSeat;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (GdkSeat* gdkSeat, bool ownedRef = false)
65 	{
66 		this.gdkSeat = gdkSeat;
67 		super(cast(GObject*)gdkSeat, ownedRef);
68 	}
69 
70 
71 	/** */
72 	public static GType getType()
73 	{
74 		return gdk_seat_get_type();
75 	}
76 
77 	/**
78 	 * Returns the capabilities this `GdkSeat` currently has.
79 	 *
80 	 * Returns: the seat capabilities
81 	 */
82 	public GdkSeatCapabilities getCapabilities()
83 	{
84 		return gdk_seat_get_capabilities(gdkSeat);
85 	}
86 
87 	/**
88 	 * Returns the devices that match the given capabilities.
89 	 *
90 	 * Params:
91 	 *     capabilities = capabilities to get devices for
92 	 *
93 	 * Returns: A list
94 	 *     of `GdkDevices`. The list must be freed with g_list_free(),
95 	 *     the elements are owned by GTK and must not be freed.
96 	 */
97 	public ListG getDevices(GdkSeatCapabilities capabilities)
98 	{
99 		auto __p = gdk_seat_get_devices(gdkSeat, capabilities);
100 
101 		if(__p is null)
102 		{
103 			return null;
104 		}
105 
106 		return new ListG(cast(GList*) __p);
107 	}
108 
109 	/**
110 	 * Returns the `GdkDisplay` this seat belongs to.
111 	 *
112 	 * Returns: a `GdkDisplay`. This object
113 	 *     is owned by GTK and must not be freed.
114 	 */
115 	public Display getDisplay()
116 	{
117 		auto __p = gdk_seat_get_display(gdkSeat);
118 
119 		if(__p is null)
120 		{
121 			return null;
122 		}
123 
124 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p);
125 	}
126 
127 	/**
128 	 * Returns the device that routes keyboard events.
129 	 *
130 	 * Returns: a `GdkDevice` with keyboard
131 	 *     capabilities. This object is owned by GTK and must not be freed.
132 	 */
133 	public Device getKeyboard()
134 	{
135 		auto __p = gdk_seat_get_keyboard(gdkSeat);
136 
137 		if(__p is null)
138 		{
139 			return null;
140 		}
141 
142 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) __p);
143 	}
144 
145 	/**
146 	 * Returns the device that routes pointer events.
147 	 *
148 	 * Returns: a `GdkDevice` with pointer
149 	 *     capabilities. This object is owned by GTK and must not be freed.
150 	 */
151 	public Device getPointer()
152 	{
153 		auto __p = gdk_seat_get_pointer(gdkSeat);
154 
155 		if(__p is null)
156 		{
157 			return null;
158 		}
159 
160 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) __p);
161 	}
162 
163 	/**
164 	 * Returns all `GdkDeviceTools` that are known to the application.
165 	 *
166 	 * Returns: A list of tools. Free with g_list_free().
167 	 */
168 	public ListG getTools()
169 	{
170 		auto __p = gdk_seat_get_tools(gdkSeat);
171 
172 		if(__p is null)
173 		{
174 			return null;
175 		}
176 
177 		return new ListG(cast(GList*) __p);
178 	}
179 
180 	/**
181 	 * Emitted when a new input device is related to this seat.
182 	 *
183 	 * Params:
184 	 *     device = the newly added `GdkDevice`.
185 	 */
186 	gulong addOnDeviceAdded(void delegate(Device, Seat) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
187 	{
188 		return Signals.connect(this, "device-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
189 	}
190 
191 	/**
192 	 * Emitted when an input device is removed (e.g. unplugged).
193 	 *
194 	 * Params:
195 	 *     device = the just removed `GdkDevice`.
196 	 */
197 	gulong addOnDeviceRemoved(void delegate(Device, Seat) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
198 	{
199 		return Signals.connect(this, "device-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
200 	}
201 
202 	/**
203 	 * Emitted whenever a new tool is made known to the seat.
204 	 *
205 	 * The tool may later be assigned to a device (i.e. on
206 	 * proximity with a tablet). The device will emit the
207 	 * [signalGdkDevice::tool-changed] signal accordingly.
208 	 *
209 	 * A same tool may be used by several devices.
210 	 *
211 	 * Params:
212 	 *     tool = the new `GdkDeviceTool` known to the seat
213 	 */
214 	gulong addOnToolAdded(void delegate(DeviceTool, Seat) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
215 	{
216 		return Signals.connect(this, "tool-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
217 	}
218 
219 	/**
220 	 * Emitted whenever a tool is no longer known to this @seat.
221 	 *
222 	 * Params:
223 	 *     tool = the just removed `GdkDeviceTool`
224 	 */
225 	gulong addOnToolRemoved(void delegate(DeviceTool, Seat) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
226 	{
227 		return Signals.connect(this, "tool-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
228 	}
229 }