2 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
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 License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 * @file eail_item_parent.c
22 * @brief Implementation of interface that is used by EailItem implementation
23 * to allow special behavior of wide range item-objects
26 #include "eail_item_parent.h"
30 * @returns GType for initialized interface
33 eail_item_parent_get_type(void)
35 static volatile GType type_id__volatile = 0;
37 if (g_once_init_enter(&type_id__volatile))
39 GType type_id = g_type_register_static_simple(
42 sizeof(EailItemParentIface),
48 g_once_init_leave(&type_id__volatile, type_id);
51 return type_id__volatile;
55 * @param parent object that holds EailItem in its content
56 * @param item an EailItem object
58 * @return gchar* representing name of item or NULL if not available
61 eail_item_parent_get_item_name(EailItemParent *parent,
64 EailItemParentIface *iface;
66 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), NULL);
68 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
70 if (iface->get_item_name)
71 return iface->get_item_name(parent, item);
77 * @param parent object that holds EailItem in its content
78 * @param item an EailItem object
80 * @returns ATK role for given EailItem
83 eail_item_parent_get_item_role(EailItemParent *parent,
86 EailItemParentIface *iface;
88 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), ATK_ROLE_INVALID);
90 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
92 if (iface->get_item_role)
93 return iface->get_item_role(parent, item);
95 return ATK_OBJECT(item)->role;
99 * @param parent object that holds EailItem in its content
100 * @param item an EailItem object
102 * @returns gint representing index of item in parent object
105 eail_item_parent_get_item_index_in_parent(EailItemParent *parent,
108 EailItemParentIface *iface;
110 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), -1);
112 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
114 if (iface->get_item_index_in_parent)
115 return iface->get_item_index_in_parent(parent, item);
121 * @param parent object that holds EailItem in its content
122 * @param item an EailItem object
124 * @returns gint representing index of item in parent object or -1 if
128 eail_item_parent_get_n_children(EailItemParent *parent,
131 EailItemParentIface *iface;
133 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), -1);
135 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
137 if (iface->get_n_children)
138 return iface->get_n_children(parent, item);
144 * @param parent object that holds EailItem in its content
145 * @param item an EailItem object
146 * @param index gint representing index of child to ref
148 * @returns AtkObject * for given index or NULL if not implemented
151 eail_item_parent_ref_n_child(EailItemParent *parent,
155 EailItemParentIface *iface;
157 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), NULL);
159 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
161 if (iface->ref_n_child)
162 return iface->ref_n_child(parent, item, index);
168 * @param parent object that holds EailItem in its content
169 * @param item an EailItem object
170 * @param state_set current state_set
172 * @returns AtkStateSet representing state set of given EailItem
175 eail_item_parent_ref_item_state_set(EailItemParent *parent,
177 AtkStateSet *state_set)
179 EailItemParentIface *iface;
181 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), NULL);
183 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
185 if (iface->ref_item_state_set)
186 return iface->ref_item_state_set(parent, item, state_set);
192 * @param parent object that holds EailItem in its content
193 * @param item an EailItem object
195 * @returns TRUE if operation was successfull, FALSE otherwise
198 eail_item_parent_grab_item_focus(EailItemParent *parent,
201 EailItemParentIface *iface;
203 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), FALSE);
205 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
207 if (iface->grab_item_focus)
208 return iface->grab_item_focus(parent, item);
215 * Gets the rectangle which gives the extent of the component.
217 * @param parent object that holds EailItem in its content
218 * @param item an EailItem object
219 * @param x address of gint to put x coordinate
220 * @param y address of gint to put y coordinate
221 * @param width addrress of gint to put width
222 * @param height address of gint to put height
223 * @param coord_type specifies whether the coordinates are relative to the
224 * screen or to the components top level window
227 eail_item_parent_get_item_extents(EailItemParent *parent,
233 AtkCoordType coord_type)
235 EailItemParentIface *iface;
237 g_return_if_fail(EAIL_IS_ITEM_PARENT(parent));
239 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
241 if (iface->get_item_extents)
242 iface->get_item_extents(parent, item, x, y, width, height, coord_type);
246 * @param parent object that holds EailItem in its content
247 * @param item an EailItem object
249 * @returns nested Evas_Object for given EailItem
251 Evas_Object * eail_item_parent_get_evas_obj(EailItemParent *parent,
254 EailItemParentIface *iface;
256 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), NULL);
258 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
260 if (iface->get_evas_obj)
261 return iface->get_evas_obj(parent, item);
267 * @param parent object that holds EailItem in its content
268 * @param item an EailItem object
270 * @returns filled gint representing supported actions
273 eail_item_parent_get_actions_supported(EailItemParent *parent,
276 EailItemParentIface *iface;
278 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), FALSE);
280 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
282 if (iface->get_actions_supported)
283 return iface->get_actions_supported(parent, item);
285 return EAIL_ACTION_SUPPORTED_NONE;
289 * @param parent object that holds EailItem in its content
290 * @param item an EailItem object
292 * @returns TRUE if content get is supported, FALSE otherwise. Default
293 * implementation returns TRUE (used if no redefinition in EailItemParent
294 * interface implementation is defined)
297 eail_item_parent_is_is_content_get_supported(EailItemParent *parent,
300 EailItemParentIface *iface;
302 g_return_val_if_fail(EAIL_IS_ITEM_PARENT(parent), FALSE);
304 iface = EAIL_ITEM_PARENT_GET_IFACE(parent);
306 if (iface->is_content_get_supported)
307 return iface->is_content_get_supported(parent, item);