track subobjs (used by entry only for now) and emit signals to them too

SVN revision: 37688
This commit is contained in:
Carsten Haitzler 2008-11-17 05:54:01 +00:00
parent 3e2108728f
commit 38f06f34e8
5 changed files with 41 additions and 4 deletions

View File

@ -273,6 +273,8 @@ _sel_clear(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
Sel *sel;
sel = en->sel->data;
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_bg);
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_fg);
if (sel->obj_bg) evas_object_del(sel->obj_bg);
if (sel->obj_fg) evas_object_del(sel->obj_fg);
free(sel);
@ -302,6 +304,8 @@ _sel_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
while (en->sel)
{
sel = en->sel->data;
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_bg);
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_fg);
if (sel->obj_bg) evas_object_del(sel->obj_bg);
if (sel->obj_fg) evas_object_del(sel->obj_fg);
free(sel);
@ -323,6 +327,8 @@ _sel_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
evas_object_pass_events_set(ob, 1);
evas_object_show(ob);
sel->obj_bg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg);
ob = edje_object_add(en->rp->edje->evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2);
evas_object_smart_member_add(ob, smart);
@ -331,6 +337,7 @@ _sel_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
evas_object_pass_events_set(ob, 1);
evas_object_show(ob);
sel->obj_fg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_fg);
}
}
}
@ -503,6 +510,8 @@ _anchors_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
while (an->sel)
{
sel = an->sel->data;
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_bg);
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_fg);
if (sel->obj_bg) evas_object_del(sel->obj_bg);
if (sel->obj_fg) evas_object_del(sel->obj_fg);
if (sel->obj) evas_object_del(sel->obj);
@ -523,6 +532,8 @@ _anchors_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
evas_object_pass_events_set(ob, 1);
evas_object_show(ob);
sel->obj_bg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_bg);
ob = edje_object_add(en->rp->edje->evas);
edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6);
evas_object_smart_member_add(ob, smart);
@ -531,6 +542,8 @@ _anchors_update(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
evas_object_pass_events_set(ob, 1);
evas_object_show(ob);
sel->obj_fg = ob;
en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, sel->obj_fg);
ob = evas_object_rectangle_add(en->rp->edje->evas);
evas_object_color_set(ob, 0, 0, 0, 0);
evas_object_smart_member_add(ob, smart);
@ -590,6 +603,8 @@ _anchors_clear(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
while (an->sel)
{
Sel *sel = an->sel->data;
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_bg);
en->rp->edje->subobjs = eina_list_remove(en->rp->edje->subobjs, sel->obj_fg);
if (sel->obj_bg) evas_object_del(sel->obj_bg);
if (sel->obj_fg) evas_object_del(sel->obj_fg);
if (sel->obj) evas_object_del(sel->obj);
@ -1189,6 +1204,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
evas_object_stack_below(en->cursor_bg, rp->object);
evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object));
evas_object_pass_events_set(en->cursor_bg, 1);
rp->edje->subobjs = eina_list_append(rp->edje->subobjs, en->cursor_bg);
en->cursor_fg = edje_object_add(rp->edje->evas);
edje_object_file_set(en->cursor_fg, rp->edje->path, rp->part->source4);
@ -1196,12 +1212,13 @@ _edje_entry_real_part_init(Edje_Real_Part *rp)
evas_object_stack_above(en->cursor_fg, rp->object);
evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object));
evas_object_pass_events_set(en->cursor_fg, 1);
rp->edje->subobjs = eina_list_append(rp->edje->subobjs, en->cursor_fg);
if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE)
{
evas_object_show(en->cursor_bg);
evas_object_show(en->cursor_fg);
}
en->cursor = evas_object_textblock_cursor_get(rp->object);
}
@ -1213,6 +1230,8 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
rp->entry_data = NULL;
_sel_clear(en->cursor, rp->object, en);
_anchors_clear(en->cursor, rp->object, en);
rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_bg);
rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_fg);
evas_object_del(en->cursor_bg);
evas_object_del(en->cursor_fg);
free(en);

View File

@ -587,6 +587,12 @@ _edje_object_file_set_internal(Evas_Object *obj, const char *file, const char *g
ed->load_error = EDJE_LOAD_ERROR_NONE;
_edje_emit(ed, "load", NULL);
}
// this has to be here to textblock works! otherwise textblock objects
// don't have styles. withotu styles textblock doesnt know how to
// convert markup to format nodes+text - so if u append or modify the
// text by appending format or text nodes, you lose the markup as it
// has no idea what to do. this forces at least a style to be applied
edje_object_calc_force(obj);
return 1;
}
else

View File

@ -629,6 +629,7 @@ struct _Edje
Edje_Real_Part **table_parts;
Edje_Program **table_programs;
Edje_Real_Part *focused_part;
Eina_List *subobjs;
void *script_only_data;
int table_programs_size;
int table_parts_size;
@ -1238,5 +1239,5 @@ void _edje_entry_set_cursor_end(Edje_Real_Part *rp);
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);
void _edje_entry_cursor_geometry_get(Edje_Real_Part *rp, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch);
#endif

View File

@ -812,11 +812,22 @@ void
_edje_emit(Edje *ed, const char *sig, const char *src)
{
Edje_Message_Signal emsg;
Eina_List *l;
Evas_Object *obj;
if (ed->delete_me) return;
emsg.sig = sig;
emsg.src = src;
_edje_message_send(ed, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg);
EINA_LIST_FOREACH(ed->subobjs, l, obj)
{
Edje *ed2;
ed2 = _edje_fetch(obj);
if (!ed2) continue;
if (ed2->delete_me) continue;
_edje_message_send(ed2, EDJE_QUEUE_SCRIPT, EDJE_MESSAGE_SIGNAL, 0, &emsg);
}
}
struct _Edje_Program_Data

View File

@ -919,7 +919,7 @@ edje_object_part_text_get(const Evas_Object *obj, const char *part)
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_text_get(rp);
return _edje_entry_text_get(rp);
else
{
if (rp->part->type == EDJE_PART_TYPE_TEXT) return rp->text.text;