Update VS property sheets
[atk.git] / atk / atksocket.c
blobff31d5d06d024bf456540ca6a1b74ce1a2516f79
1 /* ATK - Accessibility Toolkit
2 * Copyright (C) 2009 Novell, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "atk.h"
21 #include "atksocket.h"
23 static void atk_socket_class_init (AtkSocketClass *klass);
25 static void atk_component_interface_init (AtkComponentIface *iface);
27 G_DEFINE_TYPE_WITH_CODE (AtkSocket, atk_socket, ATK_TYPE_OBJECT,
28 G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
30 static void
31 atk_socket_init (AtkSocket* obj)
33 obj->embedded_plug_id = NULL;
36 static void
37 atk_socket_class_init (AtkSocketClass* klass)
39 klass->embed = NULL;
42 static void atk_component_interface_init (AtkComponentIface *iface)
46 AtkObject*
47 atk_socket_new (void)
49 AtkObject* accessible;
51 accessible = g_object_new (ATK_TYPE_SOCKET, NULL);
52 g_return_val_if_fail (accessible != NULL, NULL);
54 accessible->role = ATK_ROLE_FILLER;
55 accessible->layer = ATK_LAYER_WIDGET;
57 return accessible;
60 /**
61 * atk_socket_embed:
62 * @obj: an #AtkSocket
63 * @plug_id: the ID of an #AtkPlug
65 * Embeds the children of an #AtkPlug as the children of the #AtkSocket. The
66 * plug may be in the same process or in a different process.
67 * THe class item used by this function should be filled in by the IPC layer
68 * (ie, at-spi2-atk). The implementor of the AtkSocket should call this
69 * function and pass the id for the plug as returned by atk_plug_get_id.
70 * It is the responsibility of the application to pass the plug id on to
71 * the process implementing the AtkSocket as needed.
73 * Since: 1.30
74 **/
75 void
76 atk_socket_embed (AtkSocket* obj, gchar* plug_id)
78 AtkSocketClass *klass;
80 g_return_if_fail (plug_id != NULL);
81 g_return_if_fail (ATK_IS_SOCKET (obj));
83 klass = g_type_class_peek (ATK_TYPE_SOCKET);
84 if (klass && klass->embed)
86 if (obj->embedded_plug_id)
87 g_free (obj->embedded_plug_id);
88 obj->embedded_plug_id = g_strdup (plug_id);
89 (klass->embed) (obj, plug_id);
93 /**
94 * atk_socket_is_occupied:
95 * @obj: an #AtkSocket
97 * Determines whether or not the socket has an embedded plug.
99 * Returns: TRUE if a plug is embedded in the socket
101 * Since: 1.30
103 gboolean
104 atk_socket_is_occupied (AtkSocket* obj)
106 g_return_val_if_fail (ATK_IS_SOCKET (obj), FALSE);
108 return (obj->embedded_plug_id != NULL);