Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / eail / eail_grid.c
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /**
21  * @file eail_grid.c
22  * @brief EailGrid implementation
23  */
24
25 #include <Elementary.h>
26
27 #include "eail_grid.h"
28
29 /**
30  * @brief Definition of EailGrid as GObject
31  *
32  * EailGrid is extended EAIL_TYPE_WIDGET
33  */
34 G_DEFINE_TYPE(EailGrid, eail_grid, EAIL_TYPE_WIDGET);
35
36 /**
37  * @brief Gets EvasObject from EailWidget.
38  *
39  * Implementation of eail_widget_get_widget_children callback from
40  * EailWidget.
41  *
42  * @param widget EailWidget instance
43  *
44  * @returns Eina_List filled with Evas_Object* objects contained in grid widget
45  */
46 static Eina_List*
47 eail_grid_children_get(EailWidget *widget)
48 {
49    Evas_Object *obj;
50    Eina_List *list = NULL;
51
52    obj = eail_widget_get_widget(widget);
53    if (obj)
54      list = elm_grid_children_get(obj);
55
56    return list;
57 }
58
59 /**
60  * @brief Initializer for AtkObjectClass
61  *
62  * @param obj AtkObject instance
63  * @param data initialization data
64  */
65 static void
66 eail_grid_initialize(AtkObject *obj, gpointer data)
67 {
68    ATK_OBJECT_CLASS(eail_grid_parent_class)->initialize(obj, data);
69    obj->role = ATK_ROLE_FILLER;
70 }
71
72 /**
73  * @brief Initializer for GObject class
74  *
75  * @param grid EailGrid instance
76  */
77 static void
78 eail_grid_init(EailGrid *grid)
79 {
80 }
81
82 /**
83  * @brief Initializer for GObject grid class
84  *
85  * Defines callbacks for base AtkObject.
86  *
87  * @param klass EailGridClass class
88  */
89 static void
90 eail_grid_class_init(EailGridClass *klass)
91 {
92    AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
93    EailWidgetClass *widget_class = EAIL_WIDGET_CLASS(klass);
94
95    widget_class->get_widget_children = eail_grid_children_get;
96
97    atk_class->initialize = eail_grid_initialize;
98 }