summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/test_ui_slider_interval.c13
-rw-r--r--src/lib/efl/interfaces/efl_ui_format.c2
-rw-r--r--src/lib/elementary/efl_ui_slider.c202
-rw-r--r--src/lib/elementary/efl_ui_slider.eo47
-rw-r--r--src/lib/elementary/efl_ui_slider_part.eo9
-rw-r--r--src/lib/elementary/efl_ui_slider_private.h12
-rw-r--r--src/lib/elementary/elm_slider_legacy.h52
8 files changed, 214 insertions, 124 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index ea0e6bc..1c41f58 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -57,6 +57,7 @@ elm_public_eolian_files = \
57 lib/elementary/efl_ui_multibuttonentry_part.eo \ 57 lib/elementary/efl_ui_multibuttonentry_part.eo \
58 lib/elementary/efl_ui_panes_part.eo \ 58 lib/elementary/efl_ui_panes_part.eo \
59 lib/elementary/efl_ui_progressbar_part.eo \ 59 lib/elementary/efl_ui_progressbar_part.eo \
60 lib/elementary/efl_ui_slider_part.eo \
60 lib/elementary/efl_ui_textpath_part.eo \ 61 lib/elementary/efl_ui_textpath_part.eo \
61 lib/elementary/efl_ui_widget_part.eo \ 62 lib/elementary/efl_ui_widget_part.eo \
62 lib/elementary/efl_ui_win_part.eo \ 63 lib/elementary/efl_ui_win_part.eo \
diff --git a/src/bin/elementary/test_ui_slider_interval.c b/src/bin/elementary/test_ui_slider_interval.c
index 518528e..ebd3d3d 100644
--- a/src/bin/elementary/test_ui_slider_interval.c
+++ b/src/bin/elementary/test_ui_slider_interval.c
@@ -44,7 +44,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
44 efl_text_set(efl_added, "Horizontal"), 44 efl_text_set(efl_added, "Horizontal"),
45 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_NONE), 45 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_NONE),
46 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(160, 0)), 46 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(160, 0)),
47 efl_ui_slider_indicator_format_set(efl_added, "%1.5f"), 47 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.5f"),
48 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9), 48 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
49 efl_pack(bx, efl_added)); 49 efl_pack(bx, efl_added));
50 50
@@ -53,7 +53,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
53 efl_text_set(efl_added, "Manual step"), 53 efl_text_set(efl_added, "Manual step"),
54 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)), 54 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
55 efl_ui_format_string_set(efl_added, "%1.1f units"), 55 efl_ui_format_string_set(efl_added, "%1.1f units"),
56 efl_ui_slider_indicator_format_set(efl_added, "%1.1f"), 56 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.1f"),
57 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9), 57 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
58 efl_ui_slider_step_set(efl_added, step), 58 efl_ui_slider_step_set(efl_added, step),
59 efl_pack(bx, efl_added)); 59 efl_pack(bx, efl_added));
@@ -62,7 +62,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
62 efl_text_set(efl_added, "Disabled"), 62 efl_text_set(efl_added, "Disabled"),
63 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)), 63 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
64 efl_ui_format_string_set(efl_added, "%1.0f units"), 64 efl_ui_format_string_set(efl_added, "%1.0f units"),
65 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"), 65 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.0f"),
66 efl_ui_range_min_max_set(efl_added, 10, 145), 66 efl_ui_range_min_max_set(efl_added, 10, 145),
67 efl_ui_slider_interval_value_set(efl_added, 50, 100), 67 efl_ui_slider_interval_value_set(efl_added, 50, 100),
68 efl_ui_slider_step_set(efl_added, step), 68 efl_ui_slider_step_set(efl_added, step),
@@ -77,7 +77,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
77 efl_text_set(efl_added, "Vertical"), 77 efl_text_set(efl_added, "Vertical"),
78 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)), 78 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
79 efl_ui_format_string_set(efl_added, "%1.0f units"), 79 efl_ui_format_string_set(efl_added, "%1.0f units"),
80 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"), 80 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.0f"),
81 efl_ui_range_min_max_set(efl_added, 10, 145), 81 efl_ui_range_min_max_set(efl_added, 10, 145),
82 efl_ui_slider_interval_value_set(efl_added, 50, 100), 82 efl_ui_slider_interval_value_set(efl_added, 50, 100),
83 efl_ui_slider_step_set(efl_added, step), 83 efl_ui_slider_step_set(efl_added, step),
@@ -88,9 +88,8 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
88 efl_text_set(efl_added, "Disabled"), 88 efl_text_set(efl_added, "Disabled"),
89 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)), 89 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
90 efl_ui_format_string_set(efl_added, "%1.0f units"), 90 efl_ui_format_string_set(efl_added, "%1.0f units"),
91 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"), 91 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.0f"),
92 efl_ui_range_min_max_set(efl_added, 10, 145), 92 efl_ui_range_min_max_set(efl_added, 10, 145),
93 efl_ui_slider_interval_value_set(efl_added, 50, 100),
94 efl_ui_slider_step_set(efl_added, step), 93 efl_ui_slider_step_set(efl_added, step),
95 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL), 94 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
96 elm_object_disabled_set(efl_added, EINA_TRUE), 95 elm_object_disabled_set(efl_added, EINA_TRUE),
@@ -101,7 +100,7 @@ test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
101 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS), 100 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS),
102 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(260, 0)), 101 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(260, 0)),
103 efl_ui_format_string_set(efl_added, "%1.0f units"), 102 efl_ui_format_string_set(efl_added, "%1.0f units"),
104 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"), 103 efl_ui_format_string_set(efl_part(efl_added, "indicator"), "%1.0f"),
105 efl_ui_range_min_max_set(efl_added, 0, 600), 104 efl_ui_range_min_max_set(efl_added, 0, 600),
106 efl_ui_slider_interval_value_set(efl_added, 100, 500), 105 efl_ui_slider_interval_value_set(efl_added, 100, 500),
107 efl_ui_slider_step_set(efl_added, step), 106 efl_ui_slider_step_set(efl_added, step),
diff --git a/src/lib/efl/interfaces/efl_ui_format.c b/src/lib/efl/interfaces/efl_ui_format.c
index 6cb64f3..c0dd9d6 100644
--- a/src/lib/efl/interfaces/efl_ui_format.c
+++ b/src/lib/efl/interfaces/efl_ui_format.c
@@ -38,7 +38,7 @@ _default_format_free_cb(void *data)
38{ 38{
39 Efl_Ui_Format_Data *sd = data; 39 Efl_Ui_Format_Data *sd = data;
40 40
41 if (sd->template) 41 if (sd && sd->template)
42 { 42 {
43 eina_stringshare_del(sd->template); 43 eina_stringshare_del(sd->template);
44 sd->template = NULL; 44 sd->template = NULL;
diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c
index 919e0b7..8362b06 100644
--- a/src/lib/elementary/efl_ui_slider.c
+++ b/src/lib/elementary/efl_ui_slider.c
@@ -12,6 +12,8 @@
12#include "elm_priv.h" 12#include "elm_priv.h"
13#include "efl_ui_slider_private.h" 13#include "efl_ui_slider_private.h"
14#include "elm_widget_layout.h" 14#include "elm_widget_layout.h"
15
16#include "efl_ui_slider_part.eo.h"
15#include "elm_part_helper.h" 17#include "elm_part_helper.h"
16 18
17#define MY_CLASS EFL_UI_SLIDER_CLASS 19#define MY_CLASS EFL_UI_SLIDER_CLASS
@@ -260,54 +262,35 @@ _indicator_set(Evas_Object *obj)
260{ 262{
261 EFL_UI_SLIDER_DATA_GET(obj, sd); 263 EFL_UI_SLIDER_DATA_GET(obj, sd);
262 264
263 if (sd->indicator_format_func) 265 Eina_Value val;
264 { 266 const char *str;
265 char *buf;
266 267
267 buf = sd->indicator_format_func(sd->val); 268 if (!sd->indi_format_cb) return;
268 elm_layout_text_set(obj, "elm.indicator", buf);
269 elm_layout_text_set(obj, "elm.dragable.slider:elm.indicator", buf);
270 if (sd->popup)
271 edje_object_part_text_set(sd->popup, "elm.indicator", buf);
272 if (sd->popup2)
273 {
274 if (sd->indicator_format_free) sd->indicator_format_free(buf);
275 buf = sd->indicator_format_func(sd->intvl_to);
276 elm_layout_text_set(obj, "elm.dragable2.slider:elm.indicator", buf);
277 edje_object_part_text_set(sd->popup2, "elm.indicator", buf);
278 }
279 269
280 if (sd->indicator_format_free) sd->indicator_format_free(buf); 270 eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
281 } 271 eina_strbuf_reset(sd->indi_format_strbuf);
282 else if (sd->indicator)
283 {
284 char buf[1024];
285 272
286 snprintf(buf, sizeof(buf), sd->indicator, sd->val); 273 eina_value_set(&val, sd->val);
287 elm_layout_text_set(obj, "elm.indicator", buf); 274 sd->indi_format_cb(sd->indi_format_cb_data, sd->indi_format_strbuf, val);
288 elm_layout_text_set(obj, "elm.dragable.slider:elm.indicator", buf); 275
289 if (sd->popup) 276 str = eina_strbuf_string_get(sd->indi_format_strbuf);
290 edje_object_part_text_set(sd->popup, "elm.indicator", buf); 277
291 if (sd->popup2) 278 elm_layout_text_set(obj, "elm.indicator", str);
292 { 279 elm_layout_text_set(obj, "elm.dragable.slider:elm.indicator", str);
293 memset(buf, 0, 1024); 280 if (sd->popup)
294 snprintf(buf, sizeof(buf), sd->indicator, sd->intvl_to); 281 edje_object_part_text_set(sd->popup, "elm.indicator", str);
295 elm_layout_text_set(obj, "elm.dragable2.slider:elm.indicator", buf); 282
296 edje_object_part_text_set(sd->popup2, "elm.indicator", buf); 283 if (sd->popup2)
297 }
298 }
299 else
300 { 284 {
301 elm_layout_text_set(obj, "elm.indicator", NULL); 285 eina_strbuf_reset(sd->indi_format_strbuf);
302 elm_layout_text_set(obj, "elm.dragable.slider:elm.indicator", NULL); 286 eina_value_set(&val, sd->intvl_to);
303 if (sd->popup) 287 sd->indi_format_cb(sd->indi_format_cb_data, sd->indi_format_strbuf, val);
304 edje_object_part_text_set(sd->popup, "elm.indicator", NULL); 288 str = eina_strbuf_string_get(sd->indi_format_strbuf);
305 if (sd->popup2) 289 elm_layout_text_set(obj, "elm.dragable2.slider:elm.indicator", str);
306 { 290 edje_object_part_text_set(sd->popup2, "elm.indicator", str);
307 elm_layout_text_set(obj, "elm.dragable2.slider:elm.indicator", NULL);
308 edje_object_part_text_set(sd->popup2, "elm.indicator", NULL);
309 }
310 } 291 }
292
293 eina_value_flush(&val);
311} 294}
312 295
313static void 296static void
@@ -1171,12 +1154,14 @@ _efl_ui_slider_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Slider_Data *priv)
1171EOLIAN static void 1154EOLIAN static void
1172_efl_ui_slider_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Slider_Data *sd) 1155_efl_ui_slider_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Slider_Data *sd)
1173{ 1156{
1174 eina_stringshare_del(sd->indicator);
1175 ecore_timer_del(sd->delay); 1157 ecore_timer_del(sd->delay);
1176 ecore_timer_del(sd->wheel_indicator_timer); 1158 ecore_timer_del(sd->wheel_indicator_timer);
1177 evas_object_del(sd->popup); 1159 evas_object_del(sd->popup);
1178 evas_object_del(sd->popup2); 1160 evas_object_del(sd->popup2);
1179 1161
1162 ELM_SAFE_FREE(sd->indi_template, eina_stringshare_del);
1163 eina_strbuf_free(sd->indi_format_strbuf);
1164
1180 efl_ui_format_cb_set(obj, NULL, NULL, NULL); 1165 efl_ui_format_cb_set(obj, NULL, NULL, NULL);
1181 eina_strbuf_free(sd->format_strbuf); 1166 eina_strbuf_free(sd->format_strbuf);
1182 1167
@@ -1209,19 +1194,6 @@ _efl_ui_slider_efl_ui_direction_direction_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider
1209} 1194}
1210 1195
1211EOLIAN static void 1196EOLIAN static void
1212_efl_ui_slider_indicator_format_set(Eo *obj, Efl_Ui_Slider_Data *sd, const char *indicator)
1213{
1214 eina_stringshare_replace(&sd->indicator, indicator);
1215 evas_object_smart_changed(obj);
1216}
1217
1218EOLIAN static const char*
1219_efl_ui_slider_indicator_format_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd)
1220{
1221 return sd->indicator;
1222}
1223
1224EOLIAN static void
1225_efl_ui_slider_efl_ui_range_range_min_max_set(Eo *obj, Efl_Ui_Slider_Data *sd, double min, double max) 1197_efl_ui_slider_efl_ui_range_range_min_max_set(Eo *obj, Efl_Ui_Slider_Data *sd, double min, double max)
1226{ 1198{
1227 if ((sd->val_min == min) && (sd->val_max == max)) return; 1199 if ((sd->val_min == min) && (sd->val_max == max)) return;
@@ -1260,14 +1232,6 @@ _efl_ui_slider_efl_ui_range_range_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Slider_D
1260} 1232}
1261 1233
1262EOLIAN static void 1234EOLIAN static void
1263_efl_ui_slider_indicator_format_function_set(Eo *obj, Efl_Ui_Slider_Data *sd, slider_func_type func, slider_freefunc_type free_func)
1264{
1265 sd->indicator_format_func = func;
1266 sd->indicator_format_free = free_func;
1267 evas_object_smart_changed(obj);
1268}
1269
1270EOLIAN static void
1271_efl_ui_slider_indicator_show_set(Eo *obj, Efl_Ui_Slider_Data *sd, Eina_Bool show) 1235_efl_ui_slider_indicator_show_set(Eo *obj, Efl_Ui_Slider_Data *sd, Eina_Bool show)
1272{ 1236{
1273 if (show) 1237 if (show)
@@ -1477,6 +1441,89 @@ _slider_span_size_set(Eo *obj, Efl_Ui_Slider_Data *sd, int size)
1477 evas_object_smart_changed(obj); 1441 evas_object_smart_changed(obj);
1478} 1442}
1479 1443
1444/* Efl.Part begin */
1445
1446EOLIAN static Eo *
1447_efl_ui_slider_efl_part_part(const Eo *obj, Efl_Ui_Slider_Data *sd EINA_UNUSED, const char *part)
1448{
1449 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
1450
1451 if (eina_streq(part, "indicator"))
1452 return ELM_PART_IMPLEMENT(EFL_UI_SLIDER_PART_CLASS, obj, part);
1453
1454 return efl_part(efl_super(obj, MY_CLASS), part);
1455}
1456
1457EOLIAN static void
1458_efl_ui_slider_part_efl_ui_format_format_cb_set(Eo *obj, void *_pd EINA_UNUSED, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
1459{
1460 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
1461 Efl_Ui_Slider_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_SLIDER_CLASS);
1462
1463 if (sd->indi_format_cb_data == func_data && sd->indi_format_cb == func)
1464 return;
1465
1466 if (sd->indi_format_cb_data && sd->indi_format_free_cb)
1467 sd->indi_format_free_cb(sd->format_cb_data);
1468
1469 sd->indi_format_cb = func;
1470 sd->indi_format_cb_data = func_data;
1471 sd->indi_format_free_cb = func_free_cb;
1472 if (!sd->indi_format_strbuf) sd->indi_format_strbuf = eina_strbuf_new();
1473
1474 efl_canvas_group_change(pd->obj);
1475}
1476
1477static void
1478_indi_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
1479{
1480 const Eina_Value_Type *type = eina_value_type_get(&value);
1481 Efl_Ui_Slider_Data *sd = data;
1482 double v;
1483
1484 if (type != EINA_VALUE_TYPE_DOUBLE) return;
1485
1486 eina_value_get(&value, &v);
1487 eina_strbuf_append_printf(str, sd->indi_template, v);
1488}
1489
1490static void
1491_indi_default_format_free_cb(void *data)
1492{
1493 Efl_Ui_Slider_Data *sd = data;
1494
1495 if (sd && sd->indi_template)
1496 {
1497 eina_stringshare_del(sd->indi_template);
1498 sd->indi_template = NULL;
1499 }
1500}
1501
1502EOLIAN static void
1503_efl_ui_slider_part_efl_ui_format_format_string_set(Eo *obj, void *_pd EINA_UNUSED, const char *template)
1504{
1505 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
1506 Efl_Ui_Slider_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_SLIDER_CLASS);
1507
1508 if (!template) return;
1509 eina_stringshare_replace(&sd->indi_template, template);
1510
1511 efl_ui_format_cb_set(efl_part(pd->obj, "indicator"), sd, _indi_default_format_cb, _indi_default_format_free_cb);
1512}
1513
1514EOLIAN static const char *
1515_efl_ui_slider_part_efl_ui_format_format_string_get(Eo *obj, void *_pd EINA_UNUSED)
1516{
1517 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
1518 Efl_Ui_Slider_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_SLIDER_CLASS);
1519
1520 return sd->indi_template;
1521}
1522
1523#include "efl_ui_slider_part.eo.c"
1524
1525/* Efl.Part end */
1526
1480/* Legacy APIs */ 1527/* Legacy APIs */
1481 1528
1482EAPI Evas_Object * 1529EAPI Evas_Object *
@@ -1670,6 +1717,31 @@ elm_slider_min_max_get(const Evas_Object *obj, double *min, double *max)
1670 efl_ui_range_min_max_get(obj, min, max); 1717 efl_ui_range_min_max_get(obj, min, max);
1671} 1718}
1672 1719
1720EAPI void
1721elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator)
1722{
1723 efl_ui_format_string_set(efl_part(obj, "indicator"), indicator);
1724}
1725
1726EAPI const char *
1727elm_slider_indicator_format_get(const Evas *obj)
1728{
1729 return efl_ui_format_string_get(efl_part(obj, "indicator"));
1730}
1731
1732EAPI void
1733elm_slider_indicator_format_function_set(Evas_Object *obj, slider_func_type func, slider_freefunc_type free_func)
1734{
1735 Slider_Format_Wrapper_Data *sfwd = malloc(sizeof(Slider_Format_Wrapper_Data));
1736
1737 sfwd->format_cb = func;
1738 sfwd->format_free_cb = free_func;
1739
1740 efl_ui_format_cb_set(efl_part(obj, "indicator"), sfwd,
1741 _format_legacy_to_format_eo_cb,
1742 _format_legacy_to_format_eo_free_cb);
1743}
1744
1673/* Internal EO APIs and hidden overrides */ 1745/* Internal EO APIs and hidden overrides */
1674 1746
1675ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_slider) 1747ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(efl_ui_slider)
diff --git a/src/lib/elementary/efl_ui_slider.eo b/src/lib/elementary/efl_ui_slider.eo
index 609c3fa..0368087 100644
--- a/src/lib/elementary/efl_ui_slider.eo
+++ b/src/lib/elementary/efl_ui_slider.eo
@@ -8,46 +8,12 @@ class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
8 [[Elementary slider class]] 8 [[Elementary slider class]]
9 legacy_prefix: elm_slider; 9 legacy_prefix: elm_slider;
10 methods { 10 methods {
11 @property indicator_format {
12 set {
13 [[Set the format string for the indicator label.
14
15 The slider may display its value somewhere else then unit label,
16 for example, above the slider knob that is dragged around. This
17 function sets the format string used for this.
18
19 If $null, indicator label won't be visible. If not it sets the
20 format string for the label text. To the label text is provided
21 a floating point value, so the label text can display up to 1
22 floating point value. Note that this is optional.
23
24 Use a format string such as "%1.2f meters" for example, and it
25 will display values like: "3.14 meters" for a value equal to
26 3.14159.
27
28 Default is indicator label disabled.
29 ]]
30 }
31 get {
32 [[Get the indicator label format of the slider.
33
34 The slider may display its value somewhere else then unit label,
35 for example, above the slider knob that is dragged around. This
36 function gets the format string used for this.
37 ]]
38 }
39 values {
40 indicator: string @nullable; [[The format string for the indicator display.]]
41 }
42 }
43 @property indicator_show { 11 @property indicator_show {
44 set { 12 set {
45 [[Set whether to enlarge slider indicator (augmented knob) or not. 13 [[Set whether to enlarge slider indicator (augmented knob) or not.
46 14
47 By default, indicator will be bigger while dragged by the user. 15 By default, indicator will be bigger while dragged by the user.
48 16
49 Warning: It won't display values set with @.indicator_format.set
50 if you disable indicator.
51 ]] 17 ]]
52 } 18 }
53 get { 19 get {
@@ -98,18 +64,6 @@ class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
98 indicator_visible_mode: Efl.Ui.Slider.Indicator_Visible_Mode; [[The indicator visible mode.]] 64 indicator_visible_mode: Efl.Ui.Slider.Indicator_Visible_Mode; [[The indicator visible mode.]]
99 } 65 }
100 } 66 }
101 @property indicator_format_function {
102 set {
103 [[Set the format function pointer for the indicator label
104
105 Set the callback function to format the indicator string.
106 ]]
107 }
108 values {
109 func: slider_func_type @nullable; [[The indicator format function.]]
110 free_func: slider_freefunc_type @nullable; [[The freeing function for the format string.]]
111 }
112 }
113 } 67 }
114 implements { 68 implements {
115 class.constructor; 69 class.constructor;
@@ -130,6 +84,7 @@ class Efl.Ui.Slider (Efl.Ui.Layout, Efl.Ui.Range, Efl.Ui.Direction,
130 Efl.Text.Markup.markup { get; set; } 84 Efl.Text.Markup.markup { get; set; }
131 Efl.Ui.Format.format_cb { set; } 85 Efl.Ui.Format.format_cb { set; }
132 Efl.Ui.Translatable.translatable_text { get; set; } 86 Efl.Ui.Translatable.translatable_text { get; set; }
87 Efl.Part.part;
133 } 88 }
134 events { 89 events {
135 changed; [[Called when slider changed]] 90 changed; [[Called when slider changed]]
diff --git a/src/lib/elementary/efl_ui_slider_part.eo b/src/lib/elementary/efl_ui_slider_part.eo
new file mode 100644
index 0000000..70d81de
--- /dev/null
+++ b/src/lib/elementary/efl_ui_slider_part.eo
@@ -0,0 +1,9 @@
1class Efl.Ui.Slider.Part (Efl.Ui.Layout.Part, Efl.Ui.Format)
2{
3 [[Elementary slider internal part class]]
4 data: null;
5 implements {
6 Efl.Ui.Format.format_cb { set; }
7 Efl.Ui.Format.format_string { set; get; }
8 }
9}
diff --git a/src/lib/elementary/efl_ui_slider_private.h b/src/lib/elementary/efl_ui_slider_private.h
index d79a1cc..c5baa83 100644
--- a/src/lib/elementary/efl_ui_slider_private.h
+++ b/src/lib/elementary/efl_ui_slider_private.h
@@ -29,11 +29,6 @@ struct _Efl_Ui_Slider_Data
29 Evas_Object *spacer, *popup, *popup2, *track, *track2; 29 Evas_Object *spacer, *popup, *popup2, *track, *track2;
30 Ecore_Timer *delay; 30 Ecore_Timer *delay;
31 31
32 const char *indicator;
33
34 char *(*indicator_format_func)(double val);
35 void (*indicator_format_free)(char *str);
36
37 double val, val_min, val_max, val2, step; 32 double val, val_min, val_max, val2, step;
38 33
39 Ecore_Timer *wheel_indicator_timer; 34 Ecore_Timer *wheel_indicator_timer;
@@ -52,6 +47,13 @@ struct _Efl_Ui_Slider_Data
52 void *format_cb_data; 47 void *format_cb_data;
53 Eina_Strbuf *format_strbuf; 48 Eina_Strbuf *format_strbuf;
54 49
50 Efl_Ui_Format_Func_Cb indi_format_cb;
51 Eina_Free_Cb indi_format_free_cb;
52 void *indi_format_cb_data;
53 Eina_Strbuf *indi_format_strbuf;
54 const char *indi_template;
55
56
55 Eina_Bool indicator_show : 1; 57 Eina_Bool indicator_show : 1;
56 Eina_Bool spacer_down : 1; 58 Eina_Bool spacer_down : 1;
57 Eina_Bool frozen : 1; 59 Eina_Bool frozen : 1;
diff --git a/src/lib/elementary/elm_slider_legacy.h b/src/lib/elementary/elm_slider_legacy.h
index 07d29c1..89df6f1 100644
--- a/src/lib/elementary/elm_slider_legacy.h
+++ b/src/lib/elementary/elm_slider_legacy.h
@@ -231,4 +231,56 @@ EAPI void elm_slider_range_set(Evas_Object *obj, double from, double to);
231 */ 231 */
232EAPI void elm_slider_range_get(const Evas_Object *obj, double *from, double *to); 232EAPI void elm_slider_range_get(const Evas_Object *obj, double *from, double *to);
233 233
234/**
235 * @brief Set the format string for the indicator label.
236 *
237 * The slider may display its value somewhere else then unit label, for
238 * example, above the slider knob that is dragged around. This function sets
239 * the format string used for this.
240 *
241 * If @c null, indicator label won't be visible. If not it sets the format
242 * string for the label text. To the label text is provided a floating point
243 * value, so the label text can display up to 1 floating point value. Note that
244 * this is optional.
245 *
246 * Use a format string such as "%1.2f meters" for example, and it will display
247 * values like: "3.14 meters" for a value equal to 3.14159.
248 *
249 * Default is indicator label disabled.
250 *
251 * @param[in] obj The object.
252 * @param[in] indicator The format string for the indicator display.
253 *
254 * @ingroup Elm_Slider
255 */
256 EAPI void elm_slider_indicator_format_set(Evas_Object *obj, const char *indicator);
257
258 /**
259 * @brief Get the indicator label format of the slider.
260 *
261 * The slider may display its value somewhere else then unit label, for
262 * example, above the slider knob that is dragged around. This function gets
263 * the format string used for this.
264 *
265 * @param[in] obj The object.
266 *
267 * @return The format string for the indicator display.
268 *
269 * @ingroup Elm_Slider
270 */
271 EAPI const char *elm_slider_indicator_format_get(const Evas_Object *obj);
272
273 /**
274 * @brief Set the format function pointer for the indicator label
275 *
276 * Set the callback function to format the indicator string.
277 *
278 * @param[in] obj The object.
279 * @param[in] func The indicator format function.
280 * @param[in] free_func The freeing function for the format string.
281 *
282 * @ingroup Elm_Slider
283 */
284EAPI void elm_slider_indicator_format_function_set(Evas_Object *obj, slider_func_type func, slider_freefunc_type free_func);
285
234#include "efl_ui_slider.eo.legacy.h" 286#include "efl_ui_slider.eo.legacy.h"