sl = elm_slider_add(win);
sl1 = sl;
- elm_slider_label_set(sl, "Label");
+ elm_slider_label_set(sl, "Horizontal");
elm_slider_icon_set(sl, ic);
elm_slider_unit_format_set(sl, "%1.1f units");
elm_slider_span_size_set(sl, 120);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
sl = elm_slider_add(win);
- elm_slider_label_set(sl, "Label 2");
+ elm_slider_label_set(sl, "Horizontal inverted");
elm_slider_end_set(sl, ic);
elm_slider_span_size_set(sl, 80);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
sl = elm_slider_add(win);
elm_slider_indicator_show_set(sl, EINA_FALSE);
- elm_slider_label_set(sl, "Label 3");
+ elm_slider_label_set(sl, "Scale doubled");
elm_slider_unit_format_set(sl, "%3.0f units");
elm_slider_span_size_set(sl, 40);
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
sl = elm_slider_add(win);
elm_slider_icon_set(sl, ic);
- elm_slider_label_set(sl, "Label 4");
+ elm_slider_label_set(sl, "Vertical inverted");
elm_slider_inverted_set(sl, 1);
elm_slider_unit_format_set(sl, "units");
elm_slider_span_size_set(sl, 60);
evas_object_show(ic);
evas_object_show(sl);
-
evas_object_smart_callback_add(sl1, "changed", _change_cb, sl);
+ sl = elm_slider_add(win);
+ elm_slider_label_set(sl, "Vertical");
+ elm_slider_unit_format_set(sl, "units");
+ elm_slider_span_size_set(sl, 60);
+ evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
+ elm_slider_indicator_format_set(sl, "%1.1f");
+ elm_slider_value_set(sl, 0.2);
+ elm_object_scale_set(sl, 1.0);
+ elm_slider_horizontal_set(sl, EINA_FALSE);
+ elm_box_pack_end(bx, sl);
+ evas_object_show(ic);
+ evas_object_show(sl);
+
evas_object_show(win);
}
#endif
Evas_Coord size;
};
+#define ELM_SLIDER_INVERTED_FACTOR (-1.0)
+
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
}
static void
+_drag_step(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
+{
+ _val_fetch(data);
+ _units_set(data);
+ _indicator_set(data);
+}
+
+static void
_drag_up(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
- Widget_Data *wd = elm_widget_data_get(data);
- edje_object_part_drag_step(wd->slider, "elm.dragable.slider", -0.05, -0.05);
+ double step;
+ Widget_Data *wd;
+
+ wd = elm_widget_data_get(data);
+ step = 0.05;
+
+ if (wd->inverted) step *= ELM_SLIDER_INVERTED_FACTOR;
+
+ edje_object_part_drag_step(wd->slider, "elm.dragable.slider", step, step);
}
static void
_drag_down(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
- Widget_Data *wd = elm_widget_data_get(data);
- edje_object_part_drag_step(wd->slider, "elm.dragable.slider", 0.05, 0.05);
+ double step;
+ Widget_Data *wd;
+
+ wd = elm_widget_data_get(data);
+ step = -0.05;
+
+ if (wd->inverted) step *= ELM_SLIDER_INVERTED_FACTOR;
+
+ edje_object_part_drag_step(wd->slider, "elm.dragable.slider", step, step);
}
/**
edje_object_signal_callback_add(wd->slider, "drag", "*", _drag, obj);
edje_object_signal_callback_add(wd->slider, "drag,start", "*", _drag_start, obj);
edje_object_signal_callback_add(wd->slider, "drag,stop", "*", _drag_stop, obj);
- edje_object_signal_callback_add(wd->slider, "drag,step", "*", _drag_stop, obj);
+ edje_object_signal_callback_add(wd->slider, "drag,step", "*", _drag_step, obj);
edje_object_signal_callback_add(wd->slider, "drag,page", "*", _drag_stop, obj);
// edje_object_signal_callback_add(wd->slider, "drag,set", "*", _drag_stop, obj);
edje_object_signal_callback_add(wd->slider, "mouse,wheel,0,-1", "*", _drag_up, obj);