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 EailNotify implementation
26 #include <Elementary.h>
28 #include "eail_notify.h"
29 #include "eail_factory.h"
30 #include "eail_priv.h"
33 * @brief Definition of EailPopup as GObject
35 * EailNotify is extended EAIL_TYPE_WIDGET
37 G_DEFINE_TYPE(EailNotify, eail_notify, EAIL_TYPE_WIDGET);
41 * @brief Initializer for AtkObject
43 * @param obj AtkObject instance
44 * @param data initialization data
47 eail_notify_initialize(AtkObject *obj, gpointer data)
49 ATK_OBJECT_CLASS(eail_notify_parent_class) ->initialize(obj, data);
50 obj->role = ATK_ROLE_NOTIFICATION;
54 * @brief Initializer for GObject EailNotify instance
56 * @param button EailNotify instance
59 eail_notify_init(EailNotify *button)
65 * @brief Helper function for getting nested content in a notify widget
67 * @param obj AtkObject instance
69 * @returns Evas_Object representing nested content in the notify widget
72 _eail_get_nested_widget(AtkObject *obj)
74 Evas_Object *notify_widget = NULL, *nested_widget = NULL;
75 /* getting widget of notify class */
76 notify_widget = eail_widget_get_widget(EAIL_WIDGET(obj));
79 ERR("No widget found for notification object!");
82 nested_widget = elm_object_part_content_get(notify_widget, "default");
88 * @brief Gets the number of accessible children of the accessible.
90 * Implementation of AtkObject->get_n_children callback.
92 * @param obj AtkObject instance
94 * @returns integer representing the number of accessible children of
98 eail_notify_get_n_children(AtkObject *obj)
100 Evas_Object *nested_widget = NULL;
102 nested_widget = _eail_get_nested_widget(obj);
110 * @brief Gets a reference to the specified accessible child of the object.
112 * The accessible children are 0-based so the first accessible child is at index 0,
113 * the second at index 1 and so on.
115 * Implementation of AtkObject->ref_child callback.
117 * @param obj AtkObject instance
118 * @param i index of child to ref
120 * @returns AtkObject representing the specified accessible child of the
124 eail_notify_ref_child(AtkObject *obj, gint i)
126 Evas_Object *nested_widget = NULL;
129 nested_widget = _eail_get_nested_widget(obj);
130 atk_obj = eail_factory_get_accessible(nested_widget);
133 g_object_ref(atk_obj);
139 * @brief Destructor for EailNotify object
141 * @param object GObject instance to be finalized
144 eail_notify_finalize(GObject *object)
146 G_OBJECT_CLASS(eail_notify_parent_class)->finalize(object);
150 * @brief Initializer for EailNotify GObject class
152 * Defines callbacks for base AtkObject.
154 * @param klass EailNotifyClass instance
157 eail_notify_class_init(EailNotifyClass *klass)
159 AtkObjectClass *class = ATK_OBJECT_CLASS(klass);
160 GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
161 class->initialize = eail_notify_initialize;
162 class->get_n_children = eail_notify_get_n_children;
163 class->ref_child = eail_notify_ref_child;
164 gobject_class->finalize = eail_notify_finalize;