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 EailPanel implementation
26 #include <Elementary.h>
27 #include "eail_panel.h"
30 * @brief EailPanel 'toggle' action name
32 #define EAIL_PANEL_TOGGLE_ACTION "toggle"
35 * @brief Definition of EailPanel as GObject
37 * EailFileselectorEntry is extended EAIL_TYPE_WIDGET with ATK_TYPE_ACTION
38 * interface implemented
40 G_DEFINE_TYPE(EailPanel, eail_panel, EAIL_TYPE_ACTION_WIDGET);
43 * @brief Gets a reference to the state set of the accessible
45 * The caller must unreference it when it is no longer needed.
47 * Implementation of AtkObject->ref_state_set callback.
49 * @param obj AtkObject instance
51 * @returns AtkStateSet representing the state set of the
55 eail_panel_ref_state_set(AtkObject *obj)
59 AtkStateSet *state_set;
61 g_return_val_if_fail(EAIL_IS_PANEL(obj), NULL);
63 state_set = ATK_OBJECT_CLASS(eail_panel_parent_class)->ref_state_set(obj);
64 widget = eail_widget_get_widget(EAIL_WIDGET(obj));
65 hidden = elm_panel_hidden_get(widget);
67 atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
73 * @brief Gets accessible children of a panel
75 * Implementation of eail_widget_get_widget_children callback from
78 * @param widget EailWidget instance
80 * @returns Eina_List representing a list of the panel widget's children
83 eail_panel_children_get(EailWidget *widget)
85 Evas_Object *obj, *child;
88 g_return_val_if_fail(EAIL_IS_PANEL(widget), NULL);
90 obj = eail_widget_get_widget(widget);
91 if (obj == NULL) return NULL;
92 child = elm_object_part_content_get(obj, "default");
93 if (child == NULL) return NULL;
96 list = eina_list_append(list, child);
102 * @brief Initializes the Action interface for panel
104 * @param action AtkAction instance
105 * @param data data passed to callback
106 * @returns TRUE on success, FALSE otherwise
109 eail_panel_action_toggle(AtkAction *action, void *data)
113 g_return_val_if_fail(EAIL_IS_PANEL(action), FALSE);
115 widget = eail_widget_get_widget(EAIL_WIDGET(action));
116 if (!widget) return FALSE;
118 elm_panel_toggle(widget);
124 * @brief Hooks EailPanel actions callbacks
126 * @param action_widget EailActionWidget instance
129 eail_panel_actions_init(EailActionWidget *action_widget)
131 eail_action_widget_action_append(action_widget,
132 EAIL_PANEL_TOGGLE_ACTION, NULL,
133 eail_panel_action_toggle);
137 * @brief Initializer for AtkObjectClass
139 * @param obj AtkObject instance
140 * @param data initialization data
143 eail_panel_initialize(AtkObject *obj, gpointer data)
145 ATK_OBJECT_CLASS(eail_panel_parent_class)->initialize(obj, data);
146 obj->role = ATK_ROLE_PANEL;
148 eail_panel_actions_init(EAIL_ACTION_WIDGET(obj));
152 * @brief Initializer for GObject class
154 * @param panel EailPanel instance
157 eail_panel_init(EailPanel *panel)
159 panel->toggle_description = NULL;
163 * @brief Destructor for panel object
165 * @param g_object GObject instance to be finalized
167 static void eail_panel_finalize(GObject *g_object)
169 EailPanel *panel = EAIL_PANEL(g_object);
170 if (panel->toggle_description)
172 free(panel->toggle_description);
173 panel->toggle_description = NULL;
175 G_OBJECT_CLASS(g_object)->finalize(g_object);
179 * @brief Initializer for GObject panel class
181 * Defines callbacks for base AtkObject.
183 * @param klass EailPanelClass instance
186 eail_panel_class_init(EailPanelClass *klass)
188 AtkObjectClass *class = ATK_OBJECT_CLASS(klass);
189 EailWidgetClass *widget_class = EAIL_WIDGET_CLASS(klass);
190 GObjectClass *g_object_class = G_OBJECT_CLASS(klass);
192 g_object_class->finalize = eail_panel_finalize;
194 widget_class->get_widget_children = eail_panel_children_get;
196 class->initialize = eail_panel_initialize;
197 class->ref_state_set = eail_panel_ref_state_set;