elm_actionslider is updated as per the latest svn revision.
[framework/uifw/elementary.git] / src / lib / elm_actionslider.c
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4 /*
5  * SLP
6  * Copyright (c) 2009 Samsung Electronics, Inc.
7  * All rights reserved.
8  *
9  * This software is a confidential and proprietary information
10  * of Samsung Electronics, Inc. ("Confidential Information").  You
11  * shall not disclose such Confidential Information and shall use
12  * it only in accordance with the terms of the license agreement
13  * you entered into with Samsung Electronics.
14  */
15
16 /**
17  *
18  * @defgroup Actionslider Actionslider
19  * @ingroup Elementary
20  *
21  * This is an actionslider.
22  */
23
24 #include <Elementary.h>
25 #include <math.h>
26 #include "elm_priv.h"
27
28 /**
29  * internal data structure of actionslider object
30  */
31 typedef struct _Widget_Data Widget_Data;
32
33 struct _Widget_Data
34 {
35    Evas_Object  *as;            // actionslider
36    Evas_Object  *icon;          // an icon for a button or a bar
37    Evas_Object  *icon_fake;             // an icon for a button or a bar
38
39    // setting
40    Elm_Actionslider_Magnet_Pos  magnet_position, enabled_position;
41    const char *text_left, *text_right, *text_center, *text_button;
42
43    // status
44    Eina_Bool    mouse_down;
45    Eina_Bool    mouse_hold;
46
47    // icon animation
48    Ecore_Animator       *icon_animator;
49    double               final_position;
50 };
51
52 static void _del_hook(Evas_Object *obj);
53 static void _theme_hook(Evas_Object *obj);
54 static void _disable_hook(Evas_Object *obj);
55 static void _sizing_eval(Evas_Object *obj);
56 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
57
58 /*
59  * callback functions
60  */
61 static void _icon_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
62 static void _icon_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
63 static void _icon_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
64
65 /*
66  * internal functions
67  */
68 static Eina_Bool _icon_animation(void *data);
69
70 static const char *widtype = NULL;
71
72 #define SIG_CHANGED "position"
73 #define SIG_SELECTED "selected"
74
75 static const Evas_Smart_Cb_Description _signals[] =
76 {
77    {SIG_CHANGED, ""},
78    {SIG_SELECTED, ""},
79    {NULL, NULL}
80 };
81
82
83 static void
84 _del_hook(Evas_Object *obj)
85 {
86    Widget_Data *wd = elm_widget_data_get(obj);
87    if (!wd) return;
88    if (wd->icon) 
89      {
90         evas_object_del(wd->icon);
91         wd->icon = NULL;
92      }
93    if (wd->icon_fake) 
94      {
95         evas_object_del(wd->icon_fake);
96         wd->icon_fake = NULL;
97      }
98    if (wd->text_left) eina_stringshare_del(wd->text_left);
99    if (wd->text_right) eina_stringshare_del(wd->text_right);
100    if (wd->text_center) eina_stringshare_del(wd->text_center);
101    if (wd->text_button) eina_stringshare_del(wd->text_button);
102    if (wd->as) 
103      {
104         evas_object_smart_member_del(wd->as);
105         evas_object_del(wd->as);
106         wd->as = NULL;
107      }
108    free(wd);
109 }
110
111 static void
112 _sizing_eval(Evas_Object *obj)
113 {
114    Widget_Data *wd = elm_widget_data_get(obj);
115    Evas_Coord minw = -1, minh = -1;
116
117    if (!wd) return;
118    elm_coords_finger_size_adjust(1, &minw, 1, &minh);
119    evas_object_size_hint_min_set(wd->icon, minw, minh);
120    evas_object_size_hint_max_set(wd->icon, -1, -1);
121
122    minw = -1;
123    minh = -1;
124    elm_coords_finger_size_adjust(3, &minw, 1, &minh);
125    edje_object_size_min_restricted_calc(wd->as, &minw, &minh, minw, minh);
126    evas_object_size_hint_min_set(obj, minw, minh);
127    evas_object_size_hint_max_set(obj, -1, -1);
128 }
129
130 static void
131 _theme_hook(Evas_Object *obj)
132 {
133    Widget_Data *wd = elm_widget_data_get(obj);
134    if (!wd) return;
135    if (edje_object_part_swallow_get(wd->as, "elm.swallow.icon") == NULL) 
136      edje_object_part_unswallow(wd->as, wd->icon);
137    if (edje_object_part_swallow_get(wd->as, "elm.swallow.space") == NULL) 
138      edje_object_part_unswallow(wd->as, wd->icon_fake);
139
140    _elm_theme_object_set(obj, wd->as, "actionslider", "base", elm_widget_style_get(obj));
141    _elm_theme_object_set(obj, wd->icon, "actionslider", "icon", elm_widget_style_get(obj));
142    _elm_theme_object_set(obj, wd->icon_fake, "actionslider", "icon", elm_widget_style_get(obj));
143    edje_object_part_swallow(wd->as, "elm.swallow.icon", wd->icon);
144    edje_object_part_swallow(wd->as, "elm.swallow.space", wd->icon_fake);
145    edje_object_part_text_set(wd->as, "elm.text.left", wd->text_left);
146    edje_object_part_text_set(wd->as, "elm.text.right", wd->text_right);
147    edje_object_part_text_set(wd->as, "elm.text.center", wd->text_center);
148    edje_object_message_signal_process(wd->as);
149    //edje_object_scale_set(wd->as, elm_widget_scale_get(obj) * _elm_config->scale);
150    _sizing_eval(obj);
151 }
152
153 static void
154 _disable_hook(Evas_Object *obj)
155 {
156 //   Widget_Data *wd = elm_widget_data_get(obj);
157 /*
158    TODO
159    if (elm_widget_disabled_get(obj))
160      edje_object_signal_emit(wd->btn, "elm,state,disabled", "elm");
161    else
162      edje_object_signal_emit(wd->btn, "elm,state,enabled", "elm");
163 */
164 }
165
166 static void
167 _sub_del(void *data, Evas_Object *obj, void *event_info)
168 {
169 //   Widget_Data *wd = elm_widget_data_get(obj);
170 //   Evas_Object *sub = event_info;
171 }
172
173 static void
174 _icon_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
175 {
176    Widget_Data *wd = elm_widget_data_get((Evas_Object *)data);
177
178    wd->mouse_down = EINA_TRUE;
179 }
180
181 static void
182 _icon_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
183 {
184    Evas_Object *as = (Evas_Object *)data;
185    Widget_Data *wd = elm_widget_data_get(as);
186    double pos = 0.0;
187
188    elm_actionslider_hold(as, EINA_FALSE);
189    if (wd->mouse_down == EINA_FALSE) return;
190
191    edje_object_part_drag_value_get(wd->as, "elm.swallow.icon", &pos, NULL);
192
193    if (pos == 0.0) 
194      evas_object_smart_callback_call(as, SIG_CHANGED, "left");
195    else if (pos == 1.0) 
196      evas_object_smart_callback_call(as, SIG_CHANGED, "right");
197    else if (pos >= 0.495 && pos <= 0.505) 
198      evas_object_smart_callback_call(as, SIG_CHANGED, "center");
199
200 /*
201  * TODO
202 if (wd->type == ELM_ACTIONSLIDER_TYPE_BAR_GREEN ||
203 wd->type == ELM_ACTIONSLIDER_TYPE_BAR_RED ) {
204 if (pos == 1.0) {
205 //edje_object_signal_emit(wd->as, "elm,show,bar,text,center", "elm");
206 edje_object_signal_emit(wd->as, "elm,show,text,center", "elm");
207 } else {
208 //edje_object_signal_emit(wd->as, "elm,hide,bar,text,center", "elm");
209 edje_object_signal_emit(wd->as, "elm,hide,text,center", "elm");
210 }
211 }
212 */
213 }
214
215 static void
216 _icon_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
217 {
218    Widget_Data *wd = elm_widget_data_get((Evas_Object *)data);
219    double position = 0.0;
220
221    wd->mouse_down = EINA_FALSE;
222
223    if (wd->mouse_hold == EINA_FALSE) 
224      {
225         if (wd->magnet_position == ELM_ACTIONSLIDER_MAGNET_LEFT) 
226           wd->final_position = 0.0;
227         else if (wd->magnet_position == ELM_ACTIONSLIDER_MAGNET_RIGHT) 
228           wd->final_position = 1.0;
229         else if (wd->magnet_position == ELM_ACTIONSLIDER_MAGNET_CENTER) 
230           wd->final_position = 0.5; 
231         else if ( wd->magnet_position == ELM_ACTIONSLIDER_MAGNET_BOTH) 
232           {
233              edje_object_part_drag_value_get(wd->as, "elm.swallow.icon", &position, NULL);
234              if (position <= 0.5) 
235                wd->final_position = 0.0;
236              else 
237                wd->final_position = 1.0;
238           }
239         wd->icon_animator = ecore_animator_add(_icon_animation, wd);
240      }
241 }
242
243 static Eina_Bool
244 _icon_animation(void *data)
245 {
246    Widget_Data *wd = elm_widget_data_get(data);
247    double cur_position = 0.0, new_position = 0.0;
248    double move_amount = 0.05;
249    Eina_Bool flag_finish_animation = EINA_FALSE;
250    if (!wd) return EINA_FALSE;
251
252    edje_object_part_drag_value_get(wd->as, "elm.swallow.icon", &cur_position, NULL);
253
254    if ( (wd->final_position == 0.0) ||(wd->final_position == 0.5 && cur_position >= wd->final_position) ) 
255      {
256         new_position = cur_position - move_amount;
257         if (new_position <= wd->final_position) 
258           {
259              new_position = wd->final_position;
260              flag_finish_animation = EINA_TRUE;
261           }
262      } 
263    else if ((wd->final_position == 1.0) || (wd->final_position == 0.5 && cur_position < wd->final_position) ) 
264      {
265         new_position = cur_position + move_amount;
266         if (new_position >= wd->final_position) 
267           {
268              new_position = wd->final_position;
269              flag_finish_animation = EINA_TRUE;
270              /*
271              // TODO
272              if (wd->type == ELM_ACTIONSLIDER_TYPE_BAR_GREEN ||
273                wd->type == ELM_ACTIONSLIDER_TYPE_BAR_RED ) {
274                edje_object_signal_emit(wd->as, "elm,show,bar,text,center", "elm");
275              }
276              */
277           }
278      }
279    edje_object_part_drag_value_set(wd->as, "elm.swallow.icon", new_position, 0.5);
280
281    if (flag_finish_animation)
282      {
283         if ((!wd->final_position) &&
284             (wd->enabled_position & ELM_ACTIONSLIDER_MAGNET_LEFT))
285           evas_object_smart_callback_call(data, SIG_SELECTED,
286                                           (void *)wd->text_left);
287         else if ((wd->final_position == 0.5) &&
288                  (wd->enabled_position & ELM_ACTIONSLIDER_MAGNET_CENTER))
289           evas_object_smart_callback_call(data, SIG_SELECTED,
290                                           (void *)wd->text_center);
291         else if ((wd->final_position == 1) &&
292                  (wd->enabled_position & ELM_ACTIONSLIDER_MAGNET_RIGHT))
293           evas_object_smart_callback_call(data, SIG_SELECTED,
294                                           (void *)wd->text_right);
295         return EINA_FALSE;
296      }
297    return EINA_TRUE;
298
299 }
300
301 /**
302  * Add a new actionslider to the parent.
303  *
304  * @param[in] parent The parent object
305  * @return The new actionslider object or NULL if it cannot be created
306  *
307  * @ingroup Actionslider
308  */
309 EAPI Evas_Object *
310 elm_actionslider_add(Evas_Object *parent)
311 {
312    Evas_Object *obj;
313    Evas *e;
314    Widget_Data *wd = NULL;
315
316    wd = ELM_NEW(Widget_Data);
317    e = evas_object_evas_get(parent);
318    if (e == NULL) return NULL;
319    ELM_SET_WIDTYPE(widtype, "actionslider");
320    obj = elm_widget_add(e);
321    elm_widget_type_set(obj, "actionslider");
322    elm_widget_sub_object_add(parent, obj);
323    elm_widget_data_set(obj, wd);
324
325    elm_widget_del_hook_set(obj, _del_hook);
326    elm_widget_theme_hook_set(obj, _theme_hook);
327    elm_widget_disable_hook_set(obj, _disable_hook);
328
329    wd->mouse_down = EINA_FALSE;
330    wd->mouse_hold = EINA_FALSE;
331    wd->enabled_position = ELM_ACTIONSLIDER_MAGNET_ALL;
332
333    // load background edj
334    wd->as = edje_object_add(e);
335    if(wd->as == NULL) 
336      {
337         printf("Cannot load actionslider edj!\n");
338         return NULL;
339      }
340    _elm_theme_object_set(obj, wd->as, "actionslider", "base", "default");
341    elm_widget_resize_object_set(obj, wd->as);
342
343    // load icon
344    wd->icon = edje_object_add(e);
345    if (wd->icon == NULL) 
346      {
347         printf("Cannot load acitionslider icon!\n");
348         return NULL;
349      }
350    evas_object_smart_member_add(wd->icon, obj);
351    _elm_theme_object_set(obj, wd->icon, "actionslider", "icon", "default");
352    edje_object_part_swallow(wd->as, "elm.swallow.icon", wd->icon);
353
354    wd->icon_fake = edje_object_add(e);
355    evas_object_smart_member_add(wd->icon_fake, obj);
356    _elm_theme_object_set(obj, wd->icon_fake, "actionslider", "icon", "default");
357    edje_object_part_swallow(wd->as, "elm.swallow.space", wd->icon_fake);
358
359    // event callbacks
360    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
361    evas_object_event_callback_add(wd->icon, EVAS_CALLBACK_MOUSE_DOWN, _icon_down_cb, obj);
362    evas_object_event_callback_add(wd->icon, EVAS_CALLBACK_MOUSE_MOVE, _icon_move_cb, obj);
363    evas_object_event_callback_add(wd->icon, EVAS_CALLBACK_MOUSE_UP, _icon_up_cb, obj);
364
365    return obj;
366 }
367
368 /*
369 EAPI Evas_Object *
370 elm_actionslider_add_with_set(Evas_Object *parent, Elm_Actionslider_Icon_Pos pos, Elm_Actionslider_Magnet_Pos magnet, const char* label_left, const char* label_center, const char* label_right)
371 {
372    Evas_Object *obj;
373
374    obj = elm_actionslider_add(parent);
375
376    elm_actionslider_icon_set(obj, pos);
377    elm_actionslider_magnet_set(obj, magnet);
378    if (label_left != NULL)
379      elm_actionslider_label_set(obj, ELM_ACTIONSLIDER_LABEL_LEFT, label_left);
380    if (label_center != NULL)
381      elm_actionslider_label_set(obj, ELM_ACTIONSLIDER_LABEL_CENTER, label_center);
382    if (label_right != NULL)
383      elm_actionslider_label_set(obj, ELM_ACTIONSLIDER_LABEL_RIGHT, label_right);
384
385    return obj;
386 }
387 */
388
389 /**
390  * Set actionslider indicator position. 
391  *
392  * @param[in] obj The actionslider object. 
393  * @param[in] pos The position of the indicator.
394  * (ELM_ACTIONSLIDER_INDICATOR_LEFT, ELM_ACTIONSLIDER_INDICATOR_RIGHT,
395  *  ELM_ACTIONSLIDER_INDICATOR_CENTER)
396  *
397  * @ingroup Actionslider
398  */
399 EAPI void
400 elm_actionslider_indicator_pos_set(Evas_Object *obj, Elm_Actionslider_Indicator_Pos pos)
401 {
402    ELM_CHECK_WIDTYPE(obj, widtype);
403
404    Widget_Data *wd = elm_widget_data_get(obj);
405    double position = 0.0;
406
407    if (pos == ELM_ACTIONSLIDER_INDICATOR_LEFT) position = 0.0;
408    else if (pos == ELM_ACTIONSLIDER_INDICATOR_RIGHT) position = 1.0;
409    else if (pos == ELM_ACTIONSLIDER_INDICATOR_CENTER) position = 0.5;
410    else position = 0.0;
411
412    edje_object_part_drag_value_set(wd->as, "elm.swallow.icon", position, 0.5);
413 }
414
415 /**
416  * Get actionslider indicator position.
417  *
418  * @param obj The actionslider object.
419  * @return The position of the indicator.
420  *
421  * @ingroup Actionslider
422  */
423 EAPI Elm_Actionslider_Indicator_Pos
424 elm_actionslider_indicator_pos_get(const Evas_Object *obj)
425 {
426    ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_INDICATOR_NONE;
427    Widget_Data *wd = elm_widget_data_get(obj);
428    double position;
429    if (!wd) return ELM_ACTIONSLIDER_INDICATOR_NONE;
430
431    edje_object_part_drag_value_get(wd->as, "elm.swallow.icon", &position, NULL);
432    if (position < 0.3)
433      return ELM_ACTIONSLIDER_INDICATOR_LEFT;
434    else if (position < 0.7)
435      return ELM_ACTIONSLIDER_INDICATOR_CENTER;
436    else
437      return ELM_ACTIONSLIDER_INDICATOR_RIGHT;
438 }
439 /**
440  * Set actionslider magnet position. 
441  *
442  * @param[in] obj The actionslider object. 
443  * @param[in] pos The position of the magnet.
444  * (ELM_ACTIONSLIDER_MAGNET_LEFT, ELM_ACTIONSLIDER_MAGNET_RIGHT,
445  *  ELM_ACTIONSLIDER_MAGNET_BOTH, ELM_ACTIONSLIDER_MAGNET_CENTER)
446  *
447  * @ingroup Actionslider
448  */
449 EAPI void
450 elm_actionslider_magnet_pos_set(Evas_Object *obj, Elm_Actionslider_Magnet_Pos pos)
451 {
452    ELM_CHECK_WIDTYPE(obj, widtype);
453    Widget_Data *wd = elm_widget_data_get(obj);
454    wd->magnet_position = pos;
455 }
456
457 /**
458  * Get actionslider magnet position.
459  *
460  * @param obj The actionslider object.
461  * @return The positions with magnet property.
462  *
463  * @ingroup Actionslider
464  */
465 EAPI Elm_Actionslider_Magnet_Pos
466 elm_actionslider_magnet_pos_get(const Evas_Object *obj)
467 {
468    ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_MAGNET_NONE;
469    Widget_Data *wd = elm_widget_data_get(obj);
470    if (!wd) return ELM_ACTIONSLIDER_MAGNET_NONE;
471    return wd->magnet_position;
472 }
473
474 /**
475  * Set actionslider enabled position.
476  *
477  * All the positions are enabled by default.
478  *
479  * @param obj The actionslider object.
480  * @param pos Bit mask indicating the enabled positions.
481  * Example: use (ELM_ACTIONSLIDER_MAGNET_LEFT | ELM_ACTIONSLIDER_MAGNET_RIGHT)
482  * to enable both positions, so the user can select it.
483  *
484  * @ingroup Actionslider
485  */
486 EAPI void
487 elm_actionslider_enabled_pos_set(Evas_Object *obj, Elm_Actionslider_Magnet_Pos pos)
488 {
489    ELM_CHECK_WIDTYPE(obj, widtype);
490    Widget_Data *wd = elm_widget_data_get(obj);
491    if (!wd) return;
492    wd->enabled_position = pos;
493 }
494
495 /**
496  * Get actionslider enabled position.
497  *
498  * All the positions are enabled by default.
499  *
500  * @param obj The actionslider object.
501  * @return The enabled positions.
502  *
503  * @ingroup Actionslider
504  */
505 EAPI Elm_Actionslider_Magnet_Pos
506 elm_actionslider_enabled_pos_get(const Evas_Object *obj)
507 {
508    ELM_CHECK_WIDTYPE(obj, widtype) ELM_ACTIONSLIDER_MAGNET_NONE;
509    Widget_Data *wd = elm_widget_data_get(obj);
510    if (!wd) return ELM_ACTIONSLIDER_MAGNET_NONE;
511    return wd->enabled_position;
512 }
513
514 /**
515  * Set actionslider label.
516  *
517  * @param[in] obj The actionslider object
518  * @param[in] pos The position of the label.
519  * (ELM_ACTIONSLIDER_LABEL_LEFT, ELM_ACTIONSLIDER_LABEL_RIGHT)
520  * @param label The label which is going to be set.
521  *
522  * @ingroup Actionslider
523  */
524 EAPI void 
525 elm_actionslider_label_set(Evas_Object *obj, Elm_Actionslider_Label_Pos pos, const char *label)
526 {
527    ELM_CHECK_WIDTYPE(obj, widtype);
528    Widget_Data *wd = elm_widget_data_get(obj);
529
530    if(label == NULL) label = "";
531
532    if (pos == ELM_ACTIONSLIDER_LABEL_RIGHT) 
533      {
534         if (wd->text_right)  eina_stringshare_del(wd->text_right);
535         wd->text_right = eina_stringshare_add(label);
536         edje_object_part_text_set(wd->as, "elm.text.right", label);
537      } 
538    else if (pos == ELM_ACTIONSLIDER_LABEL_LEFT) 
539      {
540         if (wd->text_left)  eina_stringshare_del(wd->text_left);
541         wd->text_left = eina_stringshare_add(label);
542         edje_object_part_text_set(wd->as, "elm.text.left", label);
543      } 
544    else if (pos == ELM_ACTIONSLIDER_LABEL_CENTER) 
545      {
546         if (wd->text_center)  eina_stringshare_del(wd->text_center);
547         wd->text_center = eina_stringshare_add(label);
548         edje_object_part_text_set(wd->as, "elm.text.center", label);
549      }
550    else if (pos == ELM_ACTIONSLIDER_LABEL_BUTTON)
551      {
552         if (wd->text_button) eina_stringshare_del(wd->text_button);
553         wd->text_button = eina_stringshare_add(label);
554         edje_object_part_text_set(wd->icon, "elm.text.button", label);
555
556         /* Resize button width */
557         Evas_Object *txt;
558         txt = (Evas_Object *)edje_object_part_object_get (wd->icon, "elm.text.button");
559         if (txt != NULL) 
560           {
561              evas_object_text_text_set (txt, wd->text_button);
562
563              Evas_Coord x,y,w,h;
564              evas_object_geometry_get (txt, &x,&y,&w,&h);
565
566              char *data_left = NULL, *data_right = NULL;
567              int pad_left = 0, pad_right = 0;
568
569              data_left = (char *)edje_object_data_get (wd->icon, "left");
570              data_right = (char *)edje_object_data_get (wd->icon, "right");
571
572              if (data_left) pad_left = atoi(data_left);
573              if (data_right) pad_right = atoi(data_right);
574
575              evas_object_size_hint_min_set (wd->icon, w + pad_left + pad_right, 0);
576              evas_object_size_hint_min_set (wd->icon_fake, w + pad_left + pad_right, 0);
577           }
578      }
579
580 }
581
582 /**
583  * Get actionslider labels.
584  *
585  * @param obj The actionslider object
586  * @param left_label A char** to place the left_label of @p obj into
587  * @param center_label A char** to place the center_label of @p obj into
588  * @param right_label A char** to place the right_label of @p obj into
589  *
590  * @ingroup Actionslider
591  */
592 EAPI void
593 elm_actionslider_labels_get(const Evas_Object *obj, const char **left_label, const char **center_label, const char **right_label)
594 {
595    if (left_label) *left_label= NULL;
596    if (center_label) *center_label= NULL;
597    if (right_label) *right_label= NULL;
598    ELM_CHECK_WIDTYPE(obj, widtype);
599    Widget_Data *wd = elm_widget_data_get(obj);
600    if (!wd) return;
601    if (left_label) *left_label = wd->text_left;
602    if (center_label) *center_label = wd->text_center;
603    if (right_label) *right_label = wd->text_right;
604 }
605
606 /**
607  * Set the label used on the indicator object.
608  *
609  * @param obj The actionslider object
610  * @param label The label which is going to be set.
611  *
612  * @ingroup Actionslider
613  */
614 EAPI void 
615 elm_actionslider_indicator_label_set(Evas_Object *obj, const char *label)
616 {
617    ELM_CHECK_WIDTYPE(obj, widtype);
618    Widget_Data *wd = elm_widget_data_get(obj);
619    if (!wd) return;
620
621    eina_stringshare_replace(&wd->text_button, label);
622    edje_object_part_text_set(wd->as, "elm.text.button", wd->text_button);
623 }
624
625 /**
626  * Get the label used on the indicator object.
627  *
628  * @param obj The actionslider object
629  * @return The indicator label
630  *
631  * @ingroup Actionslider
632  */
633 EAPI const char *
634 elm_actionslider_indicator_label_get(Evas_Object *obj)
635 {
636    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
637    Widget_Data *wd = elm_widget_data_get(obj);
638    if (!wd) return NULL;
639    return wd->text_button;
640 }
641
642 /**
643  * Hold actionslider object movement.
644  *
645  * @param[in] obj The actionslider object
646  * @param[in] flag Actionslider hold/release
647  * (EINA_TURE = hold/EIN_FALSE = release)
648  *
649  * @ingroup Actionslider
650  */
651 EAPI void
652 elm_actionslider_hold(Evas_Object *obj, Eina_Bool flag)
653 {
654    ELM_CHECK_WIDTYPE(obj, widtype);
655    Widget_Data *wd = elm_widget_data_get(obj);
656
657    wd->mouse_hold = flag;
658 }