summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/elm_entry.c321
-rw-r--r--src/lib/elm_entry.eo2
2 files changed, 160 insertions, 163 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 75042abb6..bce4d0e29 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -5,6 +5,7 @@
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED 5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED 6#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED
7#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED 7#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED
8#define ELM_WIDGET_PROTECTED
8 9
9#include <Elementary.h> 10#include <Elementary.h>
10#include <Elementary_Cursor.h> 11#include <Elementary_Cursor.h>
@@ -921,6 +922,20 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
921 return EINA_TRUE; 922 return EINA_TRUE;
922} 923}
923 924
925EOLIAN static Eina_Bool
926_elm_entry_elm_widget_theme_init(Eo *obj, Elm_Entry_Data *sd)
927{
928 if (!elm_layout_theme_set(obj, "entry", "base", elm_widget_style_get(obj)))
929 CRI("Failed to set layout!");
930 elm_layout_text_set(obj, "elm.text", "");
931 if (_elm_config->desktop_entry)
932 edje_object_part_text_select_allow_set
933 (sd->entry_edje, "elm.text", EINA_TRUE);
934
935
936 return EINA_TRUE;
937}
938
924static void 939static void
925_cursor_geometry_recalc(Evas_Object *obj) 940_cursor_geometry_recalc(Evas_Object *obj)
926{ 941{
@@ -3543,167 +3558,6 @@ _end_handler_mouse_move_cb(void *data,
3543 _magnifier_move(data); 3558 _magnifier_move(data);
3544} 3559}
3545 3560
3546EOLIAN static void
3547_elm_entry_evas_object_smart_add(Eo *obj, Elm_Entry_Data *priv)
3548{
3549 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
3550
3551 evas_obj_smart_add(eo_super(obj, MY_CLASS));
3552 elm_widget_sub_object_parent_add(obj);
3553
3554 priv->entry_edje = wd->resize_obj;
3555
3556 priv->cnp_mode = ELM_CNP_MODE_MARKUP;
3557 priv->line_wrap = ELM_WRAP_WORD;
3558 priv->context_menu = EINA_TRUE;
3559 priv->auto_save = EINA_TRUE;
3560 priv->editable = EINA_TRUE;
3561
3562 priv->drop_format = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
3563 elm_drop_target_add(obj, priv->drop_format,
3564 NULL, NULL,
3565 NULL, NULL,
3566 NULL, NULL,
3567 _drag_drop_cb, NULL);
3568
3569 if (!elm_layout_theme_set(obj, "entry", "base", elm_widget_style_get(obj)))
3570 CRI("Failed to set layout!");
3571
3572 priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
3573 evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj);
3574
3575 Evas_Object* clip = evas_object_clip_get(priv->entry_edje);
3576 evas_object_clip_set(priv->hit_rect, clip);
3577
3578 evas_object_smart_member_add(priv->hit_rect, obj);
3579 elm_widget_sub_object_add(obj, priv->hit_rect);
3580
3581 /* common scroller hit rectangle setup */
3582 evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
3583 evas_object_show(priv->hit_rect);
3584 evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
3585
3586 elm_interface_scrollable_objects_set(obj, priv->entry_edje, priv->hit_rect);
3587
3588 edje_object_item_provider_set(priv->entry_edje, _item_get, obj);
3589
3590 edje_object_text_markup_filter_callback_add
3591 (priv->entry_edje, "elm.text", _markup_filter_cb, obj);
3592
3593 evas_object_event_callback_add
3594 (priv->entry_edje, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, obj);
3595 evas_object_event_callback_add
3596 (priv->entry_edje, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj);
3597 evas_object_event_callback_add
3598 (priv->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj);
3599 evas_object_event_callback_add
3600 (priv->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj);
3601
3602 /* this code can't go in smart_resize. sizing gets wrong */
3603 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
3604
3605 edje_object_signal_callback_add
3606 (priv->entry_edje, "entry,changed", "elm.text",
3607 _entry_changed_signal_cb, obj);
3608 edje_object_signal_callback_add
3609 (priv->entry_edje, "entry,changed,user", "elm.text",
3610 _entry_changed_user_signal_cb, obj);
3611 edje_object_signal_callback_add
3612 (priv->entry_edje, "preedit,changed", "elm.text",
3613 _entry_preedit_changed_signal_cb, obj);
3614
3615 _entry_selection_callbacks_register(obj);
3616
3617 edje_object_signal_callback_add
3618 (priv->entry_edje, "cursor,changed", "elm.text",
3619 _entry_cursor_changed_signal_cb, obj);
3620 edje_object_signal_callback_add
3621 (priv->entry_edje, "cursor,changed,manual", "elm.text",
3622 _entry_cursor_changed_manual_signal_cb, obj);
3623 edje_object_signal_callback_add
3624 (priv->entry_edje, "anchor,mouse,down,*", "elm.text",
3625 _entry_anchor_down_signal_cb, obj);
3626 edje_object_signal_callback_add
3627 (priv->entry_edje, "anchor,mouse,up,*", "elm.text",
3628 _entry_anchor_up_signal_cb, obj);
3629 edje_object_signal_callback_add
3630 (priv->entry_edje, "anchor,mouse,clicked,*", "elm.text",
3631 _entry_anchor_clicked_signal_cb, obj);
3632 edje_object_signal_callback_add
3633 (priv->entry_edje, "anchor,mouse,move,*", "elm.text",
3634 _entry_anchor_move_signal_cb, obj);
3635 edje_object_signal_callback_add
3636 (priv->entry_edje, "anchor,mouse,in,*", "elm.text",
3637 _entry_anchor_in_signal_cb, obj);
3638 edje_object_signal_callback_add
3639 (priv->entry_edje, "anchor,mouse,out,*", "elm.text",
3640 _entry_anchor_out_signal_cb, obj);
3641 edje_object_signal_callback_add
3642 (priv->entry_edje, "entry,key,enter", "elm.text",
3643 _entry_key_enter_signal_cb, obj);
3644 edje_object_signal_callback_add
3645 (priv->entry_edje, "entry,key,escape", "elm.text",
3646 _entry_key_escape_signal_cb, obj);
3647 edje_object_signal_callback_add
3648 (priv->entry_edje, "mouse,down,1", "elm.text",
3649 _entry_mouse_down_signal_cb, obj);
3650 edje_object_signal_callback_add
3651 (priv->entry_edje, "mouse,clicked,1", "elm.text",
3652 _entry_mouse_clicked_signal_cb, obj);
3653 edje_object_signal_callback_add
3654 (priv->entry_edje, "mouse,down,1,double", "elm.text",
3655 _entry_mouse_double_signal_cb, obj);
3656 edje_object_signal_callback_add
3657 (priv->entry_edje, "mouse,down,1,triple", "elm.text",
3658 _entry_mouse_triple_signal_cb, obj);
3659 edje_object_signal_callback_add
3660 (priv->entry_edje, "entry,undo,request", "elm.text",
3661 _entry_undo_request_signal_cb, obj);
3662 edje_object_signal_callback_add
3663 (priv->entry_edje, "entry,redo,request", "elm.text",
3664 _entry_redo_request_signal_cb, obj);
3665
3666 elm_layout_text_set(obj, "elm.text", "");
3667
3668 elm_object_sub_cursor_set
3669 (wd->resize_obj, obj, ELM_CURSOR_XTERM);
3670 elm_widget_can_focus_set(obj, EINA_TRUE);
3671 if (_elm_config->desktop_entry)
3672 edje_object_part_text_select_allow_set
3673 (priv->entry_edje, "elm.text", EINA_TRUE);
3674
3675 elm_layout_sizing_eval(obj);
3676
3677 elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
3678 elm_entry_input_panel_enabled_set(obj, EINA_TRUE);
3679 elm_entry_prediction_allow_set(obj, EINA_TRUE);
3680 elm_entry_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE);
3681
3682 priv->autocapital_type = (Elm_Autocapital_Type)edje_object_part_text_autocapital_type_get
3683 (priv->entry_edje, "elm.text");
3684
3685 entries = eina_list_prepend(entries, obj);
3686
3687 // module - find module for entry
3688 priv->api = _module_find(obj);
3689 // if found - hook in
3690 if ((priv->api) && (priv->api->obj_hook)) priv->api->obj_hook(obj);
3691
3692 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3693
3694 // access
3695 _elm_access_object_register(obj, priv->entry_edje);
3696 _elm_access_text_set
3697 (_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Entry"));
3698 _elm_access_callback_set
3699 (_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
3700 _elm_access_callback_set
3701 (_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
3702
3703 if (_elm_config->desktop_entry)
3704 priv->sel_handler_disabled = EINA_TRUE;
3705}
3706
3707static void 3561static void
3708_create_selection_handlers(Evas_Object *obj, Elm_Entry_Data *sd) 3562_create_selection_handlers(Evas_Object *obj, Elm_Entry_Data *sd)
3709{ 3563{
@@ -3900,15 +3754,158 @@ _cb_deleted(void *data EINA_UNUSED, const Eo_Event *ev)
3900} 3754}
3901 3755
3902EOLIAN static Eo * 3756EOLIAN static Eo *
3903_elm_entry_eo_base_constructor(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED) 3757_elm_entry_eo_base_constructor(Eo *obj, Elm_Entry_Data *sd)
3904{ 3758{
3905 obj = eo_constructor(eo_super(obj, MY_CLASS)); 3759 obj = eo_constructor(eo_super(obj, MY_CLASS));
3760
3906 evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY); 3761 evas_obj_type_set(obj, MY_CLASS_NAME_LEGACY);
3907 evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks); 3762 evas_obj_smart_callbacks_descriptions_set(obj, _smart_callbacks);
3908 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_ENTRY); 3763 elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_ENTRY);
3909 eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_ADD, _cb_added, NULL); 3764 eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_ADD, _cb_added, NULL);
3910 eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_DEL, _cb_deleted, NULL); 3765 eo_event_callback_add(obj, EO_BASE_EVENT_CALLBACK_DEL, _cb_deleted, NULL);
3911 3766
3767 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
3768
3769 sd->entry_edje = wd->resize_obj;
3770
3771 sd->cnp_mode = ELM_CNP_MODE_MARKUP;
3772 sd->line_wrap = ELM_WRAP_WORD;
3773 sd->context_menu = EINA_TRUE;
3774 sd->auto_save = EINA_TRUE;
3775 sd->editable = EINA_TRUE;
3776
3777 sd->drop_format = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
3778 elm_drop_target_add(obj, sd->drop_format,
3779 NULL, NULL,
3780 NULL, NULL,
3781 NULL, NULL,
3782 _drag_drop_cb, NULL);
3783
3784 sd->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
3785 evas_object_data_set(sd->hit_rect, "_elm_leaveme", obj);
3786
3787 Evas_Object* clip = evas_object_clip_get(sd->entry_edje);
3788 evas_object_clip_set(sd->hit_rect, clip);
3789
3790 evas_object_smart_member_add(sd->hit_rect, obj);
3791 elm_widget_sub_object_add(obj, sd->hit_rect);
3792
3793 /* common scroller hit rectangle setup */
3794 evas_object_color_set(sd->hit_rect, 0, 0, 0, 0);
3795 evas_object_show(sd->hit_rect);
3796 evas_object_repeat_events_set(sd->hit_rect, EINA_TRUE);
3797
3798 edje_object_item_provider_set(sd->entry_edje, _item_get, obj);
3799
3800 edje_object_text_markup_filter_callback_add
3801 (sd->entry_edje, "elm.text", _markup_filter_cb, obj);
3802
3803 evas_object_event_callback_add
3804 (sd->entry_edje, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, obj);
3805 evas_object_event_callback_add
3806 (sd->entry_edje, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj);
3807 evas_object_event_callback_add
3808 (sd->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj);
3809 evas_object_event_callback_add
3810 (sd->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj);
3811
3812 /* this code can't go in smart_resize. sizing gets wrong */
3813 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
3814
3815 edje_object_signal_callback_add
3816 (sd->entry_edje, "entry,changed", "elm.text",
3817 _entry_changed_signal_cb, obj);
3818 edje_object_signal_callback_add
3819 (sd->entry_edje, "entry,changed,user", "elm.text",
3820 _entry_changed_user_signal_cb, obj);
3821 edje_object_signal_callback_add
3822 (sd->entry_edje, "preedit,changed", "elm.text",
3823 _entry_preedit_changed_signal_cb, obj);
3824
3825 _entry_selection_callbacks_register(obj);
3826
3827 edje_object_signal_callback_add
3828 (sd->entry_edje, "cursor,changed", "elm.text",
3829 _entry_cursor_changed_signal_cb, obj);
3830 edje_object_signal_callback_add
3831 (sd->entry_edje, "cursor,changed,manual", "elm.text",
3832 _entry_cursor_changed_manual_signal_cb, obj);
3833 edje_object_signal_callback_add
3834 (sd->entry_edje, "anchor,mouse,down,*", "elm.text",
3835 _entry_anchor_down_signal_cb, obj);
3836 edje_object_signal_callback_add
3837 (sd->entry_edje, "anchor,mouse,up,*", "elm.text",
3838 _entry_anchor_up_signal_cb, obj);
3839 edje_object_signal_callback_add
3840 (sd->entry_edje, "anchor,mouse,clicked,*", "elm.text",
3841 _entry_anchor_clicked_signal_cb, obj);
3842 edje_object_signal_callback_add
3843 (sd->entry_edje, "anchor,mouse,move,*", "elm.text",
3844 _entry_anchor_move_signal_cb, obj);
3845 edje_object_signal_callback_add
3846 (sd->entry_edje, "anchor,mouse,in,*", "elm.text",
3847 _entry_anchor_in_signal_cb, obj);
3848 edje_object_signal_callback_add
3849 (sd->entry_edje, "anchor,mouse,out,*", "elm.text",
3850 _entry_anchor_out_signal_cb, obj);
3851 edje_object_signal_callback_add
3852 (sd->entry_edje, "entry,key,enter", "elm.text",
3853 _entry_key_enter_signal_cb, obj);
3854 edje_object_signal_callback_add
3855 (sd->entry_edje, "entry,key,escape", "elm.text",
3856 _entry_key_escape_signal_cb, obj);
3857 edje_object_signal_callback_add
3858 (sd->entry_edje, "mouse,down,1", "elm.text",
3859 _entry_mouse_down_signal_cb, obj);
3860 edje_object_signal_callback_add
3861 (sd->entry_edje, "mouse,clicked,1", "elm.text",
3862 _entry_mouse_clicked_signal_cb, obj);
3863 edje_object_signal_callback_add
3864 (sd->entry_edje, "mouse,down,1,double", "elm.text",
3865 _entry_mouse_double_signal_cb, obj);
3866 edje_object_signal_callback_add
3867 (sd->entry_edje, "mouse,down,1,triple", "elm.text",
3868 _entry_mouse_triple_signal_cb, obj);
3869 edje_object_signal_callback_add
3870 (sd->entry_edje, "entry,undo,request", "elm.text",
3871 _entry_undo_request_signal_cb, obj);
3872 edje_object_signal_callback_add
3873 (sd->entry_edje, "entry,redo,request", "elm.text",
3874 _entry_redo_request_signal_cb, obj);
3875
3876 // module - find module for entry
3877 sd->api = _module_find(obj);
3878 // if found - hook in
3879 if ((sd->api) && (sd->api->obj_hook)) sd->api->obj_hook(obj);
3880
3881 _mirrored_set(obj, elm_widget_mirrored_get(obj));
3882
3883 // access
3884 _elm_access_object_register(obj, sd->entry_edje);
3885 _elm_access_text_set
3886 (_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Entry"));
3887 _elm_access_callback_set
3888 (_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
3889 _elm_access_callback_set
3890 (_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
3891
3892 if (_elm_config->desktop_entry)
3893 sd->sel_handler_disabled = EINA_TRUE;
3894
3895 elm_object_sub_cursor_set
3896 (wd->resize_obj, obj, ELM_CURSOR_XTERM);
3897 elm_widget_can_focus_set(obj, EINA_TRUE);
3898
3899 elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
3900 elm_entry_input_panel_enabled_set(obj, EINA_TRUE);
3901 elm_entry_prediction_allow_set(obj, EINA_TRUE);
3902 elm_entry_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE);
3903
3904 sd->autocapital_type = (Elm_Autocapital_Type)edje_object_part_text_autocapital_type_get
3905 (sd->entry_edje, "elm.text");
3906
3907 entries = eina_list_prepend(entries, obj);
3908
3912 return obj; 3909 return obj;
3913} 3910}
3914 3911
diff --git a/src/lib/elm_entry.eo b/src/lib/elm_entry.eo
index 166c6c75b..90c8f3803 100644
--- a/src/lib/elm_entry.eo
+++ b/src/lib/elm_entry.eo
@@ -920,7 +920,6 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interface,
920 Eo.Base.constructor; 920 Eo.Base.constructor;
921 Evas.Object_Smart.move; 921 Evas.Object_Smart.move;
922 Evas.Object_Smart.member_add; 922 Evas.Object_Smart.member_add;
923 Evas.Object_Smart.add;
924 Evas.Object_Smart.resize; 923 Evas.Object_Smart.resize;
925 Evas.Object_Smart.del; 924 Evas.Object_Smart.del;
926 Evas.Object_Smart.show; 925 Evas.Object_Smart.show;
@@ -933,6 +932,7 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Evas.Clickable_Interface,
933 Elm.Widget.disable; 932 Elm.Widget.disable;
934 Elm.Widget.sub_object_del; 933 Elm.Widget.sub_object_del;
935 Elm.Widget.focus_next_manager_is; 934 Elm.Widget.focus_next_manager_is;
935 Elm.Widget.theme_init;
936 Elm.Container.content_unset; 936 Elm.Container.content_unset;
937 Elm.Container.content_set; 937 Elm.Container.content_set;
938 Elm.Layout.theme_enable; 938 Elm.Layout.theme_enable;