1 #include <Elementary.h>
5 * @defgroup Separator Separator
8 * A separator is a widget that adds a very thin object to separate other objects.
9 * A separator can be vertical or horizontal.
12 typedef struct _Widget_Data Widget_Data;
20 static const char *widtype = NULL;
21 static void _del_hook(Evas_Object *obj);
22 static void _theme_hook(Evas_Object *obj);
23 static void _sizing_eval(Evas_Object *obj);
26 _del_hook(Evas_Object *obj)
28 Widget_Data *wd = elm_widget_data_get(obj);
34 _theme_hook(Evas_Object *obj)
36 Widget_Data *wd = elm_widget_data_get(obj);
39 _elm_theme_object_set(obj, wd->sep, "separator", "horizontal", elm_widget_style_get(obj));
41 _elm_theme_object_set(obj, wd->sep, "separator", "vertical", elm_widget_style_get(obj));
42 edje_object_scale_set(wd->sep, elm_widget_scale_get(obj) * _elm_config->scale);
47 _sizing_eval(Evas_Object *obj)
49 Widget_Data *wd = elm_widget_data_get(obj);
50 Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
52 edje_object_size_min_calc(wd->sep, &minw, &minh);
53 evas_object_size_hint_min_set(obj, minw, minh);
54 evas_object_size_hint_max_set(obj, maxw, maxh);
55 evas_object_size_hint_align_set(obj, maxw, maxh);
59 * Add a separator object to @p parent
61 * @param parent The parent object
63 * @return The separator object, or NULL upon failure
68 elm_separator_add(Evas_Object *parent)
74 wd = ELM_NEW(Widget_Data);
75 e = evas_object_evas_get(parent);
76 obj = elm_widget_add(e);
77 ELM_SET_WIDTYPE(widtype, "separator");
78 wd->horizontal = EINA_FALSE;
79 elm_widget_type_set(obj, "separator");
80 elm_widget_sub_object_add(parent, obj);
81 elm_widget_data_set(obj, wd);
82 elm_widget_del_hook_set(obj, _del_hook);
83 elm_widget_theme_hook_set(obj, _theme_hook);
84 elm_widget_can_focus_set(obj, 0);
86 wd->sep = edje_object_add(e);
87 _elm_theme_object_set(obj, wd->sep, "separator", "vertical", "default");
88 elm_widget_resize_object_set(obj, wd->sep);
94 * Set the horizontal mode of a separator object
96 * @param obj The separator object
97 * @param horizontal If true, the separator is horizontal
102 elm_separator_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
104 ELM_CHECK_WIDTYPE(obj, widtype);
105 Widget_Data *wd = elm_widget_data_get(obj);
107 horizontal = !!horizontal;
108 if (wd->horizontal == horizontal) return;
109 wd->horizontal = horizontal;
114 * Get the horizontal mode of a separator object
116 * @param obj The separator object
117 * @return If true, the separator is horizontal
122 elm_separator_horizontal_get(const Evas_Object *obj)
124 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
125 Widget_Data *wd = elm_widget_data_get(obj);
126 if (!wd) return EINA_FALSE;
127 return wd->horizontal;