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_custom_widget.c
22 * @brief EailCustomWidget implementation
26 #include <Ecore_Evas.h>
27 #include <Elementary.h>
29 #include "eail_custom_widget.h"
30 #include "eail_factory.h"
31 #include "eail_utils.h"
32 #include "eail_priv.h"
35 * @brief EailCustomWidget type definition
38 G_DEFINE_TYPE(EailCustomWidget, eail_custom_widget, EAIL_TYPE_WIDGET);
41 eail_custom_widget_create(Evas_Object *widget)
43 AtkObject *accessible = NULL;
46 ERR("Cannot create accessible for NULL-widget");
49 accessible = g_object_new(EAIL_TYPE_CUSTOM_WIDGET, NULL);
51 atk_object_initialize(accessible, widget);
56 DBG("No atk obj created");
61 * @brief Destroyed event handler for customwidget
63 * @param data passed to callback
64 * @param obj object that raised event
65 * @param event_info additional event info
69 eail_custom_widget_handle_delete_event(void *data, Evas *e, Evas_Object *obj, void *event_info)
71 g_return_if_fail(ATK_IS_OBJECT(data));
72 AtkObject *parent = atk_object_get_parent(ATK_OBJECT(data));
73 EailWidget *widget = EAIL_WIDGET(parent);
74 g_return_if_fail(EAIL_IS_WIDGET(data));
76 widget->custom_children = eina_list_remove(widget->custom_children, ATK_OBJECT(data));
78 DBG("delete event\n");
79 atk_object_notify_state_change(ATK_OBJECT(data), ATK_STATE_DEFUNCT, TRUE);
80 eail_emit_atk_signal(ATK_OBJECT(data), "visible-data-changed", EAIL_TYPE_CUSTOM_WIDGET);
84 eail_custom_widget_on_focused_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
86 g_return_if_fail(ATK_IS_OBJECT(data));
87 DBG("focus in on custom widget\n");
88 atk_object_notify_state_change(ATK_OBJECT(data), ATK_STATE_FOCUSED, TRUE);
92 eail_custom_widget_on_focused_out(void *data, Evas *e, Evas_Object *obj, void *event_info)
94 g_return_if_fail(ATK_IS_OBJECT(data));
95 DBG("focus out from custom widget\n");
96 atk_object_notify_state_change(ATK_OBJECT(data), ATK_STATE_FOCUSED, FALSE);
100 eail_custom_widget_initialize(AtkObject *obj, gpointer data)
102 ATK_OBJECT_CLASS(eail_custom_widget_parent_class)->initialize(obj, data);
105 ERR("No evas object inside EailCustomWidget was found");
109 evas_object_event_callback_add ((Evas_Object *)data, EVAS_CALLBACK_DEL, eail_custom_widget_handle_delete_event, obj);
110 evas_object_event_callback_add ((Evas_Object *)data, EVAS_CALLBACK_FOCUS_IN , eail_custom_widget_on_focused_in, obj);
111 evas_object_event_callback_add ((Evas_Object *)data, EVAS_CALLBACK_FOCUS_OUT, eail_custom_widget_on_focused_out, obj);
116 * @brief EailCustomWidget instance initializer
118 * @param widget EailCustomWidget instance
121 eail_custom_widget_init(EailCustomWidget *widget)
126 * @brief EailCustomWidget class initializer
128 * Function called upon instance creation. It initializes AtkObject class
129 * callbacks for EailCustomWidget.
131 * @param klass EailCustomWidgetClass instance
134 eail_custom_widget_class_init(EailCustomWidgetClass *klass)
136 AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
137 atk_class->initialize = eail_custom_widget_initialize;