summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2015-06-25 16:31:36 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-25 17:24:08 +0200
commitb8959e778090547ef9df79601bef0c7cd9b3cd21 (patch)
tree576b836894c1117eaef8bb8ff0f63e2bb5dde2be
parent0710c5ee6425e4514e7b3f87a075052792956ecf (diff)
gengrid: add unhighlight callback
Summary: item_unselect check it->select status, so when item highlighted but not selected, item highlight is remaining even after unselect_cb is called. And item_select and item_highlight are separated, but item_unselect and item_unhighlight are mixed. so divide them, too. This patch will solve upon problem. Reviewers: seoz, woohyun, Hermet, CHAN, raster, SanghyeonLee, cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D2653 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/elm_gengrid.c58
1 files changed, 45 insertions, 13 deletions
diff --git a/src/lib/elm_gengrid.c b/src/lib/elm_gengrid.c
index e8a7fde35..8d01e5ded 100644
--- a/src/lib/elm_gengrid.c
+++ b/src/lib/elm_gengrid.c
@@ -529,12 +529,6 @@ _item_unselect(Elm_Gen_Item *it)
529 if ((it->generation < sd->generation) || (!it->selected)) 529 if ((it->generation < sd->generation) || (!it->selected))
530 return; 530 return;
531 531
532 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
533 evas_object_smart_callback_call(WIDGET(it), SIG_UNHIGHLIGHTED, eo_it);
534
535 evas_object_stack_below(VIEW(it), sd->stack);
536
537 it->highlighted = EINA_FALSE;
538 if (it->selected) 532 if (it->selected)
539 { 533 {
540 it->selected = EINA_FALSE; 534 it->selected = EINA_FALSE;
@@ -574,7 +568,10 @@ _item_mouse_move_cb(void *data,
574 { 568 {
575 sd->on_hold = EINA_TRUE; 569 sd->on_hold = EINA_TRUE;
576 if (!sd->was_selected) 570 if (!sd->was_selected)
577 it->unsel_cb(it); 571 {
572 it->unhighlight_cb(it);
573 it->unsel_cb(it);
574 }
578 } 575 }
579 } 576 }
580 577
@@ -647,7 +644,10 @@ _item_mouse_move_cb(void *data,
647 it->dragging = 1; 644 it->dragging = 1;
648 ELM_SAFE_FREE(it->long_timer, ecore_timer_del); 645 ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
649 if (!sd->was_selected) 646 if (!sd->was_selected)
650 it->unsel_cb(it); 647 {
648 it->unhighlight_cb(it);
649 it->unsel_cb(it);
650 }
651 651
652 if (dy < 0) 652 if (dy < 0)
653 { 653 {
@@ -728,6 +728,24 @@ _item_highlight(Elm_Gen_Item *it)
728} 728}
729 729
730static void 730static void
731_item_unhighlight(Elm_Gen_Item *it)
732{
733 ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
734 Elm_Object_Item *eo_it = EO_OBJ(it);
735
736 if (!it->highlighted ||
737 (it->generation < sd->generation))
738 return;
739
740 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
741 evas_object_smart_callback_call(WIDGET(it), SIG_UNHIGHLIGHTED, eo_it);
742
743 evas_object_stack_below(VIEW(it), sd->stack);
744
745 it->highlighted = EINA_FALSE;
746}
747
748static void
731_item_mouse_down_cb(void *data, 749_item_mouse_down_cb(void *data,
732 Evas *evas EINA_UNUSED, 750 Evas *evas EINA_UNUSED,
733 Evas_Object *obj, 751 Evas_Object *obj,
@@ -1060,7 +1078,11 @@ _item_mouse_up_cb(void *data,
1060 if (sd->longpressed) 1078 if (sd->longpressed)
1061 { 1079 {
1062 sd->longpressed = EINA_FALSE; 1080 sd->longpressed = EINA_FALSE;
1063 if (!sd->was_selected) it->unsel_cb(it); 1081 if (!sd->was_selected)
1082 {
1083 it->unhighlight_cb(it);
1084 it->unsel_cb(it);
1085 }
1064 sd->was_selected = EINA_FALSE; 1086 sd->was_selected = EINA_FALSE;
1065 return; 1087 return;
1066 } 1088 }
@@ -1084,7 +1106,11 @@ _item_mouse_up_cb(void *data,
1084 it->highlight_cb(it); 1106 it->highlight_cb(it);
1085 it->sel_cb(it); 1107 it->sel_cb(it);
1086 } 1108 }
1087 else it->unsel_cb(it); 1109 else
1110 {
1111 it->unhighlight_cb(it);
1112 it->unsel_cb(it);
1113 }
1088 } 1114 }
1089 else 1115 else
1090 { 1116 {
@@ -1094,6 +1120,7 @@ _item_mouse_up_cb(void *data,
1094 { 1120 {
1095 Elm_Object_Item *eo_sel = sd->selected->data; 1121 Elm_Object_Item *eo_sel = sd->selected->data;
1096 Elm_Gen_Item *sel = eo_data_scope_get(eo_sel, ELM_GENGRID_ITEM_CLASS); 1122 Elm_Gen_Item *sel = eo_data_scope_get(eo_sel, ELM_GENGRID_ITEM_CLASS);
1123 it->unhighlight_cb(sel);
1097 it->unsel_cb(sel); 1124 it->unsel_cb(sel);
1098 } 1125 }
1099 } 1126 }
@@ -1105,7 +1132,11 @@ _item_mouse_up_cb(void *data,
1105 EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2) 1132 EINA_LIST_FOREACH_SAFE(sd->selected, l, l_next, eo_item2)
1106 { 1133 {
1107 ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2); 1134 ELM_GENGRID_ITEM_DATA_GET(eo_item2, item2);
1108 if (item2 != it) it->unsel_cb(item2); 1135 if (item2 != it)
1136 {
1137 it->unhighlight_cb(item2);
1138 it->unsel_cb(item2);
1139 }
1109 } 1140 }
1110 } 1141 }
1111 it->highlight_cb(it); 1142 it->highlight_cb(it);
@@ -3978,6 +4009,7 @@ _elm_gengrid_item_new(Elm_Gengrid_Data *sd,
3978 4009
3979 it->del_cb = (Ecore_Cb)_item_del; 4010 it->del_cb = (Ecore_Cb)_item_del;
3980 it->highlight_cb = (Ecore_Cb)_item_highlight; 4011 it->highlight_cb = (Ecore_Cb)_item_highlight;
4012 it->unhighlight_cb = (Ecore_Cb)_item_unhighlight;
3981 it->sel_cb = (Ecore_Cb)_item_select; 4013 it->sel_cb = (Ecore_Cb)_item_select;
3982 it->unsel_cb = (Ecore_Cb)_item_unselect; 4014 it->unsel_cb = (Ecore_Cb)_item_unselect;
3983 it->unrealize_cb = (Ecore_Cb)_item_unrealize_cb; 4015 it->unrealize_cb = (Ecore_Cb)_item_unrealize_cb;
@@ -4492,7 +4524,7 @@ _elm_gengrid_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
4492 { 4524 {
4493 Elm_Object_Item *eo_sel = sd->selected->data; 4525 Elm_Object_Item *eo_sel = sd->selected->data;
4494 ELM_GENGRID_ITEM_DATA_GET(eo_sel, sel); 4526 ELM_GENGRID_ITEM_DATA_GET(eo_sel, sel);
4495 if (it->unhighlight_cb) it->unhighlight_cb(sel); 4527 it->unhighlight_cb(sel);
4496 it->unsel_cb(sel); 4528 it->unsel_cb(sel);
4497 } 4529 }
4498 } 4530 }
@@ -4500,7 +4532,7 @@ _elm_gengrid_item_selected_set(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
4500 it->sel_cb(it); 4532 it->sel_cb(it);
4501 return; 4533 return;
4502 } 4534 }
4503 if (it->unhighlight_cb) it->unhighlight_cb(it); 4535 it->unhighlight_cb(it);
4504 it->unsel_cb(it); 4536 it->unsel_cb(it);
4505} 4537}
4506 4538