summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorzmike <michael.blumenkrantz@gmail.com>2014-03-02 15:01:59 -0500
committerzmike <michael.blumenkrantz@gmail.com>2014-03-02 15:04:07 -0500
commit01ceb5454b80fc67ae0f65c55d66bb330ef7cc83 (patch)
tree203d2ca13d3e68e1a0a21d389985d386de33ba12 /src/lib
parent4d6ea204586e48741a8117383dbb5b8a1390c399 (diff)
@fix slider popup creation with custom themes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_slider.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/src/lib/elm_slider.c b/src/lib/elm_slider.c
index 11f0cc400..7c9e5637f 100644
--- a/src/lib/elm_slider.c
+++ b/src/lib/elm_slider.c
@@ -520,6 +520,37 @@ _track_resize_cb(void *data,
520} 520}
521 521
522static void 522static void
523_popup_add(Elm_Slider_Smart_Data *sd, Eo *obj)
524{
525 /* if theme has an overlayed slider mode, then lets support it */
526 if (!edje_object_part_exists(elm_layout_edje_get(obj), "elm.track.slider")) return;
527
528 // XXX popup needs to adapt to theme etc.
529 sd->popup = edje_object_add(evas_object_evas_get(obj));
530 if (sd->horizontal)
531 _elm_theme_set(NULL, sd->popup, "slider", "horizontal/popup", elm_widget_style_get(obj));
532 else
533 _elm_theme_set(NULL, sd->popup, "slider", "vertical/popup", elm_widget_style_get(obj));
534 edje_object_scale_set(sd->popup, elm_widget_scale_get(obj) *
535 elm_config_scale_get());
536 edje_object_signal_callback_add(sd->popup, "popup,hide,done", "elm", // XXX: for compat
537 _popup_hide_done, obj);
538 edje_object_signal_callback_add(sd->popup, "elm,popup,hide,done", "elm",
539 _popup_hide_done, obj);
540
541 /* create a rectangle to track position+size of the dragable */
542 sd->track = evas_object_rectangle_add(evas_object_evas_get(obj));
543 evas_object_event_callback_add
544 (sd->track, EVAS_CALLBACK_MOVE, _track_move_cb, obj);
545 evas_object_event_callback_add
546 (sd->track, EVAS_CALLBACK_RESIZE, _track_resize_cb, obj);
547
548 evas_object_color_set(sd->track, 0, 0, 0, 0);
549 evas_object_pass_events_set(sd->track, EINA_TRUE);
550 elm_layout_content_set(obj, "elm.track.slider", sd->track);
551}
552
553static void
523_elm_slider_smart_theme(Eo *obj, void *_pd, va_list *list) 554_elm_slider_smart_theme(Eo *obj, void *_pd, va_list *list)
524{ 555{
525 Elm_Slider_Smart_Data *sd = _pd; 556 Elm_Slider_Smart_Data *sd = _pd;
@@ -552,6 +583,8 @@ _elm_slider_smart_theme(Eo *obj, void *_pd, va_list *list)
552 if (sd->popup) 583 if (sd->popup)
553 edje_object_scale_set(sd->popup, elm_widget_scale_get(obj) * 584 edje_object_scale_set(sd->popup, elm_widget_scale_get(obj) *
554 elm_config_scale_get()); 585 elm_config_scale_get());
586 else
587 _popup_add(sd, obj);
555 588
556 if (sd->horizontal) 589 if (sd->horizontal)
557 evas_object_size_hint_min_set 590 evas_object_size_hint_min_set
@@ -855,32 +888,7 @@ _elm_slider_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
855 evas_object_pass_events_set(priv->spacer, EINA_TRUE); 888 evas_object_pass_events_set(priv->spacer, EINA_TRUE);
856 elm_layout_content_set(obj, "elm.swallow.bar", priv->spacer); 889 elm_layout_content_set(obj, "elm.swallow.bar", priv->spacer);
857 890
858 /* if theme has an overlayed slider mode, then lets support it */ 891 _popup_add(priv, obj);
859 if (edje_object_part_exists(elm_layout_edje_get(obj),
860 "elm.track.slider"))
861 {
862 // XXX popup needs to adapt to theme etc.
863 priv->popup = edje_object_add(evas_object_evas_get(obj));
864 _elm_theme_set(NULL, priv->popup, "slider", "horizontal/popup",
865 elm_widget_style_get(obj));
866 edje_object_scale_set(priv->popup, elm_widget_scale_get(obj) *
867 elm_config_scale_get());
868 edje_object_signal_callback_add(priv->popup, "popup,hide,done", "elm", // XXX: for compat
869 _popup_hide_done, obj);
870 edje_object_signal_callback_add(priv->popup, "elm,popup,hide,done", "elm",
871 _popup_hide_done, obj);
872
873 /* create a rectangle to track position+size of the dragable */
874 priv->track = evas_object_rectangle_add(evas_object_evas_get(obj));
875 evas_object_event_callback_add
876 (priv->track, EVAS_CALLBACK_MOVE, _track_move_cb, obj);
877 evas_object_event_callback_add
878 (priv->track, EVAS_CALLBACK_RESIZE, _track_resize_cb, obj);
879
880 evas_object_color_set(priv->track, 0, 0, 0, 0);
881 evas_object_pass_events_set(priv->track, EINA_TRUE);
882 elm_layout_content_set(obj, "elm.track.slider", priv->track);
883 }
884 892
885 evas_object_event_callback_add 893 evas_object_event_callback_add
886 (priv->spacer, EVAS_CALLBACK_MOUSE_DOWN, _spacer_down_cb, obj); 894 (priv->spacer, EVAS_CALLBACK_MOUSE_DOWN, _spacer_down_cb, obj);