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(bool transferOwnership = false) 68 { 69 if (transferOwnership) 70 ownedRef = false; 71 return atkSocket; 72 } 73 74 /** the main Gtk struct as a void* */ 75 protected override void* getStruct() 76 { 77 return cast(void*)atkSocket; 78 } 79 80 protected override void setStruct(GObject* obj) 81 { 82 atkSocket = cast(AtkSocket*)obj; 83 super.setStruct(obj); 84 } 85 86 /** 87 * Sets our main struct and passes it to the parent class. 88 */ 89 public this (AtkSocket* atkSocket, bool ownedRef = false) 90 { 91 this.atkSocket = atkSocket; 92 super(cast(AtkObject*)atkSocket, ownedRef); 93 } 94 95 // add the Component capabilities 96 mixin ComponentT!(AtkSocket); 97 98 99 /** */ 100 public static GType getType() 101 { 102 return atk_socket_get_type(); 103 } 104 105 /** */ 106 public this() 107 { 108 auto p = atk_socket_new(); 109 110 if(p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(AtkSocket*) p, true); 116 } 117 118 /** 119 * Embeds the children of an #AtkPlug as the children of the 120 * #AtkSocket. The plug may be in the same process or in a different 121 * process. 122 * 123 * The class item used by this function should be filled in by the IPC 124 * layer (usually at-spi2-atk). The implementor of the AtkSocket 125 * should call this function and pass the id for the plug as returned 126 * by atk_plug_get_id(). It is the responsibility of the application 127 * to pass the plug id on to the process implementing the #AtkSocket 128 * as needed. 129 * 130 * Params: 131 * plugId = the ID of an #AtkPlug 132 * 133 * Since: 1.30 134 */ 135 public void embed(string plugId) 136 { 137 atk_socket_embed(atkSocket, Str.toStringz(plugId)); 138 } 139 140 /** 141 * Determines whether or not the socket has an embedded plug. 142 * 143 * Returns: TRUE if a plug is embedded in the socket 144 * 145 * Since: 1.30 146 */ 147 public bool isOccupied() 148 { 149 return atk_socket_is_occupied(atkSocket) != 0; 150 } 151 }