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