summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-10 16:30:04 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-11 13:30:26 +0200
commitd30fc5f5d3a150ce847470caf5140719eef638cc (patch)
treeb6186e3f91bf82506056611c0d493672fb3901ba
parent5a698b6a3d06a7a5a0a2a9a9571cd88222e26c8a (diff)
efl_ui_item: rework parent relation
this commit ensures that there is a public way of setting the container to a item. This was also like this before, just with the difference that it was set and unset in all privacy, however, we want to have this class also ready for bindings, so we should stop making things privat like this. Note: the removed fields from grid and list have not been used. ref T7905 Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D9262
-rw-r--r--src/lib/elementary/efl_ui_grid.c6
-rw-r--r--src/lib/elementary/efl_ui_grid_item_private.h1
-rw-r--r--src/lib/elementary/efl_ui_item.c13
-rw-r--r--src/lib/elementary/efl_ui_item.eo9
-rw-r--r--src/lib/elementary/efl_ui_list.c6
-rw-r--r--src/lib/elementary/efl_ui_list_item_private.h1
6 files changed, 26 insertions, 10 deletions
diff --git a/src/lib/elementary/efl_ui_grid.c b/src/lib/elementary/efl_ui_grid.c
index d27899d907..36d069b5c7 100644
--- a/src/lib/elementary/efl_ui_grid.c
+++ b/src/lib/elementary/efl_ui_grid.c
@@ -750,8 +750,7 @@ _grid_item_process(Eo *obj, Efl_Ui_Grid_Data *pd, EINA_UNUSED Efl_Ui_Grid_Item *
750 EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd, EINA_FALSE); 750 EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd, EINA_FALSE);
751 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE); 751 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE);
752 id->select_mode = &(pd->select_mode); 752 id->select_mode = &(pd->select_mode);
753 id->parent = obj; 753 efl_ui_item_container_set(it, obj);
754 gd->parent = obj;
755 efl_canvas_group_member_add(pd->pan, it); 754 efl_canvas_group_member_add(pd->pan, it);
756 efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj)); 755 efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj));
757 756
@@ -772,8 +771,7 @@ _grid_item_unpack_internal(Eo *obj, Efl_Ui_Grid_Data *pd, Efl_Ui_Grid_Item *it)
772 EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd); 771 EFL_UI_GRID_ITEM_DATA_GET_OR_RETURN(it, gd);
773 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id); 772 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id);
774 id->select_mode = NULL; 773 id->select_mode = NULL;
775 id->parent = NULL; 774 efl_ui_item_container_set(it, NULL);
776 gd->parent = NULL;
777 775
778 pd->items = eina_list_remove(pd->items, it); 776 pd->items = eina_list_remove(pd->items, it);
779 if (efl_ui_item_selected_get(it)) 777 if (efl_ui_item_selected_get(it))
diff --git a/src/lib/elementary/efl_ui_grid_item_private.h b/src/lib/elementary/efl_ui_grid_item_private.h
index cec53f91ce..d8c4009826 100644
--- a/src/lib/elementary/efl_ui_grid_item_private.h
+++ b/src/lib/elementary/efl_ui_grid_item_private.h
@@ -7,7 +7,6 @@ typedef struct _Efl_Ui_Grid_Item_Data
7{ 7{
8 // Eo Objects 8 // Eo Objects
9 Eo *obj; /* Self-Object */ 9 Eo *obj; /* Self-Object */
10 Eo *parent; /* Parent Widget */
11 Eina_Rect geo; 10 Eina_Rect geo;
12 int index; 11 int index;
13 struct { 12 struct {
diff --git a/src/lib/elementary/efl_ui_item.c b/src/lib/elementary/efl_ui_item.c
index 3f87832db5..47d7b632a5 100644
--- a/src/lib/elementary/efl_ui_item.c
+++ b/src/lib/elementary/efl_ui_item.c
@@ -380,6 +380,19 @@ _efl_ui_item_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
380 return pd->selected; 380 return pd->selected;
381} 381}
382 382
383EOLIAN static void
384_efl_ui_item_container_set(Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd, Efl_Ui_Widget *container)
385{
386 pd->parent = container;
387}
388
389EOLIAN static Efl_Ui_Widget*
390_efl_ui_item_container_get(const Eo *obj EINA_UNUSED, Efl_Ui_Item_Data *pd)
391{
392 return pd->parent;
393}
394
395
383/* Internal EO APIs and hidden overrides */ 396/* Internal EO APIs and hidden overrides */
384 397
385#define EFL_UI_ITEM_EXTRA_OPS \ 398#define EFL_UI_ITEM_EXTRA_OPS \
diff --git a/src/lib/elementary/efl_ui_item.eo b/src/lib/elementary/efl_ui_item.eo
index 50e1e1c739..9ece7e4c0c 100644
--- a/src/lib/elementary/efl_ui_item.eo
+++ b/src/lib/elementary/efl_ui_item.eo
@@ -18,6 +18,15 @@ abstract @beta Efl.Ui.Item extends Efl.Ui.Layout_Base implements Efl.Ui.Selectab
18 select: bool; 18 select: bool;
19 } 19 }
20 } 20 }
21 @property container {
22 [[The container this object is part of.
23
24 You should never use this property yourself, the container will set it. Unsetting this while the item is packed into a container does not have an impact on its state in the container.
25 ]]
26 values {
27 container : Efl.Ui.Widget; [[The container this item is in.]]
28 }
29 }
21 } 30 }
22 implements { 31 implements {
23 //Efl.Object 32 //Efl.Object
diff --git a/src/lib/elementary/efl_ui_list.c b/src/lib/elementary/efl_ui_list.c
index 7e10f06618..971754ca88 100644
--- a/src/lib/elementary/efl_ui_list.c
+++ b/src/lib/elementary/efl_ui_list.c
@@ -675,8 +675,7 @@ _list_item_process(Eo *obj, Efl_Ui_List_Data *pd, EINA_UNUSED Efl_Ui_List_Item *
675 EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld, EINA_FALSE); 675 EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld, EINA_FALSE);
676 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE); 676 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id, EINA_FALSE);
677 id->select_mode = &(pd->select_mode); 677 id->select_mode = &(pd->select_mode);
678 id->parent = obj; 678 efl_ui_item_container_set(it, obj);
679 ld->parent = obj;
680 efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj)); 679 efl_ui_mirrored_set(it, efl_ui_mirrored_get(obj));
681 680
682 efl_event_callback_add(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj); 681 efl_event_callback_add(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
@@ -695,8 +694,7 @@ _list_item_clear(Eo *obj, Efl_Ui_List_Data *pd EINA_UNUSED, EINA_UNUSED Efl_Ui_L
695 EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld); 694 EFL_UI_LIST_ITEM_DATA_GET_OR_RETURN(it, ld);
696 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id); 695 EFL_UI_ITEM_DATA_GET_OR_RETURN(it, id);
697 id->select_mode = NULL; 696 id->select_mode = NULL;
698 id->parent = NULL; 697 efl_ui_item_container_set(it, NULL);
699 ld->parent = NULL;
700 698
701 efl_event_callback_del(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj); 699 efl_event_callback_del(it, EFL_UI_EVENT_PRESSED, _list_item_pressed, obj);
702 efl_event_callback_del(it, EFL_UI_EVENT_UNPRESSED, _list_item_unpressed, obj); 700 efl_event_callback_del(it, EFL_UI_EVENT_UNPRESSED, _list_item_unpressed, obj);
diff --git a/src/lib/elementary/efl_ui_list_item_private.h b/src/lib/elementary/efl_ui_list_item_private.h
index e68b3fa14a..0df36bc459 100644
--- a/src/lib/elementary/efl_ui_list_item_private.h
+++ b/src/lib/elementary/efl_ui_list_item_private.h
@@ -7,7 +7,6 @@ typedef struct _Efl_Ui_List_Item_Data
7{ 7{
8 // Eo Objects 8 // Eo Objects
9 Eo *obj; /* Self-Object */ 9 Eo *obj; /* Self-Object */
10 Eo *parent; /* Parent Widget */
11 Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */ 10 Eina_Bool needs_size_calc : 1; /* Flag for Size calculation */
12} Efl_Ui_List_Item_Data; 11} Efl_Ui_List_Item_Data;
13 12