1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #define EFL_ACCESS_OBJECT_PROTECTED
6
7 #include <Elementary.h>
8
9 #include "elm_priv.h"
10 #include "elm_separator_eo.h"
11 #include "elm_widget_separator.h"
12 #include "elm_widget_layout.h"
13
14 #define MY_CLASS ELM_SEPARATOR_CLASS
15
16 #define MY_CLASS_NAME "Elm_Separator"
17 #define MY_CLASS_NAME_LEGACY "elm_separator"
18
19 EOLIAN static Eina_Error
_elm_separator_efl_ui_widget_theme_apply(Eo * obj,Elm_Separator_Data * sd EINA_UNUSED)20 _elm_separator_efl_ui_widget_theme_apply(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
21 {
22 Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
23
24 if (sd->horizontal)
25 elm_widget_theme_element_set(obj, "horizontal");
26 else
27 elm_widget_theme_element_set(obj, "vertical");
28
29 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
30 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
31
32 return int_ret;
33 }
34
35 EOLIAN static void
_elm_separator_efl_canvas_group_group_add(Eo * obj,Elm_Separator_Data * sd EINA_UNUSED)36 _elm_separator_efl_canvas_group_group_add(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
37 {
38 efl_canvas_group_add(efl_super(obj, MY_CLASS));
39 elm_widget_can_focus_set(obj, EINA_FALSE);
40
41 if (!elm_layout_theme_set
42 (obj, "separator", "vertical", elm_widget_style_get(obj)))
43 CRI("Failed to set layout!");
44
45 elm_layout_sizing_eval(obj);
46 }
47
48 EAPI Evas_Object *
elm_separator_add(Evas_Object * parent)49 elm_separator_add(Evas_Object *parent)
50 {
51 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
52 return elm_legacy_add(MY_CLASS, parent);
53 }
54
55 EOLIAN static Eo *
_elm_separator_efl_object_constructor(Eo * obj,Elm_Separator_Data * sd EINA_UNUSED)56 _elm_separator_efl_object_constructor(Eo *obj, Elm_Separator_Data *sd EINA_UNUSED)
57 {
58 obj = efl_constructor(efl_super(obj, MY_CLASS));
59 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
60 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_SEPARATOR);
61 efl_ui_layout_finger_size_multiplier_set(obj, 0, 0);
62 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
63
64 return obj;
65 }
66
67 EOLIAN static void
_elm_separator_horizontal_set(Eo * obj,Elm_Separator_Data * sd,Eina_Bool horizontal)68 _elm_separator_horizontal_set(Eo *obj, Elm_Separator_Data *sd, Eina_Bool horizontal)
69 {
70 horizontal = !!horizontal;
71 if (sd->horizontal == horizontal) return;
72
73 sd->horizontal = horizontal;
74
75 efl_ui_widget_theme_apply(obj);
76 }
77
78 EOLIAN static Eina_Bool
_elm_separator_horizontal_get(const Eo * obj EINA_UNUSED,Elm_Separator_Data * sd)79 _elm_separator_horizontal_get(const Eo *obj EINA_UNUSED, Elm_Separator_Data *sd)
80 {
81 return sd->horizontal;
82 }
83
84 EOLIAN static void
_elm_separator_class_constructor(Efl_Class * klass)85 _elm_separator_class_constructor(Efl_Class *klass)
86 {
87 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
88 }
89
90 /* Internal EO APIs and hidden overrides */
91
92 #define ELM_SEPARATOR_EXTRA_OPS \
93 EFL_CANVAS_GROUP_ADD_OPS(elm_separator)
94
95 #include "elm_separator_eo.c"
96