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 	public this()
102 	{
103 		auto p = atk_socket_new();
104 
105 		if(p is null)
106 		{
107 			throw new ConstructionException("null returned by new");
108 		}
109 
110 		this(cast(AtkSocket*) p, true);
111 	}
112 
113 	/**
114 	 * Embeds the children of an #AtkPlug as the children of the
115 	 * #AtkSocket. The plug may be in the same process or in a different
116 	 * process.
117 	 *
118 	 * The class item used by this function should be filled in by the IPC
119 	 * layer (usually at-spi2-atk). The implementor of the AtkSocket
120 	 * should call this function and pass the id for the plug as returned
121 	 * by atk_plug_get_id().  It is the responsibility of the application
122 	 * to pass the plug id on to the process implementing the #AtkSocket
123 	 * as needed.
124 	 *
125 	 * Params:
126 	 *     plugId = the ID of an #AtkPlug
127 	 *
128 	 * Since: 1.30
129 	 */
130 	public void embed(string plugId)
131 	{
132 		atk_socket_embed(atkSocket, Str.toStringz(plugId));
133 	}
134 
135 	/**
136 	 * Determines whether or not the socket has an embedded plug.
137 	 *
138 	 * Returns: TRUE if a plug is embedded in the socket
139 	 *
140 	 * Since: 1.30
141 	 */
142 	public bool isOccupied()
143 	{
144 		return atk_socket_is_occupied(atkSocket) != 0;
145 	}
146 }