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 EailWeb implementation
26 #include <Elementary.h>
29 #include "eail_priv.h"
32 * @brief EailWeb GObject definition
34 * It extends EAIL_TYPE_WIDGET class
36 G_DEFINE_TYPE(EailWeb, eail_web, EAIL_TYPE_WIDGET);
39 * @brief Initializer for AtkObject
41 * @param obj AtkObject instance
42 * @param data initializer data
45 eail_web_initialize(AtkObject *obj, gpointer data)
47 ATK_OBJECT_CLASS(eail_web_parent_class) ->initialize(obj, data);
48 obj->role = ATK_ROLE_HTML_CONTAINER;
52 * @brief EailWeb instance initializer
54 * @param web EailWeb instance
57 eail_web_init(EailWeb *web)
63 * @brief Gets the number of accessible children of the accessible
65 * Implementation of AtkObject->get_n_children callback.
67 * @param obj AtkObject instance
69 * @returns integer representing the number of accessible children of
73 eail_web_get_n_children(AtkObject *obj)
75 /* impossible to get content so returning 0 */
80 * @brief Gets a reference to the specified accessible child of the object.
82 * The accessible children are 0-based so the first accessible child is at index 0,
83 * the second at index 1 and so on.
85 * Implementation of AtkObject->ref_child callback
87 * @param obj AtkObject instance
88 * @param i index of a child
90 * @returns AtkObject representing the specified accessible child of the
94 eail_web_ref_child(AtkObject *obj, gint i)
96 /* impossible to get content so returning NULL */
101 * @brief Destructor of EailWeb object
103 * @param object GObject instance
106 eail_web_finalize(GObject *object)
108 G_OBJECT_CLASS(eail_web_parent_class)->finalize(object);
112 * @brief Gets the accessible name of the accessible
114 * Implementation of get_name from AtkObject.
116 * @param object AtkObject instance
117 * @returns a string representing the first attribute from the
118 * following list which is not null:
119 * accessible name, uri, title, or NULL if all strings were NULL
122 eail_web_get_name(AtkObject *object)
125 const gchar *atk_name = NULL;
127 g_return_val_if_fail(EAIL_IS_WEB(object), NULL);
129 atk_name = ATK_OBJECT_CLASS(eail_web_parent_class)->get_name(object);
130 if (atk_name) return atk_name;
132 web = eail_widget_get_widget(EAIL_WIDGET(object));
133 if (!web) return NULL;
135 atk_name = elm_web_url_get(web);
136 if (atk_name) return atk_name;
138 atk_name = elm_web_title_get(web);
139 if (atk_name) return atk_name;
145 * @brief Initializer for EailWeb GObject class
147 * Defines callbacks for base AtkObject.
149 * @param klass EailWebClass instance
152 eail_web_class_init(EailWebClass *klass)
154 AtkObjectClass *class = ATK_OBJECT_CLASS(klass);
155 GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
156 class->initialize = eail_web_initialize;
157 class->get_name = eail_web_get_name;
158 class->get_n_children = eail_web_get_n_children;
159 class->ref_child = eail_web_ref_child;
160 gobject_class->finalize = eail_web_finalize;