forked from enlightenment/efl
parent
2d349c2d7b
commit
685fadf869
|
@ -495,8 +495,11 @@ extern "C" {
|
||||||
EAPI void edje_object_part_text_select_none (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_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_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_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_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);
|
||||||
|
EAPI Eina_Bool edje_object_part_text_item_geometry_get (const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||||
EAPI void edje_object_part_text_cursor_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_part_text_cursor_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_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow);
|
EAPI void edje_object_part_text_select_allow_set (const Evas_Object *obj, const char *part, Eina_Bool allow);
|
||||||
EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part);
|
EAPI void edje_object_part_text_select_abort (const Evas_Object *obj, const char *part);
|
||||||
|
|
|
@ -49,6 +49,7 @@ struct _Entry
|
||||||
Eina_List *sel;
|
Eina_List *sel;
|
||||||
Eina_List *anchors;
|
Eina_List *anchors;
|
||||||
Eina_List *anchorlist;
|
Eina_List *anchorlist;
|
||||||
|
Eina_List *itemlist;
|
||||||
char *selection;
|
char *selection;
|
||||||
Eina_Bool selecting : 1;
|
Eina_Bool selecting : 1;
|
||||||
Eina_Bool have_selection : 1;
|
Eina_Bool have_selection : 1;
|
||||||
|
@ -740,6 +741,7 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
|
||||||
|
|
||||||
sel = calloc(1, sizeof(Sel));
|
sel = calloc(1, sizeof(Sel));
|
||||||
an->sel = eina_list_append(an->sel, sel);
|
an->sel = eina_list_append(an->sel, sel);
|
||||||
|
/*
|
||||||
ob = evas_object_rectangle_add(en->rp->edje->evas);
|
ob = evas_object_rectangle_add(en->rp->edje->evas);
|
||||||
evas_object_color_set(ob, 0, 0, 0, 0);
|
evas_object_color_set(ob, 0, 0, 0, 0);
|
||||||
evas_object_smart_member_add(ob, smart);
|
evas_object_smart_member_add(ob, smart);
|
||||||
|
@ -747,8 +749,20 @@ _anchors_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en)
|
||||||
evas_object_clip_set(ob, clip);
|
evas_object_clip_set(ob, clip);
|
||||||
evas_object_pass_events_set(ob, 1);
|
evas_object_pass_events_set(ob, 1);
|
||||||
evas_object_show(ob);
|
evas_object_show(ob);
|
||||||
|
*/
|
||||||
|
if (en->rp->edje->item_provider.func)
|
||||||
|
{
|
||||||
|
ob = en->rp->edje->item_provider.func
|
||||||
|
(en->rp->edje->item_provider.data, smart,
|
||||||
|
en->rp->part->name, an->name);
|
||||||
|
evas_object_smart_member_add(ob, smart);
|
||||||
|
evas_object_stack_above(ob, o);
|
||||||
|
evas_object_clip_set(ob, clip);
|
||||||
|
evas_object_pass_events_set(ob, 1);
|
||||||
|
evas_object_show(ob);
|
||||||
sel->obj = ob;
|
sel->obj = ob;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// for link anchors
|
// for link anchors
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -854,6 +868,11 @@ _anchors_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, E
|
||||||
free(en->anchorlist->data);
|
free(en->anchorlist->data);
|
||||||
en->anchorlist = eina_list_remove_list(en->anchorlist, en->anchorlist);
|
en->anchorlist = eina_list_remove_list(en->anchorlist, en->anchorlist);
|
||||||
}
|
}
|
||||||
|
while (en->itemlist)
|
||||||
|
{
|
||||||
|
free(en->itemlist->data);
|
||||||
|
en->itemlist = eina_list_remove_list(en->itemlist, en->itemlist);
|
||||||
|
}
|
||||||
while (en->anchors)
|
while (en->anchors)
|
||||||
{
|
{
|
||||||
Anchor *an = en->anchors->data;
|
Anchor *an = en->anchors->data;
|
||||||
|
@ -2191,6 +2210,48 @@ _edje_entry_anchors_list(Edje_Real_Part *rp)
|
||||||
return en->anchorlist;
|
return en->anchorlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
_edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
||||||
|
{
|
||||||
|
Entry *en = rp->entry_data;
|
||||||
|
Eina_List *l;
|
||||||
|
Anchor *an;
|
||||||
|
|
||||||
|
if (!en) return 0;
|
||||||
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
||||||
|
{
|
||||||
|
if (an->item) continue;
|
||||||
|
if (!strcmp(item, an->name))
|
||||||
|
{
|
||||||
|
evas_textblock_cursor_format_item_geometry_get(an->start, cx, cy, cw, ch);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Eina_List *
|
||||||
|
_edje_entry_items_list(Edje_Real_Part *rp)
|
||||||
|
{
|
||||||
|
Entry *en = rp->entry_data;
|
||||||
|
Eina_List *l, *items = NULL;
|
||||||
|
Anchor *an;
|
||||||
|
|
||||||
|
if (!en) return NULL;
|
||||||
|
if (!en->itemlist)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(en->anchors, l, an)
|
||||||
|
{
|
||||||
|
const char *n = an->name;
|
||||||
|
if (an->item) continue;
|
||||||
|
if (!n) n = "";
|
||||||
|
items = eina_list_append(items, strdup(n));
|
||||||
|
}
|
||||||
|
en->itemlist = items;
|
||||||
|
}
|
||||||
|
return en->itemlist;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
_edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -869,6 +869,11 @@ struct _Edje
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
Eina_Inlist *lua_objs;
|
Eina_Inlist *lua_objs;
|
||||||
int lua_ref;
|
int lua_ref;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Evas_Object *(*func) (void *data, Evas_Object *obj, const char *part, const char *item);
|
||||||
|
void *data;
|
||||||
|
} item_provider;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Edje_Calc_Params
|
struct _Edje_Calc_Params
|
||||||
|
@ -1550,6 +1555,8 @@ void _edje_entry_select_begin(Edje_Real_Part *rp);
|
||||||
void _edje_entry_select_extend(Edje_Real_Part *rp);
|
void _edje_entry_select_extend(Edje_Real_Part *rp);
|
||||||
const Eina_List *_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor);
|
const Eina_List *_edje_entry_anchor_geometry_get(Edje_Real_Part *rp, const char *anchor);
|
||||||
const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
|
const Eina_List *_edje_entry_anchors_list(Edje_Real_Part *rp);
|
||||||
|
Eina_Bool _edje_entry_item_geometry_get(Edje_Real_Part *rp, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||||
|
const Eina_List *_edje_entry_items_list(Edje_Real_Part *rp);
|
||||||
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
|
||||||
void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
|
void _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow);
|
||||||
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
|
Eina_Bool _edje_entry_select_allow_get(const Edje_Real_Part *rp);
|
||||||
|
|
|
@ -1603,6 +1603,27 @@ 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);
|
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.
|
* @brief Return a list of char anchor names.
|
||||||
*
|
*
|
||||||
|
@ -1637,7 +1658,7 @@ edje_object_part_text_anchor_list_get(const Evas_Object *obj, const char *part)
|
||||||
* @param anchor The anchor name
|
* @param anchor The anchor name
|
||||||
*
|
*
|
||||||
* @return The list of anchor rects (const Evas_Textblock_Rectangle
|
* @return The list of anchor rects (const Evas_Textblock_Rectangle
|
||||||
* *), do not modify!
|
* *), do not modify! Geometry is relative to entry part.
|
||||||
*
|
*
|
||||||
* This function return a list of Evas_Textblock_Rectangle anchor
|
* This function return a list of Evas_Textblock_Rectangle anchor
|
||||||
* rectangles.
|
* rectangles.
|
||||||
|
@ -1658,6 +1679,64 @@ edje_object_part_text_anchor_geometry_get(const Evas_Object *obj, const char *pa
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return a list of char item names.
|
||||||
|
*
|
||||||
|
* @param obj A valid Evas_Object handle
|
||||||
|
* @param part The part name
|
||||||
|
*
|
||||||
|
* @return The list of items (const char *), do not modify!
|
||||||
|
*
|
||||||
|
* This function returns a list of char item names.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
EAPI const Eina_List *
|
||||||
|
edje_object_part_text_item_list_get(const Evas_Object *obj, const char *part)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part)) return NULL;
|
||||||
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
||||||
|
if (!rp) return NULL;
|
||||||
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
||||||
|
return _edje_entry_items_list(rp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return item geometry.
|
||||||
|
*
|
||||||
|
* @param obj A valid Evas_Object handle
|
||||||
|
* @param part The part name
|
||||||
|
* @param item The item name
|
||||||
|
* @param cx Item x return (relative to entry part)
|
||||||
|
* @param cy Item y return (relative to entry part)
|
||||||
|
* @param cw Item width return
|
||||||
|
* @param ch Item height return
|
||||||
|
*
|
||||||
|
* @return 1 if item exists, 0 if not
|
||||||
|
*
|
||||||
|
* This function return a list of Evas_Textblock_Rectangle item
|
||||||
|
* rectangles.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
||||||
|
{
|
||||||
|
Edje *ed;
|
||||||
|
Edje_Real_Part *rp;
|
||||||
|
|
||||||
|
ed = _edje_fetch(obj);
|
||||||
|
if ((!ed) || (!part)) return 0;
|
||||||
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
||||||
|
if (!rp) return 0;
|
||||||
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
||||||
|
return _edje_entry_item_geometry_get(rp, item, cx, cy, cw, ch);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the cursor geometry of the part relative to the edje
|
* @brief Returns the cursor geometry of the part relative to the edje
|
||||||
* object.
|
* object.
|
||||||
|
|
Loading…
Reference in New Issue