summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_panel.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-17 17:43:21 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-21 10:51:42 +0200
commit4ce2a29c93ac0c2ffaf78b743428d003b1f94a0d (patch)
tree73ddee05be7759869b27533fcb7243a052cbe5d7 /src/lib/elementary/efl_ui_panel.c
parentbb6c7c6782e9bc22e4fdeb314457c0e340be80e1 (diff)
efl_ui_panel: redo content handling
before the events where not emitted correctly. Additionally input values like 0x1 have been accepted as valid. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D8636
Diffstat (limited to 'src/lib/elementary/efl_ui_panel.c')
-rw-r--r--src/lib/elementary/efl_ui_panel.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/lib/elementary/efl_ui_panel.c b/src/lib/elementary/efl_ui_panel.c
index 84aa6f0..bfa7a93 100644
--- a/src/lib/elementary/efl_ui_panel.c
+++ b/src/lib/elementary/efl_ui_panel.c
@@ -711,24 +711,36 @@ _efl_ui_panel_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Panel_Dat
711 return _panel_efl_ui_widget_widget_input_event_handler(obj, pd, eo_event, src); 711 return _panel_efl_ui_widget_widget_input_event_handler(obj, pd, eo_event, src);
712} 712}
713 713
714static void
715_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED)
716{
717 efl_content_set(data, NULL);
718}
719
714static Eina_Bool 720static Eina_Bool
715_efl_ui_panel_efl_content_content_set(Eo *obj, Efl_Ui_Panel_Data *sd, Efl_Gfx_Entity *content) 721_efl_ui_panel_efl_content_content_set(Eo *obj, Efl_Ui_Panel_Data *sd, Efl_Gfx_Entity *content)
716{ 722{
717 if (sd->content == content) return EINA_TRUE; 723 if (sd->content == content) return EINA_TRUE;
724
718 if (sd->content) 725 if (sd->content)
719 evas_object_box_remove_all(sd->bx, EINA_TRUE); 726 {
727 efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
728 if (!efl_invalidated_get(sd->content) && !efl_invalidating_get(sd->content))
729 efl_del(sd->content);
730 sd->content = NULL;
731 }
732 if (content && !elm_widget_sub_object_add(obj, content)) return EINA_FALSE;
720 sd->content = content; 733 sd->content = content;
721 if (content) 734 if (sd->content)
722 { 735 {
736 efl_event_callback_add(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
723 evas_object_box_append(sd->bx, sd->content); 737 evas_object_box_append(sd->bx, sd->content);
724 evas_object_show(sd->content); 738 evas_object_show(sd->content);
725 if (sd->scrollable) 739 if (sd->scrollable)
726 elm_widget_sub_object_add(sd->scr_ly, sd->content); 740 elm_widget_sub_object_add(sd->scr_ly, sd->content);
727 else
728 elm_widget_sub_object_add(obj, sd->content);
729 } 741 }
730 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, content); 742 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, content);
731 if (efl_finalized_get(obj)) 743 if (efl_alive_get(obj))
732 elm_layout_sizing_eval(obj); 744 elm_layout_sizing_eval(obj);
733 745
734 return EINA_TRUE; 746 return EINA_TRUE;
@@ -741,18 +753,10 @@ _efl_ui_panel_efl_content_content_get(const Eo *obj EINA_UNUSED, Efl_Ui_Panel_Da
741} 753}
742 754
743static Efl_Gfx_Entity* 755static Efl_Gfx_Entity*
744_efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd) 756_efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd EINA_UNUSED)
745{ 757{
746 Efl_Gfx_Entity *ret = NULL; 758 Efl_Gfx_Entity *ret = efl_content_get(obj);
747 759 efl_content_set(obj, NULL);
748 if (!sd->content) return NULL;
749 ret = sd->content;
750
751 evas_object_box_remove_all(sd->bx, EINA_FALSE);
752 if (sd->scrollable)
753 _elm_widget_sub_object_redirect_to_top(sd->scr_ly, sd->content);
754 sd->content = NULL;
755 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
756 return ret; 760 return ret;
757} 761}
758 762