forked from enlightenment/efl
not fully done string insert approval cb for entry
SVN revision: 49276
This commit is contained in:
parent
a14cd60f77
commit
cc621a2685
|
@ -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,8 +391,6 @@ 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_Message_Handler_Cb) (void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg);
|
||||
|
@ -487,7 +483,11 @@ extern "C" {
|
|||
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);
|
||||
|
@ -497,7 +497,6 @@ extern "C" {
|
|||
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);
|
||||
|
@ -521,6 +520,9 @@ extern "C" {
|
|||
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 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);
|
||||
|
|
|
@ -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,6 +2759,7 @@ _edje_entry_imf_event_changed_cb(void *data, int type __UNUSED__, void *event)
|
|||
|
||||
en->have_composition = EINA_TRUE;
|
||||
|
||||
//xx
|
||||
evas_object_textblock_text_markup_prepend(en->cursor, preedit_string);
|
||||
|
||||
_sel_extend(en->cursor, rp->object, en);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue