Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / eail / eail_frame.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_frame.c
22  * @brief EailFrame implementation
23  */
24
25 #include <Elementary.h>
26 #include "eail_frame.h"
27
28 /**
29  * @brief EailFrame type definition
30  */
31 G_DEFINE_TYPE(EailFrame, eail_frame, EAIL_TYPE_WIDGET);
32
33 /**
34  * @brief EailFrame initializer
35  *
36  * @param obj AtkObject instance
37  * @param data initialization data
38  */
39 static void
40 eail_frame_initialize(AtkObject *obj, gpointer data)
41 {
42    ATK_OBJECT_CLASS(eail_frame_parent_class)->initialize(obj, data);
43
44    obj->role = ATK_ROLE_FRAME;
45 }
46
47 /**
48  * @brief Gets widget's children
49  *
50  * @param widget EailWidget instance
51  * @return Eina_List representing the list of widget's children
52  */
53 static Eina_List *
54 eail_frame_get_widget_children(EailWidget *widget)
55 {
56    Eina_List *list = NULL;
57    Evas_Object *content;
58    Evas_Object *obj;
59
60    obj = eail_widget_get_widget(EAIL_WIDGET(widget));
61    if (obj)
62      {
63         content = elm_object_part_content_get(obj, "default");
64         if (elm_object_widget_check(content))
65           list = eina_list_append(list, content);
66      }
67
68    return list;
69 }
70
71 /**
72  * @brief Gets obj's name
73  *
74  * @param obj AtkObject instance
75  * @return string representing obj's name
76  */
77 static const gchar*
78 eail_frame_get_name(AtkObject *obj)
79 {
80    const gchar *name;
81    Evas_Object *widget = NULL;
82
83    name = ATK_OBJECT_CLASS(eail_frame_parent_class)->get_name(obj);
84    if (NULL != name)
85      return name;
86
87    widget = eail_widget_get_widget(EAIL_WIDGET(obj));
88    if (widget)
89      name = (const gchar*)elm_object_text_get(widget);
90
91    return name;
92 }
93
94 /**
95  * @brief EailFrame instance initializer
96  *
97  * @param frame EailFrame instance
98  */
99 static void
100 eail_frame_init(EailFrame *frame)
101 {
102 }
103
104 /**
105  * @brief EailFrame class initializer
106  *
107  * @param klass EailFrameClass instance
108  */
109 static void
110 eail_frame_class_init(EailFrameClass *klass)
111 {
112    AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
113    EailWidgetClass *widget_class = EAIL_WIDGET_CLASS(klass);
114
115    widget_class->get_widget_children = eail_frame_get_widget_children;
116
117    atk_class->initialize = eail_frame_initialize;
118    atk_class->get_name = eail_frame_get_name;
119 }