summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthiepha (Thiep Ha) <thiepha@gmail.com>2013-05-13 19:11:51 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-05-13 19:16:58 +0900
commitc38a2a6bb80fd87aed23229d03d2e3dc70a7f443 (patch)
tree9dee87d3b7e5eb03875ab9110e268e07f3027189
parent97806103ebc76059ab144a4842723bebabadb510 (diff)
[Edje_Entry] Add selection handlers to entry
Add selection handlers to entry. https://phab.enlightenment.org/D117 Conflicts: ChangeLog NEWS
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--src/bin/edje/edje_cc_handlers.c50
-rw-r--r--src/bin/edje/edje_convert.c2
-rw-r--r--src/bin/edje/edje_convert.h2
-rw-r--r--src/bin/edje/edje_data_convert.c2
-rw-r--r--src/lib/edje/edje_convert.c2
-rw-r--r--src/lib/edje/edje_convert.h2
-rw-r--r--src/lib/edje/edje_data.c2
-rw-r--r--src/lib/edje/edje_entry.c253
-rw-r--r--src/lib/edje/edje_private.h3
11 files changed, 315 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index c13c6100f8..e2eeeb05fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-05-13 Thiep Ha
2
3 * Edje: Added selection handlers to entry.
4
12013-05-11 Jiyou Park 52013-05-11 Jiyou Park
2 6
3 * Evas: Fix crash if app use native surface in wrong engine. 7 * Evas: Fix crash if app use native surface in wrong engine.
diff --git a/NEWS b/NEWS
index 04cc783577..f2782a48c6 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,7 @@ Additions:
85 - textblock: Added support for size_range. 85 - textblock: Added support for size_range.
86 - table: Added spread.{w,h} to repeat and automatically name an item in a TABLE part. 86 - table: Added spread.{w,h} to repeat and automatically name an item in a TABLE part.
87 - add embryo fill support for proxy parts 87 - add embryo fill support for proxy parts
88 - entry: Added selection handlers.
88 * Ecore_x: Add atom related with indicator type. 89 * Ecore_x: Add atom related with indicator type.
89 * Ecore_x: Add manual render code before deiconify 90 * Ecore_x: Add manual render code before deiconify
90 * Eeze: Add a dummy libmount replacement for when libmount is not there. 91 * Eeze: Add a dummy libmount replacement for when libmount is not there.
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index fdc2d559e8..3bdcba37b5 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -224,6 +224,8 @@ static void st_collections_group_parts_part_source3(void);
224static void st_collections_group_parts_part_source4(void); 224static void st_collections_group_parts_part_source4(void);
225static void st_collections_group_parts_part_source5(void); 225static void st_collections_group_parts_part_source5(void);
226static void st_collections_group_parts_part_source6(void); 226static void st_collections_group_parts_part_source6(void);
227static void st_collections_group_parts_part_source7(void);
228static void st_collections_group_parts_part_source8(void);
227static void st_collections_group_parts_part_entry_mode(void); 229static void st_collections_group_parts_part_entry_mode(void);
228static void st_collections_group_parts_part_select_mode(void); 230static void st_collections_group_parts_part_select_mode(void);
229static void st_collections_group_parts_part_cursor_mode(void); 231static void st_collections_group_parts_part_cursor_mode(void);
@@ -501,6 +503,8 @@ New_Statement_Handler statement_handlers[] =
501 {"collections.group.parts.part.source4", st_collections_group_parts_part_source4}, 503 {"collections.group.parts.part.source4", st_collections_group_parts_part_source4},
502 {"collections.group.parts.part.source5", st_collections_group_parts_part_source5}, 504 {"collections.group.parts.part.source5", st_collections_group_parts_part_source5},
503 {"collections.group.parts.part.source6", st_collections_group_parts_part_source6}, 505 {"collections.group.parts.part.source6", st_collections_group_parts_part_source6},
506 {"collections.group.parts.part.source7", st_collections_group_parts_part_source7},
507 {"collections.group.parts.part.source8", st_collections_group_parts_part_source8},
504 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x}, 508 {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x},
505 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y}, 509 {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y},
506 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine}, 510 {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
@@ -2656,6 +2660,8 @@ st_collections_group_inherit(void)
2656 ep->source4 = STRDUP(ep2->source4); 2660 ep->source4 = STRDUP(ep2->source4);
2657 ep->source5 = STRDUP(ep2->source5); 2661 ep->source5 = STRDUP(ep2->source5);
2658 ep->source6 = STRDUP(ep2->source6); 2662 ep->source6 = STRDUP(ep2->source6);
2663 ep->source7 = STRDUP(ep2->source7);
2664 ep->source8 = STRDUP(ep2->source8);
2659 2665
2660 data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id)); 2666 data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id));
2661 2667
@@ -3940,6 +3946,48 @@ st_collections_group_parts_part_source6(void)
3940 3946
3941/** 3947/**
3942 @page edcref 3948 @page edcref
3949 @property
3950 source7
3951 @parameters
3952 [another group's name]
3953 @effect
3954 Only available to TEXTBLOCK parts. It is used for the group to be
3955 loaded and used for the start selection handler display.
3956 @endproperty
3957*/
3958static void
3959st_collections_group_parts_part_source7(void)
3960{
3961 check_arg_count(1);
3962
3963 //FIXME: validate this somehow (need to decide on the format also)
3964 current_part->source7 = parse_str(0);
3965 data_queue_group_lookup(current_part->source7, current_part);
3966}
3967
3968/**
3969 @page edcref
3970 @property
3971 source8
3972 @parameters
3973 [another group's name]
3974 @effect
3975 Only available to TEXTBLOCK parts. It is used for the group to be
3976 loaded and used for the end selection handler display.
3977 @endproperty
3978*/
3979static void
3980st_collections_group_parts_part_source8(void)
3981{
3982 check_arg_count(1);
3983
3984 //FIXME: validate this somehow (need to decide on the format also)
3985 current_part->source8 = parse_str(0);
3986 data_queue_group_lookup(current_part->source8, current_part);
3987}
3988
3989/**
3990 @page edcref
3943 3991
3944 @property 3992 @property
3945 effect 3993 effect
@@ -4061,7 +4109,7 @@ st_collections_group_parts_part_select_mode(void)
4061 current_part->select_mode = parse_enum(0, 4109 current_part->select_mode = parse_enum(0,
4062 "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT, 4110 "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
4063 "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT, 4111 "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
4064 "BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_DEFAULT, 4112 "BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE,
4065 NULL); 4113 NULL);
4066} 4114}
4067 4115
diff --git a/src/bin/edje/edje_convert.c b/src/bin/edje/edje_convert.c
index bd6cf31f58..fac7933904 100644
--- a/src/bin/edje/edje_convert.c
+++ b/src/bin/edje/edje_convert.c
@@ -336,6 +336,8 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
336 replacement->source4 = part->source4; 336 replacement->source4 = part->source4;
337 replacement->source5 = part->source5; 337 replacement->source5 = part->source5;
338 replacement->source6 = part->source6; 338 replacement->source6 = part->source6;
339 replacement->source7 = part->source7;
340 replacement->source8 = part->source8;
339 replacement->id = part->id; 341 replacement->id = part->id;
340 replacement->clip_to_id = part->clip_to_id; 342 replacement->clip_to_id = part->clip_to_id;
341 replacement->dragable = part->dragable; 343 replacement->dragable = part->dragable;
diff --git a/src/bin/edje/edje_convert.h b/src/bin/edje/edje_convert.h
index 0bbb38eb42..cb2e50532d 100644
--- a/src/bin/edje/edje_convert.h
+++ b/src/bin/edje/edje_convert.h
@@ -92,7 +92,7 @@ struct _Old_Edje_Part
92 const char *name; /* the name if any of the part */ 92 const char *name; /* the name if any of the part */
93 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ 93 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
94 Eina_List *other_desc; /* other possible descriptors */ 94 Eina_List *other_desc; /* other possible descriptors */
95 const char *source, *source2, *source3, *source4, *source5, *source6; 95 const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8;
96 int id; /* its id number */ 96 int id; /* its id number */
97 int clip_to_id; /* the part id to clip this one to */ 97 int clip_to_id; /* the part id to clip this one to */
98 Edje_Part_Dragable dragable; 98 Edje_Part_Dragable dragable;
diff --git a/src/bin/edje/edje_data_convert.c b/src/bin/edje/edje_data_convert.c
index 5fb129e702..6ed1b01c81 100644
--- a/src/bin/edje/edje_data_convert.c
+++ b/src/bin/edje/edje_data_convert.c
@@ -422,6 +422,8 @@ _edje_edd_old_init(void)
422 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source4", source4, EET_T_STRING); 422 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source4", source4, EET_T_STRING);
423 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source5", source5, EET_T_STRING); 423 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source5", source5, EET_T_STRING);
424 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source6", source6, EET_T_STRING); 424 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source6", source6, EET_T_STRING);
425 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source7", source7, EET_T_STRING);
426 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source8", source8, EET_T_STRING);
425 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element); 427 EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element);
426 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING); 428 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING);
427 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING); 429 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING);
diff --git a/src/lib/edje/edje_convert.c b/src/lib/edje/edje_convert.c
index 07d43ce50d..5fa7a04291 100644
--- a/src/lib/edje/edje_convert.c
+++ b/src/lib/edje/edje_convert.c
@@ -377,6 +377,8 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc)
377 replacement->source4 = part->source4; 377 replacement->source4 = part->source4;
378 replacement->source5 = part->source5; 378 replacement->source5 = part->source5;
379 replacement->source6 = part->source6; 379 replacement->source6 = part->source6;
380 replacement->source7 = part->source7;
381 replacement->source8 = part->source8;
380 replacement->id = part->id; 382 replacement->id = part->id;
381 replacement->clip_to_id = part->clip_to_id; 383 replacement->clip_to_id = part->clip_to_id;
382 replacement->dragable = part->dragable; 384 replacement->dragable = part->dragable;
diff --git a/src/lib/edje/edje_convert.h b/src/lib/edje/edje_convert.h
index fcc2781f49..9d8213f6c4 100644
--- a/src/lib/edje/edje_convert.h
+++ b/src/lib/edje/edje_convert.h
@@ -89,7 +89,7 @@ struct _Old_Edje_Part
89 const char *name; /* the name if any of the part */ 89 const char *name; /* the name if any of the part */
90 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ 90 Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
91 Eina_List *other_desc; /* other possible descriptors */ 91 Eina_List *other_desc; /* other possible descriptors */
92 const char *source, *source2, *source3, *source4, *source5, *source6; 92 const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8;
93 int id; /* its id number */ 93 int id; /* its id number */
94 int clip_to_id; /* the part id to clip this one to */ 94 int clip_to_id; /* the part id to clip this one to */
95 Edje_Part_Dragable dragable; 95 Edje_Part_Dragable dragable;
diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c
index aa289d705a..f531af473c 100644
--- a/src/lib/edje/edje_data.c
+++ b/src/lib/edje/edje_data.c
@@ -922,6 +922,8 @@ _edje_edd_init(void)
922 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING); 922 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING);
923 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING); 923 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING);
924 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING); 924 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING);
925 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source7", source7, EET_T_STRING);
926 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source8", source8, EET_T_STRING);
925 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT); 927 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT);
926 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT); 928 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT);
927 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR); 929 EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index ad6f5fec42..ed3bf69d70 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -20,8 +20,10 @@ struct _Entry
20{ 20{
21 Edje_Real_Part *rp; 21 Edje_Real_Part *rp;
22 Edje *ed; 22 Edje *ed;
23 Evas_Coord ox, oy;
23 Evas_Object *cursor_bg; 24 Evas_Object *cursor_bg;
24 Evas_Object *cursor_fg, *cursor_fg2; 25 Evas_Object *cursor_fg, *cursor_fg2;
26 Evas_Object *sel_handler_start, *sel_handler_end;
25 Evas_Textblock_Cursor *cursor; 27 Evas_Textblock_Cursor *cursor;
26 Evas_Textblock_Cursor *sel_start, *sel_end; 28 Evas_Textblock_Cursor *sel_start, *sel_end;
27 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; 29 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
@@ -551,6 +553,14 @@ _sel_extend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
551 if (!en->sel_end) return; 553 if (!en->sel_end) return;
552 _sel_enable(ed, c, o, en); 554 _sel_enable(ed, c, o, en);
553 if (!evas_textblock_cursor_compare(c, en->sel_end)) return; 555 if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
556
557 if (en->sel_handler_start && en->sel_handler_end)
558 {
559 /* Do NOT allow sel_handler_end pass sel_handler_start */
560 if (evas_textblock_cursor_compare(c, en->sel_start) <= 0)
561 evas_textblock_cursor_pos_set(c, evas_textblock_cursor_pos_get(en->sel_start) + 1);
562 }
563
554 evas_textblock_cursor_copy(c, en->sel_end); 564 evas_textblock_cursor_copy(c, en->sel_end);
555 565
556 _edje_entry_imf_cursor_info_set(en); 566 _edje_entry_imf_cursor_info_set(en);
@@ -569,6 +579,14 @@ _sel_preextend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
569 if (!en->sel_end) return; 579 if (!en->sel_end) return;
570 _sel_enable(ed, c, o, en); 580 _sel_enable(ed, c, o, en);
571 if (!evas_textblock_cursor_compare(c, en->sel_start)) return; 581 if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
582
583 if (en->sel_handler_start && en->sel_handler_end)
584 {
585 /* Do NOT allow sel_handler_start pass sel_handler_end */
586 if (evas_textblock_cursor_compare(c, en->sel_end) >= 0)
587 evas_textblock_cursor_pos_set(c, evas_textblock_cursor_pos_get(en->sel_end) - 1);
588 }
589
572 evas_textblock_cursor_copy(c, en->sel_start); 590 evas_textblock_cursor_copy(c, en->sel_start);
573 591
574 _edje_entry_imf_cursor_info_set(en); 592 _edje_entry_imf_cursor_info_set(en);
@@ -612,6 +630,10 @@ _sel_clear(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_U
612 en->have_selection = EINA_FALSE; 630 en->have_selection = EINA_FALSE;
613 _edje_emit(ed, "selection,cleared", en->rp->part->name); 631 _edje_emit(ed, "selection,cleared", en->rp->part->name);
614 } 632 }
633 if (en->sel_handler_start)
634 edje_object_signal_emit(en->sel_handler_start, "edje,handler,hide", "edje");
635 if (en->sel_handler_end)
636 edje_object_signal_emit(en->sel_handler_end, "edje,handler,hide", "edje");
615} 637}
616 638
617static void 639static void
@@ -672,11 +694,15 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
672 evas_object_geometry_get(o, &x, &y, &w, &h); 694 evas_object_geometry_get(o, &x, &y, &w, &h);
673 if (en->have_selection) 695 if (en->have_selection)
674 { 696 {
697 int lc, li = 0;
698 lc = eina_list_count(en->sel);
699
675 EINA_LIST_FOREACH(en->sel, l, sel) 700 EINA_LIST_FOREACH(en->sel, l, sel)
676 { 701 {
677 Evas_Textblock_Rectangle *r; 702 Evas_Textblock_Rectangle *r;
678 703
679 r = range->data; 704 r = range->data;
705 li++;
680 if (sel->obj_bg) 706 if (sel->obj_bg)
681 { 707 {
682 evas_object_move(sel->obj_bg, x + r->x, y + r->y); 708 evas_object_move(sel->obj_bg, x + r->x, y + r->y);
@@ -687,6 +713,19 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
687 evas_object_move(sel->obj_fg, x + r->x, y + r->y); 713 evas_object_move(sel->obj_fg, x + r->x, y + r->y);
688 evas_object_resize(sel->obj_fg, r->w, r->h); 714 evas_object_resize(sel->obj_fg, r->w, r->h);
689 } 715 }
716 if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
717 {
718 if (li == 1)
719 {
720 evas_object_move(en->sel_handler_start, x + r->x, y + r->y + r->h);
721 edje_object_signal_emit(en->sel_handler_start, "edje,handler,show", "edje");
722 }
723 if (li == lc)
724 {
725 evas_object_move(en->sel_handler_end, x + r->x + r->w, y + r->y + r->h);
726 edje_object_signal_emit(en->sel_handler_end, "edje,handler,show", "edje");
727 }
728 }
690 *(&(sel->rect)) = *r; 729 *(&(sel->rect)) = *r;
691 range = eina_list_remove_list(range, range); 730 range = eina_list_remove_list(range, range);
692 free(r); 731 free(r);
@@ -703,6 +742,168 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
703} 742}
704 743
705static void 744static void
745_edje_start_handler_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
746{
747 Evas_Event_Mouse_Down *ev = event_info;
748 Edje_Real_Part *rp = data;
749 Evas_Coord ex, ey;
750 Evas_Coord cx, cy, cw, ch;
751 Evas_Textblock_Cursor_Type cur_type;
752 Entry *en;
753
754 if (ev->button != 1) return;
755 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
756 (!rp->typedata.text)) return;
757 en = rp->typedata.text->entry_data;
758
759 evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
760 switch (rp->part->cursor_mode)
761 {
762 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
763 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
764 break;
765 case EDJE_ENTRY_CURSOR_MODE_UNDER:
766 /* no break for a reason */
767 default:
768 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
769 }
770 evas_textblock_cursor_geometry_get(en->sel_start, &cx, &cy, &cw, &ch, NULL, cur_type);
771 en->ox = ev->canvas.x - (ex + cx + cw/2);
772 en->oy = ev->canvas.y - (ey + cy + ch/2);
773
774 en->select_mod_start = EINA_TRUE;
775 en->selecting = EINA_TRUE;
776
777 _edje_emit(en->ed, "handler,move,start", rp->part->name);
778}
779
780static void
781_edje_start_handler_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
782{
783 Edje_Real_Part *rp = data;
784 Entry *en;
785
786 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
787 (!rp->typedata.text)) return;
788 en = rp->typedata.text->entry_data;
789
790 en->selecting = EINA_FALSE;
791 en->select_mod_start = EINA_FALSE;
792
793 _edje_emit(en->ed, "handler,move,end", rp->part->name);
794}
795
796static void
797_edje_start_handler_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
798{
799 Evas_Event_Mouse_Move *ev = event_info;
800 Edje_Real_Part *rp = data;
801 Entry *en;
802 Evas_Coord ex, ey;
803 Evas_Coord cx, cy;
804
805 if (ev->buttons != 1) return;
806 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
807 (!rp->typedata.text)) return;
808 en = rp->typedata.text->entry_data;
809
810 evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
811 cx = ev->cur.canvas.x - en->ox - ex;
812 cy = ev->cur.canvas.y - en->oy - ey;
813 if (cx <= 0) cx = 1;
814 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
815
816 if (en->select_allow)
817 {
818 if (en->select_mod_start)
819 _sel_preextend(en->ed, en->cursor, rp->object, en);
820 }
821 _edje_entry_real_part_configure(en->ed, rp);
822 _edje_emit(en->ed, "handler,moving", rp->part->name);
823}
824
825static void
826_edje_end_handler_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
827{
828 Evas_Event_Mouse_Down *ev = event_info;
829 Edje_Real_Part *rp = data;
830 Entry *en;
831 Evas_Coord ex, ey;
832 Evas_Coord cx, cy, cw, ch;
833 Evas_Textblock_Cursor_Type cur_type;
834
835 if (ev->button != 1) return;
836 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
837 (!rp->typedata.text)) return;
838 en = rp->typedata.text->entry_data;
839
840 evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
841 switch (rp->part->cursor_mode)
842 {
843 case EDJE_ENTRY_CURSOR_MODE_BEFORE:
844 cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
845 break;
846 case EDJE_ENTRY_CURSOR_MODE_UNDER:
847 /* no break for a reason */
848 default:
849 cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
850 }
851 evas_textblock_cursor_geometry_get(en->sel_end, &cx, &cy, &cw, &ch, NULL, cur_type);
852 en->ox = ev->canvas.x - (ex + cx + cw/2);
853 en->oy = ev->canvas.y - (ey + cy + ch/2);
854
855 en->select_mod_end = EINA_TRUE;
856 en->selecting = EINA_TRUE;
857
858 _edje_emit(en->ed, "handler,move,end", rp->part->name);
859}
860
861static void
862_edje_end_handler_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
863{
864 Edje_Real_Part *rp = data;
865 Entry *en;
866
867 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
868 (!rp->typedata.text)) return;
869 en = rp->typedata.text->entry_data;
870
871 en->selecting = EINA_FALSE;
872 en->select_mod_end = EINA_FALSE;
873
874 _edje_emit(en->ed, "handler,move,end", rp->part->name);
875}
876
877static void
878_edje_end_handler_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
879{
880 Evas_Event_Mouse_Move *ev = event_info;
881 Edje_Real_Part *rp = data;
882 Entry *en;
883 Evas_Coord ex, ey;
884 Evas_Coord cx, cy;
885
886 if (ev->buttons != 1) return;
887 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
888 (!rp->typedata.text)) return;
889 en = rp->typedata.text->entry_data;
890
891 evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
892 cx = ev->cur.canvas.x - en->ox - ex;
893 cy = ev->cur.canvas.y - en->oy - ey;
894 if (cx <= 0) cx = 1;
895 evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
896
897 if (en->select_allow)
898 {
899 if (en->select_mod_end)
900 _sel_extend(en->ed, en->cursor, rp->object, en);
901 }
902 _edje_entry_real_part_configure(en->ed, rp);
903 _edje_emit(en->ed, "handler,moving", rp->part->name);
904}
905
906static void
706_edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 907_edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
707{ 908{
708 Anchor *an = data; 909 Anchor *an = data;
@@ -1908,7 +2109,8 @@ _edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
1908 en->select_mod_end = EINA_FALSE; 2109 en->select_mod_end = EINA_FALSE;
1909 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT) 2110 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
1910 dosel = EINA_TRUE; 2111 dosel = EINA_TRUE;
1911 else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) 2112 else if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2113 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
1912 { 2114 {
1913 if (en->select_allow) dosel = EINA_TRUE; 2115 if (en->select_allow) dosel = EINA_TRUE;
1914 } 2116 }
@@ -2020,7 +2222,8 @@ _edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
2020 if (dosel) 2222 if (dosel)
2021 { 2223 {
2022 if ((en->have_selection) && 2224 if ((en->have_selection) &&
2023 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)) 2225 ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2226 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)))
2024 { 2227 {
2025 if (shift) 2228 if (shift)
2026 _sel_extend(en->ed, en->cursor, rp->object, en); 2229 _sel_extend(en->ed, en->cursor, rp->object, en);
@@ -2179,7 +2382,8 @@ _edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN
2179 } 2382 }
2180 } 2383 }
2181 } 2384 }
2182 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) 2385 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2386 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
2183 { 2387 {
2184 if (en->select_allow) 2388 if (en->select_allow)
2185 { 2389 {
@@ -2278,7 +2482,8 @@ _edje_part_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
2278 _curs_lin_end(en->cursor, rp->object, en); 2482 _curs_lin_end(en->cursor, rp->object, en);
2279 } 2483 }
2280 } 2484 }
2281 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) 2485 if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
2486 (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
2282 { 2487 {
2283 if (en->select_allow) 2488 if (en->select_allow)
2284 { 2489 {
@@ -2431,6 +2636,36 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
2431 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); 2636 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
2432 _edje_subobj_register(ed, en->cursor_fg); 2637 _edje_subobj_register(ed, en->cursor_fg);
2433 2638
2639 if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
2640 {
2641 if (rp->part->source7)
2642 {
2643 en->sel_handler_start = edje_object_add(ed->base->evas);
2644 edje_object_file_set(en->sel_handler_start, ed->path, rp->part->source7);
2645 evas_object_show(en->sel_handler_start);
2646 _edje_subobj_register(ed, en->sel_handler_start);
2647 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN,
2648 _edje_start_handler_mouse_down_cb, rp);
2649 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP,
2650 _edje_start_handler_mouse_up_cb, rp);
2651 evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE,
2652 _edje_start_handler_mouse_move_cb, rp);
2653 }
2654 if (rp->part->source8)
2655 {
2656 en->sel_handler_end = edje_object_add(ed->base->evas);
2657 edje_object_file_set(en->sel_handler_end, ed->path, rp->part->source8);
2658 evas_object_show(en->sel_handler_end);
2659 _edje_subobj_register(ed, en->sel_handler_end);
2660 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN,
2661 _edje_end_handler_mouse_down_cb, rp);
2662 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP,
2663 _edje_end_handler_mouse_up_cb, rp);
2664 evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE,
2665 _edje_end_handler_mouse_move_cb, rp);
2666 }
2667 }
2668
2434 /* A proxy to the main cursor. */ 2669 /* A proxy to the main cursor. */
2435 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) 2670 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
2436 { 2671 {
@@ -2527,6 +2762,16 @@ _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp)
2527 evas_object_del(en->cursor_bg); 2762 evas_object_del(en->cursor_bg);
2528 evas_object_del(en->cursor_fg); 2763 evas_object_del(en->cursor_fg);
2529 evas_object_del(en->cursor_fg2); 2764 evas_object_del(en->cursor_fg2);
2765 if (en->sel_handler_start)
2766 {
2767 evas_object_del(en->sel_handler_start);
2768 en->sel_handler_start = NULL;
2769 }
2770 if (en->sel_handler_end)
2771 {
2772 evas_object_del(en->sel_handler_end);
2773 en->sel_handler_end = NULL;
2774 }
2530 2775
2531 if (en->pw_timer) 2776 if (en->pw_timer)
2532 { 2777 {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 569d7390cf..af9b055738 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -419,6 +419,7 @@ typedef struct _Edje_Signal_Callback_Custom Edje_Signal_Callback_Custom;
419 419
420#define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0 420#define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0
421#define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1 421#define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1
422#define EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE 2
422 423
423#define EDJE_ENTRY_CURSOR_MODE_UNDER 0 424#define EDJE_ENTRY_CURSOR_MODE_UNDER 0
424#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1 425#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1
@@ -958,7 +959,7 @@ struct _Edje_Part
958 959
959 Edje_Part_Description_List other; /* other possible descriptors */ 960 Edje_Part_Description_List other; /* other possible descriptors */
960 961
961 const char *source, *source2, *source3, *source4, *source5, *source6; 962 const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8;
962 int id; /* its id number */ 963 int id; /* its id number */
963 int clip_to_id; /* the part id to clip this one to */ 964 int clip_to_id; /* the part id to clip this one to */
964 Edje_Part_Dragable dragable; 965 Edje_Part_Dragable dragable;