Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / eail / eail_fileselector.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_fileselector.c
22  * @brief Fileselector implementation
23  */
24
25 #include <Elementary.h>
26
27 #include "eail_fileselector.h"
28 #include "eail_item.h"
29 #include "eail_item_parent.h"
30 #include "eail_priv.h"
31
32 /**
33  * @brief Definition of EailFileselector as GObject
34  *
35  * EailFileselector is extended EAIL_TYPE_LAYOUT
36  */
37 G_DEFINE_TYPE(EailFileselector, eail_fileselector, EAIL_TYPE_LAYOUT);
38
39 /**
40  * @brief Initializer for Fileselector AtkObjectClass
41  *
42  * @param obj AtkObject instance
43  * @param data initialization data
44  */
45 static void
46 eail_fileselector_initialize(AtkObject *obj, gpointer data)
47 {
48    ATK_OBJECT_CLASS(eail_fileselector_parent_class)->initialize(obj, data);
49    obj->role = ATK_ROLE_FILE_CHOOSER;
50 }
51
52 /**
53  * @brief Gets obj's accessible name
54  *
55  * @param obj AtkObject instance
56  *
57  * @returns string representing obj's name
58  */
59 static const gchar*
60 eail_fileselector_get_name(AtkObject *obj)
61 {
62    Evas_Object *widget;
63    const char *atk_name;
64
65    g_return_val_if_fail(EAIL_IS_FILESELECTOR(obj), NULL);
66
67    atk_name = ATK_OBJECT_CLASS(eail_fileselector_parent_class)->get_name(obj);
68    if (atk_name)
69      return atk_name;
70
71    widget = eail_widget_get_widget(EAIL_WIDGET(obj));
72    if (!widget) return NULL;
73
74    return elm_object_text_get(widget);
75 }
76
77 /**
78  * @brief EailFileselector GObject instance initializer
79  *
80  * @param fileselector EailFileselector instance
81  */
82 static void
83 eail_fileselector_init(EailFileselector *fileselector)
84 {
85 }
86
87 /**
88  * @brief Destructor for EailFileselector
89  *
90  * @param object GObject object to be finalized
91  */
92 static void
93 eail_fileselector_finalize(GObject *object)
94 {
95    G_OBJECT_CLASS(eail_fileselector_parent_class)->finalize(object);
96 }
97
98 /**
99  * @brief Initializer for EailFileselector GObject class
100  *
101  * Defines callbacks for base AtkObject.
102  *
103  * @param klass EailFileselectorClass instance
104  */
105 static void
106 eail_fileselector_class_init(EailFileselectorClass *klass)
107 {
108    AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
109    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
110    atk_class->initialize = eail_fileselector_initialize;
111    atk_class->get_name = eail_fileselector_get_name;
112    gobject_class->finalize = eail_fileselector_finalize;
113 }