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.
22 * @brief EailBox implementation
25 #include <Elementary.h>
28 #include "eail_priv.h"
29 #include "eail_utils.h"
30 #include "eail_factory.h"
33 * @brief EailBox type definition
35 G_DEFINE_TYPE(EailBox, eail_box, EAIL_TYPE_WIDGET);
38 * Implementation of the *AtkObject* interface
42 * @brief Handler for realized event, used to notify about box content
45 * @param data passed to callback
46 * @param obj object that raised event
47 * @param event_info additional event info (reference toobject added to box)
50 eail_box_children_add_event(void *data,
54 AtkObject *atk_parent = NULL;
56 atk_parent = ATK_OBJECT(data);
57 if (!atk_parent) return;
59 eail_emit_children_changed_obj(TRUE, atk_parent, NULL);
63 * @brief Handler for realized event, used to notify about box content
66 * @param data passed to callback
67 * @param obj object that raised event
68 * @param event_info additional event info (reference toobject added to box)
71 eail_box_children_rm_event(void *data,
75 AtkObject *atk_parent = NULL;
77 atk_parent = ATK_OBJECT(data);
78 if (!atk_parent) return;
80 eail_emit_children_changed_obj(FALSE, atk_parent, NULL);
84 * @brief EailBox initializer
86 * @param obj AtkObject instance
87 * @param data initialization data
90 eail_box_initialize(AtkObject *obj, gpointer data)
92 Evas_Object *nested_widget = NULL;
93 ATK_OBJECT_CLASS(eail_box_parent_class)->initialize(obj, data);
95 obj->role = ATK_ROLE_FILLER;
96 g_return_if_fail(EAIL_IS_WIDGET(obj));
98 nested_widget = eail_widget_get_widget(EAIL_WIDGET(obj));
101 ERR("No evas object inside EailWidget was found");
105 evas_object_smart_callback_add(nested_widget, "child,added",
106 eail_box_children_add_event, obj);
107 evas_object_smart_callback_add(nested_widget, "child,removed",
108 eail_box_children_rm_event, obj);
112 * @brief Gets widget's children
114 * @param widget EailWidget instance
115 * @return Eina_List containing widget's children
118 eail_box_get_widget_children(EailWidget *widget)
120 Eina_List *list = NULL;
121 Evas_Object *obj = eail_widget_get_widget(widget);
124 list = elm_box_children_get(obj);
130 * @brief EailBox instance initializer
132 * @param box EailBox instance
135 eail_box_init(EailBox *box)
140 * @brief EailBox class initializer
142 * @param klass EailBoxClass instance
145 eail_box_class_init(EailBoxClass *klass)
147 AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
148 EailWidgetClass *widget_class = EAIL_WIDGET_CLASS(klass);
150 widget_class->get_widget_children = eail_box_get_widget_children;
152 atk_class->initialize = eail_box_initialize;