Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / eail / eail_separator.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_separator.c
22  * @brief EailSeparator implementation
23  */
24
25 #include <Elementary.h>
26 #include "eail_separator.h"
27
28 /**
29  * @brief EailSeparator type definition
30  */
31 G_DEFINE_TYPE(EailSeparator, eail_separator, EAIL_TYPE_WIDGET);
32
33 /**
34  * @brief Gets the state set of the accessible
35  *
36  * The caller must unreference it when it is no longer needed.
37  *
38  * @param accessible AtkObject instance
39  * @return AtkStateSet representing the state set of the accessible
40  */
41 static AtkStateSet*
42 eail_separator_ref_state_set(AtkObject *accessible)
43 {
44    AtkStateSet *state_set;
45    Evas_Object *widget;
46
47    widget = eail_widget_get_widget(EAIL_WIDGET(accessible));
48    if (!widget) return NULL;
49
50    state_set = ATK_OBJECT_CLASS(eail_separator_parent_class)->ref_state_set(accessible);
51
52    if (elm_separator_horizontal_get(widget))
53      atk_state_set_add_state(state_set, ATK_STATE_HORIZONTAL);
54    else
55      atk_state_set_add_state(state_set, ATK_STATE_VERTICAL);
56
57    return state_set;
58 }
59
60 /**
61  * @brief EailSeparator initializer
62  *
63  * @param obj AtkObject instance
64  * @param data initialization data
65  */
66 static void
67 eail_separator_initialize(AtkObject *obj, gpointer data)
68 {
69    ATK_OBJECT_CLASS(eail_separator_parent_class)->initialize(obj, data);
70    obj->role = ATK_ROLE_SEPARATOR;
71 }
72
73 /**
74  * @brief EailSeparator interface initializer
75  *
76  * @param separator EailSeparator instance
77  */
78 static void
79 eail_separator_init(EailSeparator *separator)
80 {
81 }
82
83 /**
84  * @brief EailSeparator class initializer
85  *
86  * @param klass EailSeparatorClass instance
87  */
88 static void
89 eail_separator_class_init(EailSeparatorClass *klass)
90 {
91    AtkObjectClass *atk_class = ATK_OBJECT_CLASS(klass);
92    atk_class->initialize = eail_separator_initialize;
93    atk_class->ref_state_set = eail_separator_ref_state_set;
94 }