Hi everyone!
I started working with edje yesterday (always a lover of e, but I was
amazed in Dave Andreoli's presentation at bossa conference!) and second
thing I wanted to do was to include a group as a swallowed object of a
part :) . I thought it was a good way to reuse the group multiple times,
and for example define a button bar and use it in multiple places, but
constrained by the swallowing part geometry.
I couldn't find how to do it using edje+embryo, but I was able to do it
using python-efl. So I wrote a patch to add a part_swallow function to
the edje exported embryo functions as a way to do this directly without
external code. Now I can do something like:
program {
name, "init";
signal, "load";
script {
part_swallow(PART:"button_bar", "Group_Button_Bar");
}
}
I don't really know if it might be useful or even if there aren't tons
of side effects, since I'm not 100% familiar with the codebase, but
maybe it is or someone can explain what's wrong and I end up learning
something!
It might be a good idea to be able to swallow another part directly
without the use of a program, which would involve changing edje syntax.
If it sounds good, I'm willing to do it.
Thanks!
Santiago.
? edje_part_swallow.patch
Index: data/include/edje.inc
===================================================================
RCS file: /var/cvs/e/e17/libs/edje/data/include/edje.inc,v
retrieving revision 1.23
diff -n -u -r1.23 edje.inc
--- data/include/edje.inc 11 Aug 2007 13:20:33 -0000 1.23
+++ data/include/edje.inc 26 Mar 2008 01:31:53 -0000
@@ -108,6 +108,7 @@
native stop_programs_on (part_id);
native set_min_size (Float:w, Float:h);
native set_max_size (Float:w, Float:h);
+native part_swallow (part_id, str[]);
enum Msg_Type
{
Index: src/lib/edje_embryo.c
===================================================================
RCS file: /var/cvs/e/e17/libs/edje/src/lib/edje_embryo.c,v
retrieving revision 1.59
diff -n -u -r1.59 edje_embryo.c
--- src/lib/edje_embryo.c 6 Mar 2008 17:52:58 -0000 1.59
+++ src/lib/edje_embryo.c 26 Mar 2008 01:31:58 -0000
@@ -174,6 +174,7 @@
* set_clip(part_id, clip_part_id)
* get_clip(part_id)
*
+ * part_swallow(part_id, group_name)
*
* ADD/DEL CUSTOM OBJECTS UNDER SOLE EMBRYO SCRIPT CONTROL
*
@@ -2129,6 +2130,43 @@
return 0;
}
+/* part_swallow(part_id, group_name) */
+static Embryo_Cell
+_edje_embryo_fn_part_swallow(Embryo_Program *ep, Embryo_Cell *params)
+{
+ int part_id = 0;
+ char* group_name = 0;
+ Edje *ed;
+ Edje_Real_Part *rp;
+ Evas_Object *new_obj;
+
+ CHKPARAM(2);
+
+ part_id = params[1];
+ if (part_id < 0) return 0;
+
+ GETSTR(group_name, params[2]);
+ if (!group_name) return 0;
+
+ ed = embryo_program_data_get(ep);
+
+ rp = ed->table_parts[part_id % ed->table_parts_size];
+ if (!rp || rp->part->type != EDJE_PART_TYPE_SWALLOW) return 0;
+
+ new_obj = edje_object_add(ed->evas);
+ if (!new_obj) return 0;
+
+ if (!edje_object_file_set(new_obj, ed->file->path, group_name))
+ {
+ evas_object_smart_member_del(new_obj);
+ return 0;
+ }
+
+ _edje_real_part_swallow(rp, new_obj);
+
+ return 0;
+}
+
void
_edje_embryo_script_init(Edje *ed)
{
@@ -2203,6 +2241,8 @@
embryo_program_native_call_add(ep, "set_state_val", _edje_embryo_fn_set_state_val);
embryo_program_native_call_add(ep, "get_state_val", _edje_embryo_fn_get_state_val);
+ embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
+
// embryo_program_vm_push(ed->collection->script);
// _edje_embryo_globals_init(ed);
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel