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 atk.Socket;
26 
27 private import atk.ComponentIF;
28 private import atk.ComponentT;
29 private import atk.ObjectAtk;
30 private import atk.c.functions;
31 public  import atk.c.types;
32 private import glib.ConstructionException;
33 private import glib.Str;
34 private import gobject.ObjectG;
35 public  import gtkc.atktypes;
36 
37 
38 /**
39  * Together with #AtkPlug, #AtkSocket provides the ability to embed
40  * accessibles from one process into another in a fashion that is
41  * transparent to assistive technologies. #AtkSocket works as the
42  * container of #AtkPlug, embedding it using the method
43  * atk_socket_embed(). Any accessible contained in the #AtkPlug will
44  * appear to the assistive technologies as being inside the
45  * application that created the #AtkSocket.
46  * 
47  * The communication between a #AtkSocket and a #AtkPlug is done by
48  * the IPC layer of the accessibility framework, normally implemented
49  * by the D-Bus based implementation of AT-SPI (at-spi2). If that is
50  * the case, at-spi-atk2 is the responsible to implement the abstract
51  * methods atk_plug_get_id() and atk_socket_embed(), so an ATK
52  * implementor shouldn't reimplement them. The process that contains
53  * the #AtkPlug is responsible to send the ID returned by
54  * atk_plug_id() to the process that contains the #AtkSocket, so it
55  * could call the method atk_socket_embed() in order to embed it.
56  * 
57  * For the same reasons, an implementor doesn't need to implement
58  * atk_object_get_n_accessible_children() and
59  * atk_object_ref_accessible_child(). All the logic related to those
60  * functions will be implemented by the IPC layer.
61  */
62 public class Socket : ObjectAtk, ComponentIF
63 {
64 	/** the main Gtk struct */
65 	protected AtkSocket* atkSocket;
66 
67 	/** Get the main Gtk struct */
68 	public AtkSocket* getSocketStruct(bool transferOwnership = false)
69 	{
70 		if (transferOwnership)
71 			ownedRef = false;
72 		return atkSocket;
73 	}
74 
75 	/** the main Gtk struct as a void* */
76 	protected override void* getStruct()
77 	{
78 		return cast(void*)atkSocket;
79 	}
80 
81 	/**
82 	 * Sets our main struct and passes it to the parent class.
83 	 */
84 	public this (AtkSocket* atkSocket, bool ownedRef = false)
85 	{
86 		this.atkSocket = atkSocket;
87 		super(cast(AtkObject*)atkSocket, ownedRef);
88 	}
89 
90 	// add the Component capabilities
91 	mixin ComponentT!(AtkSocket);
92 
93 
94 	/** */
95 	public static GType getType()
96 	{
97 		return atk_socket_get_type();
98 	}
99 
100 	/**
101 	 * Creates a new #AtkSocket.
102 	 *
103 	 * Returns: the newly created #AtkSocket instance
104 	 *
105 	 * Throws: ConstructionException GTK+ fails to create the object.
106 	 */
107 	public this()
108 	{
109 		auto __p = atk_socket_new();
110 
111 		if(__p is null)
112 		{
113 			throw new ConstructionException("null returned by new");
114 		}
115 
116 		this(cast(AtkSocket*) __p, true);
117 	}
118 
119 	/**
120 	 * Embeds the children of an #AtkPlug as the children of the
121 	 * #AtkSocket. The plug may be in the same process or in a different
122 	 * process.
123 	 *
124 	 * The class item used by this function should be filled in by the IPC
125 	 * layer (usually at-spi2-atk). The implementor of the AtkSocket
126 	 * should call this function and pass the id for the plug as returned
127 	 * by atk_plug_get_id().  It is the responsibility of the application
128 	 * to pass the plug id on to the process implementing the #AtkSocket
129 	 * as needed.
130 	 *
131 	 * Params:
132 	 *     plugId = the ID of an #AtkPlug
133 	 *
134 	 * Since: 1.30
135 	 */
136 	public void embed(string plugId)
137 	{
138 		atk_socket_embed(atkSocket, Str.toStringz(plugId));
139 	}
140 
141 	/**
142 	 * Determines whether or not the socket has an embedded plug.
143 	 *
144 	 * Returns: TRUE if a plug is embedded in the socket
145 	 *
146 	 * Since: 1.30
147 	 */
148 	public bool isOccupied()
149 	{
150 		return atk_socket_is_occupied(atkSocket) != 0;
151 	}
152 }