From cc621a26859007fc646b3b93944884025deeff57 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sat, 29 May 2010 06:40:56 +0000 Subject: [PATCH] not fully done string insert approval cb for entry SVN revision: 49276 --- legacy/edje/src/lib/Edje.h | 164 +++++++++++++++-------------- legacy/edje/src/lib/edje_entry.c | 34 +++++- legacy/edje/src/lib/edje_main.c | 9 ++ legacy/edje/src/lib/edje_private.h | 9 ++ legacy/edje/src/lib/edje_util.c | 91 ++++++++++------ 5 files changed, 193 insertions(+), 114 deletions(-) diff --git a/legacy/edje/src/lib/Edje.h b/legacy/edje/src/lib/Edje.h index bacf97b873..6958eb3a15 100644 --- a/legacy/edje/src/lib/Edje.h +++ b/legacy/edje/src/lib/Edje.h @@ -360,7 +360,6 @@ struct _Edje_External_Type * - #EDJE_EXTERNAL_TYPE_ABI_VERSION to declare. * - edje_external_type_abi_version_get() to check. */ - const char *module; const char *module_name; Evas_Object *(*add) (void *data, Evas *evas, Evas_Object *parent, const Eina_List *params, const char *part_name); /**< creates the object to be used by Edje as the part */ @@ -385,7 +384,6 @@ struct _Edje_External_Type }; typedef struct _Edje_External_Type Edje_External_Type; - struct _Edje_External_Type_Info { const char *name; @@ -393,10 +391,8 @@ struct _Edje_External_Type_Info }; typedef struct _Edje_External_Type_Info Edje_External_Type_Info; - - -typedef void (*Edje_Signal_Cb) (void *data, Evas_Object *obj, const char *emission, const char *source); -typedef void (*Edje_Text_Change_Cb) (void *data, Evas_Object *obj, const char *part); +typedef void (*Edje_Signal_Cb) (void *data, Evas_Object *obj, const char *emission, const char *source); +typedef void (*Edje_Text_Change_Cb) (void *data, Evas_Object *obj, const char *part); typedef void (*Edje_Message_Handler_Cb) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg); #ifdef __cplusplus @@ -435,17 +431,17 @@ extern "C" { /* edje_util.c */ - EAPI Eina_Bool edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); - EAPI Eina_Bool edje_color_class_get(const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); - EAPI void edje_color_class_del(const char *color_class); - EAPI Eina_List * edje_color_class_list(void); - EAPI Eina_Bool edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_text_class_del(const char *text_class); - EAPI Eina_List * edje_text_class_list(void); + EAPI Eina_Bool edje_color_class_set (const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + EAPI Eina_Bool edje_color_class_get (const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); + EAPI void edje_color_class_del (const char *color_class); + EAPI Eina_List *edje_color_class_list (void); + EAPI Eina_Bool edje_text_class_set (const char *text_class, const char *font, Evas_Font_Size size); + EAPI void edje_text_class_del (const char *text_class); + EAPI Eina_List *edje_text_class_list (void); EAPI void edje_extern_object_min_size_set (Evas_Object *obj, Evas_Coord minw, Evas_Coord minh); EAPI void edje_extern_object_max_size_set (Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh); - EAPI void edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); - EAPI void edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data); + EAPI void edje_extern_object_aspect_set (Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah); + EAPI void edje_box_layout_register (const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data); /* edje_smart.c */ EAPI Evas_Object *edje_object_add (Evas *evas); @@ -472,32 +468,35 @@ extern "C" { EAPI Eina_Bool edje_object_animation_get (const Evas_Object *obj); /* edje_util.c */ - EAPI int edje_object_freeze (Evas_Object *obj); - EAPI int edje_object_thaw (Evas_Object *obj); - EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); - EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); - EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); - EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); - EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); - EAPI void edje_object_calc_force (Evas_Object *obj); - EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); - EAPI Eina_Bool edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + EAPI int edje_object_freeze (Evas_Object *obj); + EAPI int edje_object_thaw (Evas_Object *obj); + EAPI Eina_Bool edje_object_color_class_set (Evas_Object *obj, const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + EAPI Eina_Bool edje_object_color_class_get (const Evas_Object *o, const char *color_class, int *r, int *g, int *b, int *a, int *r2, int *g2, int *b2, int *a2, int *r3, int *g3, int *b3, int *a3); + EAPI void edje_object_color_class_del (Evas_Object *obj, const char *color_class); + EAPI Eina_Bool edje_object_text_class_set (Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size); + EAPI void edje_object_size_min_get (const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI void edje_object_size_max_get (const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); + EAPI void edje_object_calc_force (Evas_Object *obj); + EAPI void edje_object_size_min_calc (Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh); + EAPI Eina_Bool edje_object_parts_extends_calc (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); EAPI void edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh); - EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); - EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); - EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); - EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); - EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape); - EAPI char *edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_exists (const Evas_Object *obj, const char *part); + EAPI const Evas_Object *edje_object_part_object_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_geometry_get (const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + + EAPI void edje_object_item_provider_set (Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data); + + EAPI void edje_object_text_change_cb_set (Evas_Object *obj, Edje_Text_Change_Cb func, void *data); + + EAPI Eina_Bool edje_object_part_text_set (Evas_Object *obj, const char *part, const char *text); + EAPI const char *edje_object_part_text_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_text_unescaped_set (Evas_Object *obj, const char *part, const char *text_to_escape); + EAPI char *edje_object_part_text_unescaped_get (const Evas_Object *obj, const char *part); EAPI const char *edje_object_part_text_selection_get (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_none (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_insert (Evas_Object *obj, const char *part, const char *text); - EAPI void edje_object_item_provider_set (Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data); EAPI const Eina_List *edje_object_part_text_anchor_list_get (const Evas_Object *obj, const char *part); EAPI const Eina_List *edje_object_part_text_anchor_geometry_get (const Evas_Object *obj, const char *part, const char *anchor); EAPI const Eina_List *edje_object_part_text_item_list_get (const Evas_Object *obj, const char *part); @@ -508,19 +507,22 @@ extern "C" { EAPI void edje_object_part_text_select_begin (const Evas_Object *obj, const char *part); EAPI void edje_object_part_text_select_extend (const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_text_cursor_next(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_prev(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_up(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_down(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_begin_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_end_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_copy(const Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); - EAPI void edje_object_part_text_cursor_line_begin_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI void edje_object_part_text_cursor_line_end_set(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI Eina_Bool edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_next (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_prev (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_up (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_down (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_begin_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_end_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_copy (const Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst); + EAPI void edje_object_part_text_cursor_line_begin_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_part_text_cursor_line_end_set (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI Eina_Bool edje_object_part_text_cursor_is_format_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); EAPI Eina_Bool edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); - EAPI const char *edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI const char *edje_object_part_text_cursor_content_get (const Evas_Object *obj, const char *part, Edje_Cursor cur); + EAPI void edje_object_text_insert_filter_callback_add (Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data); + EAPI void edje_object_text_insert_filter_callback_del (Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data); + EAPI Eina_Bool edje_object_part_swallow (Evas_Object *obj, const char *part, Evas_Object *obj_swallow); EAPI void edje_object_part_unswallow (Evas_Object *obj, Evas_Object *obj_swallow); EAPI Evas_Object *edje_object_part_swallow_get (const Evas_Object *obj, const char *part); @@ -537,54 +539,54 @@ extern "C" { EAPI Eina_Bool edje_object_part_drag_step (Evas_Object *obj, const char *part, double dx, double dy); EAPI Eina_Bool edje_object_part_drag_page (Evas_Object *obj, const char *part, double dx, double dy); - EAPI Evas_Object *edje_object_part_external_object_get(const Evas_Object *obj, const char *part); - EAPI Eina_Bool edje_object_part_external_param_set(Evas_Object *obj, const char *part, const Edje_External_Param *param); - EAPI Eina_Bool edje_object_part_external_param_get(const Evas_Object *obj, const char *part, Edje_External_Param *param); - EAPI Edje_External_Param_Type edje_object_part_external_param_type_get(const Evas_Object *obj, const char *part, const char *param); + EAPI Evas_Object *edje_object_part_external_object_get (const Evas_Object *obj, const char *part); + EAPI Eina_Bool edje_object_part_external_param_set (Evas_Object *obj, const char *part, const Edje_External_Param *param); + EAPI Eina_Bool edje_object_part_external_param_get (const Evas_Object *obj, const char *part, Edje_External_Param *param); + EAPI Edje_External_Param_Type edje_object_part_external_param_type_get (const Evas_Object *obj, const char *part, const char *param); - EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); - EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); - EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); - EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); - EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); - EAPI Evas_Object *edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned int col, unsigned int row); - EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); - EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); + EAPI Eina_Bool edje_object_part_box_append (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Eina_Bool edje_object_part_box_prepend (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Eina_Bool edje_object_part_box_insert_before (Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference); + EAPI Eina_Bool edje_object_part_box_insert_at (Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos); + EAPI Evas_Object *edje_object_part_box_remove (Evas_Object *obj, const char *part, Evas_Object *child); + EAPI Evas_Object *edje_object_part_box_remove_at (Evas_Object *obj, const char *part, unsigned int pos); + EAPI Eina_Bool edje_object_part_box_remove_all (Evas_Object *obj, const char *part, Eina_Bool clear); + EAPI Evas_Object *edje_object_part_table_child_get (Evas_Object *obj, const char *part, unsigned int col, unsigned int row); + EAPI Eina_Bool edje_object_part_table_pack (Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan); + EAPI Eina_Bool edje_object_part_table_unpack (Evas_Object *obj, const char *part, Evas_Object *child_obj); EAPI Eina_Bool edje_object_part_table_col_row_size_get (const Evas_Object *obj, const char *part, int *cols, int *rows); - EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); + EAPI Eina_Bool edje_object_part_table_clear (Evas_Object *obj, const char *part, Eina_Bool clear); /* edje_message_queue.c */ - EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); - EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); - EAPI void edje_object_message_signal_process (Evas_Object *obj); + EAPI void edje_object_message_send (Evas_Object *obj, Edje_Message_Type type, int id, void *msg); + EAPI void edje_object_message_handler_set (Evas_Object *obj, Edje_Message_Handler_Cb func, void *data); + EAPI void edje_object_message_signal_process (Evas_Object *obj); - EAPI void edje_message_signal_process (void); + EAPI void edje_message_signal_process (void); /* edje_external.c */ - EAPI Eina_Bool edje_external_type_register(const char *type_name, const Edje_External_Type *type_info); - EAPI Eina_Bool edje_external_type_unregister(const char *type_name); + EAPI Eina_Bool edje_external_type_register (const char *type_name, const Edje_External_Type *type_info); + EAPI Eina_Bool edje_external_type_unregister (const char *type_name); - EAPI void edje_external_type_array_register(const Edje_External_Type_Info *array); - EAPI void edje_external_type_array_unregister(const Edje_External_Type_Info *array); + EAPI void edje_external_type_array_register (const Edje_External_Type_Info *array); + EAPI void edje_external_type_array_unregister (const Edje_External_Type_Info *array); - EAPI unsigned int edje_external_type_abi_version_get(void) EINA_CONST; + EAPI unsigned int edje_external_type_abi_version_get (void) EINA_CONST; - EAPI Eina_Iterator *edje_external_iterator_get(void); - EAPI Edje_External_Param *edje_external_param_find(const Eina_List *params, const char *key); - EAPI Eina_Bool edje_external_param_int_get(const Eina_List *params, const char *key, int *ret); - EAPI Eina_Bool edje_external_param_double_get(const Eina_List *params, const char *key, double *ret); - EAPI Eina_Bool edje_external_param_string_get(const Eina_List *params, const char *key, const char **ret); - EAPI Eina_Bool edje_external_param_bool_get(const Eina_List *params, const char *key, Eina_Bool *ret); - EAPI Eina_Bool edje_external_param_choice_get(const Eina_List *params, const char *key, const char **ret); - EAPI const Edje_External_Param_Info *edje_external_param_info_get(const char *type_name); - EAPI const Edje_External_Type *edje_external_type_get(const char *type_name); + EAPI Eina_Iterator *edje_external_iterator_get (void); + EAPI Edje_External_Param *edje_external_param_find (const Eina_List *params, const char *key); + EAPI Eina_Bool edje_external_param_int_get (const Eina_List *params, const char *key, int *ret); + EAPI Eina_Bool edje_external_param_double_get (const Eina_List *params, const char *key, double *ret); + EAPI Eina_Bool edje_external_param_string_get (const Eina_List *params, const char *key, const char **ret); + EAPI Eina_Bool edje_external_param_bool_get (const Eina_List *params, const char *key, Eina_Bool *ret); + EAPI Eina_Bool edje_external_param_choice_get (const Eina_List *params, const char *key, const char **ret); + EAPI const Edje_External_Param_Info *edje_external_param_info_get (const char *type_name); + EAPI const Edje_External_Type *edje_external_type_get (const char *type_name); /* edje_module.c */ - EAPI Eina_Bool edje_module_load(const char *module); - EAPI const Eina_List *edje_available_modules_get(void); + EAPI Eina_Bool edje_module_load (const char *module); + EAPI const Eina_List *edje_available_modules_get (void); /* perspective info for maps inside edje objects */ typedef struct _Edje_Perspective Edje_Perspective; diff --git a/legacy/edje/src/lib/edje_entry.c b/legacy/edje/src/lib/edje_entry.c index eb4d6af7d3..77eb366091 100644 --- a/legacy/edje/src/lib/edje_entry.c +++ b/legacy/edje/src/lib/edje_entry.c @@ -177,6 +177,32 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, #endif } +// need one for markup and format too - how to do it? extra type param? +static void +_text_filter_prepend(Entry *en, const char *text) +{ + char *text2; + Edje_Text_Insert_Filter_Callback *cb; + Eina_List *l; + + text2 = strdup(text); + EINA_LIST_FOREACH(en->rp->edje->text_insert_filter_callbacks, l, cb) + { + if (!strcmp(cb->part, en->rp->part->name)) + { + cb->func(cb->data, en->rp->edje->obj, cb->part, &text2); + if (!text2) break; + } + } + if (text2) + { + evas_textblock_cursor_text_prepend(en->cursor, text2); +// evas_textblock_cursor_format_prepend(en->cursor, text2); +// evas_object_textblock_text_markup_prepend(en->cursor, text2); + free(text2); + } +} + static void _curs_update_from_curs(Evas_Textblock_Cursor *c, Evas_Object *o __UNUSED__, Entry *en) { @@ -1369,6 +1395,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v } else { + //yy evas_textblock_cursor_format_prepend(en->cursor, "\t"); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -1420,6 +1447,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //yy evas_textblock_cursor_format_prepend(en->cursor, "\n"); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -1437,6 +1465,7 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //zz evas_textblock_cursor_text_prepend(en->cursor, ev->string); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -2068,6 +2097,7 @@ _edje_entry_text_markup_insert(Edje_Real_Part *rp, const char *text) if (en->have_selection) _range_del(en->cursor, rp->object, en); _sel_clear(en->cursor, rp->object, en); + //xx evas_object_textblock_text_markup_prepend(en->cursor, text); _curs_update_from_curs(en->cursor, rp->object, en); _anchors_get(en->cursor, rp->object, en); @@ -2675,6 +2705,7 @@ _edje_entry_imf_event_commit_cb(void *data, int type __UNUSED__, void *event) en->have_composition = EINA_FALSE; } + //yy evas_textblock_cursor_text_prepend(en->cursor, ev->str); _curs_update_from_curs(en->cursor, rp->object, en); @@ -2728,7 +2759,8 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event) en->have_composition = EINA_TRUE; - evas_object_textblock_text_markup_prepend (en->cursor, preedit_string); + //xx + evas_object_textblock_text_markup_prepend(en->cursor, preedit_string); _sel_extend(en->cursor, rp->object, en); diff --git a/legacy/edje/src/lib/edje_main.c b/legacy/edje/src/lib/edje_main.c index dbbeb0da14..4eaca15f2c 100644 --- a/legacy/edje/src/lib/edje_main.c +++ b/legacy/edje/src/lib/edje_main.c @@ -265,6 +265,15 @@ _edje_del(Edje *ed) if (tc->font) eina_stringshare_del(tc->font); free(tc); } + while (ed->text_insert_filter_callbacks) + { + Edje_Text_Insert_Filter_Callback *cb; + + cb = eina_list_data_get(ed->text_insert_filter_callbacks); + ed->text_insert_filter_callbacks = eina_list_remove(ed->text_insert_filter_callbacks, cb); + eina_stringshare_del(cb->part); + free(cb); + } free(ed); } diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 46d0c991ee..7e8a582088 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h @@ -762,6 +762,7 @@ typedef struct _Edje_Var_Animator Edje_Var_Animator; typedef struct _Edje_Var_Timer Edje_Var_Timer; typedef struct _Edje_Var_Pool Edje_Var_Pool; typedef struct _Edje_Signal_Source_Char Edje_Signal_Source_Char; +typedef struct _Edje_Text_Insert_Filter_Callback Edje_Text_Insert_Filter_Callback; struct _Edje_Signal_Source_Char { @@ -811,6 +812,7 @@ struct _Edje Edje_Program **table_programs; Edje_Real_Part *focused_part; Eina_List *subobjs; + Eina_List *text_insert_filter_callbacks; void *script_only_data; int table_programs_size; int table_parts_size; @@ -1030,6 +1032,13 @@ struct _Edje_Signal_Callback unsigned char delete_me : 1; }; +struct _Edje_Text_Insert_Filter_Callback +{ + const char *part; + void (*func) (void *data, Evas_Object *obj, const char *part, char **text); + void *data; +}; + struct _Edje_Pending_Program { Edje *edje; diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 57d59cdc18..10faf82ccf 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c @@ -1189,6 +1189,27 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo return EINA_TRUE; } +/** + * @brief Set the function that provides item objects for named items in an edje entry text + * + * @param obj A valid Evas Object handle + * @param func The function to call (or NULL to disable) to get item objects + * @param data The data pointer to pass to the @p func callback + * + * Item objects may be deleted any time by Edje, and will be deleted when the + * Edje object is deleted (or file is set to a new file). + */ +EAPI void +edje_object_item_provider_set(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data) +{ + Edje *ed; + + ed = _edje_fetch(obj); + if (!ed) return; + ed->item_provider.func = func; + ed->item_provider.data = data; +} + /* FIXDOC: New Function */ /** * @brief Set the object text callback. @@ -1603,27 +1624,6 @@ edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *tex rp->edje->text_change.func(rp->edje->text_change.data, obj, part); } -/** - * @brief Set the function that provides item objects for named items in an edje entry text - * - * @param obj A valid Evas Object handle - * @param func The function to call (or NULL to disable) to get item objects - * @param data The data pointer to pass to the @p func callback - * - * Item objects may be deleted any time by Edje, and will be deleted when the - * Edje object is deleted (or file is set to a new file). - */ -EAPI void -edje_object_item_provider_set(Evas_Object *obj, Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item), void *data) -{ - Edje *ed; - - ed = _edje_fetch(obj); - if (!ed) return; - ed->item_provider.func = func; - ed->item_provider.data = data; -} - /** * @brief Return a list of char anchor names. * @@ -2125,6 +2125,44 @@ edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *par return NULL; } +EAPI void +edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data) +{ + Edje *ed; + Edje_Text_Insert_Filter_Callback *cb; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + cb = calloc(1, sizeof(Edje_Text_Insert_Filter_Callback)); + cb->part = eina_stringshare_add(part); + cb->func = func; + cb->data = data; + ed->text_insert_filter_callbacks = + eina_list_append(ed->text_insert_filter_callbacks, cb); +} + +EAPI void +edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, void (*func) (void *data, Evas_Object *obj, const char *part, char **text), const void *data) +{ + Edje *ed; + Edje_Text_Insert_Filter_Callback *cb; + Eina_List *l; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb) + { + if ((!strcmp(cb->part, part)) && (cb->func == func)) + { + ed->text_insert_filter_callbacks = + eina_list_remove_list(ed->text_insert_filter_callbacks, l); + eina_stringshare_del(cb->part); + free(cb); + return; + } + } +} + /** * @brief Swallows an object into the edje. * @@ -3896,14 +3934,6 @@ edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear return EINA_TRUE; } - - - - - - - - static void _edje_perspective_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -4070,9 +4100,6 @@ edje_object_perspective_get(const Evas_Object *obj) return ed->persp; } - - - #define EDJE_PRELOAD_EMISSION "preload,done" #define EDJE_PRELOAD_SOURCE NULL