1 #include <Elementary.h>
4 typedef struct _Widget_Data Widget_Data;
12 static const char *widtype = NULL;
13 static void _del_hook(Evas_Object *obj);
14 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
15 static void _theme_hook(Evas_Object *obj);
16 static void _sizing_eval(Evas_Object *obj);
19 _del_hook(Evas_Object *obj)
21 Widget_Data *wd = elm_widget_data_get(obj);
27 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
29 Widget_Data *wd = elm_widget_data_get(obj);
31 edje_object_mirrored_set(wd->sep, rtl);
35 _theme_hook(Evas_Object *obj)
37 Widget_Data *wd = elm_widget_data_get(obj);
39 _elm_widget_mirrored_reload(obj);
40 _mirrored_set(obj, elm_widget_mirrored_get(obj));
42 _elm_theme_object_set(obj, wd->sep, "separator", "horizontal", elm_widget_style_get(obj));
44 _elm_theme_object_set(obj, wd->sep, "separator", "vertical", elm_widget_style_get(obj));
45 edje_object_scale_set(wd->sep, elm_widget_scale_get(obj) * _elm_config->scale);
50 _sizing_eval(Evas_Object *obj)
52 Widget_Data *wd = elm_widget_data_get(obj);
53 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
55 edje_object_size_min_calc(wd->sep, &minw, &minh);
56 evas_object_size_hint_min_set(obj, minw, minh);
57 evas_object_size_hint_max_set(obj, maxw, maxh);
58 evas_object_size_hint_align_set(obj, maxw, maxh);
62 elm_separator_add(Evas_Object *parent)
68 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
70 ELM_SET_WIDTYPE(widtype, "separator");
71 wd->horizontal = EINA_FALSE;
72 elm_widget_type_set(obj, "separator");
73 elm_widget_sub_object_add(parent, obj);
74 elm_widget_data_set(obj, wd);
75 elm_widget_del_hook_set(obj, _del_hook);
76 elm_widget_theme_hook_set(obj, _theme_hook);
77 elm_widget_can_focus_set(obj, EINA_FALSE);
79 wd->sep = edje_object_add(e);
80 _elm_theme_object_set(obj, wd->sep, "separator", "vertical", "default");
81 elm_widget_resize_object_set(obj, wd->sep);
82 _mirrored_set(obj, elm_widget_mirrored_get(obj));
88 elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
90 ELM_CHECK_WIDTYPE(obj, widtype);
91 Widget_Data *wd = elm_widget_data_get(obj);
93 horizontal = !!horizontal;
94 if (wd->horizontal == horizontal) return;
95 wd->horizontal = horizontal;
100 elm_separator_horizontal_get(const Evas_Object *obj)
102 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
103 Widget_Data *wd = elm_widget_data_get(obj);
104 if (!wd) return EINA_FALSE;
105 return wd->horizontal;