Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/edje
Dir : e17/libs/edje/src/lib
Modified Files:
Edje.h edje_calc.c edje_load.c edje_main.c edje_private.h
edje_smart.c edje_util.c
Log Message:
edje can now swallow other evas objects... including... other EDJES! :)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/Edje.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- Edje.h 13 Jul 2003 02:06:46 -0000 1.10
+++ Edje.h 13 Jul 2003 06:19:08 -0000 1.11
@@ -21,15 +21,18 @@
int edje_object_play_get (Evas_Object *o);
void edje_object_animation_set (Evas_Object *o, int on);
int edje_object_animation_get (Evas_Object *o);
- int edje_object_part_exists (Evas_Object *o, const char *part);
- void edje_object_part_geometry_get (Evas_Object *o, const char *part,
double *x, double *y, double *w, double *h);
- void edje_object_part_text_set (Evas_Object *o, const char *part,
const char *text);
- const char *edje_object_part_text_get (Evas_Object *o, const char *part);
int edje_object_freeze (Evas_Object *o);
int edje_object_thaw (Evas_Object *o);
void edje_object_color_class_set (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);
void edje_object_text_class_set (Evas_Object *o, const char
*text_class, const char *font, double size);
-
+ int edje_object_part_exists (Evas_Object *o, const char *part);
+ void edje_object_part_geometry_get (Evas_Object *o, const char *part,
double *x, double *y, double *w, double *h);
+ void edje_object_part_text_set (Evas_Object *o, const char *part,
const char *text);
+ const char *edje_object_part_text_get (Evas_Object *o, const char *part);
+ void edje_object_part_swallow (Evas_Object *o, const char *part,
Evas_Object *o_swallow);
+ void edje_object_part_unswallow (Evas_Object *o, Evas_Object
*o_swallow);
+ Evas_Object *edje_object_part_swallow_get (Evas_Object *o, const char *part);
+
#ifdef __cplusplus
}
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_calc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- edje_calc.c 13 Jul 2003 02:06:46 -0000 1.4
+++ edje_calc.c 13 Jul 2003 06:19:08 -0000 1.5
@@ -640,6 +640,13 @@
if (p3.visible) evas_object_show(ep->object);
else evas_object_hide(ep->object);
}
+ if (ep->swallowed_object)
+ {
+ evas_object_move(ep->swallowed_object, ed->x + p3.x, ed->y + p3.y);
+ evas_object_resize(ep->swallowed_object, p3.w, p3.h);
+ if (p3.visible) evas_object_show(ep->swallowed_object);
+ else evas_object_hide(ep->swallowed_object);
+ }
ep->x = p3.x;
ep->y = p3.y;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_load.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- edje_load.c 10 Jul 2003 23:42:38 -0000 1.8
+++ edje_load.c 13 Jul 2003 06:19:08 -0000 1.9
@@ -227,6 +227,7 @@
rp = ed->parts->data;
_edje_text_part_on_del(ed, rp);
evas_object_del(rp->object);
+ if (rp->swallowed_object) evas_object_del(rp->swallowed_object);
if (rp->text.text) free(rp->text.text);
if (rp->text.font) free(rp->text.font);
if (rp->text.cache.in_str) free(rp->text.cache.in_str);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_main.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- edje_main.c 13 Jul 2003 02:06:46 -0000 1.22
+++ edje_main.c 13 Jul 2003 06:19:08 -0000 1.23
@@ -35,7 +35,6 @@
_edje_del(Edje *ed)
{
_edje_file_del(ed);
- _edje_clean_objects(ed);
if (ed->path) free(ed->path);
if (ed->part) free(ed->part);
while (ed->callbacks)
@@ -71,27 +70,8 @@
}
void
-_edje_clean_part_objects(Edje *ed)
-{
- Evas_List *l;
-
- for (l = ed->parts; l; l = l->next)
- {
- Edje_Real_Part *rp;
-
- rp = l->data;
- evas_object_del(rp->object);
- rp->object = NULL;
- }
-}
-
-void
_edje_clean_objects(Edje *ed)
{
- Evas_List *l;
-
- ed->have_objects = 0;
- _edje_clean_part_objects(ed);
evas_object_del(ed->clipper);
ed->evas = NULL;
ed->obj = NULL;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_private.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- edje_private.h 13 Jul 2003 02:06:46 -0000 1.27
+++ edje_private.h 13 Jul 2003 06:19:09 -0000 1.28
@@ -28,8 +28,7 @@
* real part size and "before min/max limit" sizes need to be stored per part
* need to be able to calculate min & max size of a whole edje
*
- * named parts need to be able to be "replaced" with new evas objects
- * part replacement with object callbacks should be possible
+ * swallowed objects need to be able to adversize min/max size
*
* need to be able to list collections in an eet file
*
@@ -349,6 +348,7 @@
} offset;
Evas_Object *object;
Evas_List *extra_objects;
+ Evas_Object *swallowed_object;
unsigned char calculated : 1;
unsigned char still_in : 1;
int clicked_button;
@@ -480,7 +480,6 @@
Edje *_edje_add(Evas_Object *obj);
void _edje_del(Edje *ed);
-void _edje_clean_part_objects(Edje *ed);
void _edje_clean_objects(Edje *ed);
void _edje_ref(Edje *ed);
void _edje_unref(Edje *ed);
@@ -496,6 +495,7 @@
void _edje_text_part_on_del(Edje *ed, Edje_Real_Part *ep);
void _edje_text_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *params,
Edje_Part_Description *chosen_desc);
+Edje_Real_Part *_edje_real_part_get(Edje *ed, char *part);
Ejde_Color_Class *_edje_color_class_find(Edje *ed, char *color_class);
Ejde_Text_Class *_edje_text_class_find(Edje *ed, char *text_class);
Edje *_edje_fetch(Evas_Object *obj);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_smart.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- edje_smart.c 8 Jul 2003 10:08:15 -0000 1.4
+++ edje_smart.c 13 Jul 2003 06:19:09 -0000 1.5
@@ -98,6 +98,8 @@
}
}
evas_object_layer_set(ep->object, ed->layer);
+ if (ep->swallowed_object)
+ evas_object_layer_set(ep->swallowed_object, ed->layer);
}
snprintf(buf, sizeof(buf), "layer,set,%i", layer);
_edje_emit(ed, buf, "");
@@ -129,6 +131,8 @@
}
}
evas_object_raise(ep->object);
+ if (ep->swallowed_object)
+ evas_object_raise(ep->swallowed_object);
}
_edje_emit(ed, "raise", "");
}
@@ -146,6 +150,8 @@
Edje_Real_Part *ep;
ep = l->data;
+ if (ep->swallowed_object)
+ evas_object_lower(ep->swallowed_object);
evas_object_lower(ep->object);
if (ep->extra_objects)
{
@@ -176,6 +182,8 @@
Edje_Real_Part *ep;
ep = l->data;
+ if (ep->swallowed_object)
+ evas_object_stack_above(ep->swallowed_object, above);
evas_object_stack_above(ep->object, above);
if (ep->extra_objects)
{
@@ -219,6 +227,8 @@
}
}
evas_object_stack_below(ep->object, below);
+ if (ep->swallowed_object)
+ evas_object_stack_below(ep->swallowed_object, below);
}
_edje_emit(ed, "stack_below", "");
}
@@ -245,6 +255,11 @@
ep = l->data;
evas_object_geometry_get(ep->object, &ox, &oy, NULL, NULL);
evas_object_move(ep->object, ed->x + ep->x + ep->offset.x, ed->y + ep->y
+ep->offset.y);
+ if (ep->swallowed_object)
+ {
+ evas_object_geometry_get(ep->swallowed_object, &ox, &oy, NULL, NULL);
+ evas_object_move(ep->swallowed_object, ed->x + ep->x + ep->offset.x,
ed->y + ep->y +ep->offset.y);
+ }
if (ep->extra_objects)
{
Evas_List *el;
@@ -267,15 +282,12 @@
_edje_smart_resize(Evas_Object * obj, double w, double h)
{
Edje *ed;
- int nw, nh;
ed = evas_object_smart_data_get(obj);
if (!ed) return;
- nw = ed->w;
- nh = ed->h;
+ if ((w == ed->w) && (h == ed->h)) return;
ed->w = w;
ed->h = h;
- if ((nw == ed->w) && (nh == ed->h)) return;
evas_object_resize(ed->clipper, ed->w, ed->h);
ed->dirty = 1;
_edje_recalc(ed);
@@ -289,6 +301,7 @@
ed = evas_object_smart_data_get(obj);
if (!ed) return;
+ if (evas_object_visible_get(obj)) return;
if ((ed->collection) && (ed->parts))
evas_object_show(ed->clipper);
_edje_emit(ed, "show", "");
@@ -301,6 +314,7 @@
ed = evas_object_smart_data_get(obj);
if (!ed) return;
+ if (!evas_object_visible_get(obj)) return;
evas_object_hide(ed->clipper);
_edje_emit(ed, "hide", "");
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- edje_util.c 13 Jul 2003 02:06:46 -0000 1.8
+++ edje_util.c 13 Jul 2003 06:19:09 -0000 1.9
@@ -2,115 +2,6 @@
#include "edje_private.h"
int
-edje_object_part_exists(Evas_Object *obj, const char *part)
-{
- Evas_List *l;
- Edje *ed;
-
- ed = _edje_fetch(obj);
- if ((!ed) || (!part)) return 0;
- for (l = ed->parts; l; l = l->next)
- {
- Edje_Real_Part *rp;
-
- rp = l->data;
- if (!strcmp(rp->part->name, part)) return 1;
- }
- return 0;
-}
-
-void
-edje_object_part_geometry_get(Evas_Object *obj, const char *part, double *x, double
*y, double *w, double *h )
-{
- Evas_List *l;
- Edje *ed;
-
- ed = _edje_fetch(obj);
- if ((!ed) || (!part))
- {
- if (x) *x = 0;
- if (y) *y = 0;
- if (w) *w = 0;
- if (h) *h = 0;
- return;
- }
- for (l = ed->parts; l; l = l->next)
- {
- Edje_Real_Part *rp;
-
- rp = l->data;
- if ((!strcmp(rp->part->name, part)) && (rp->calculated))
- {
- if (x) *x = rp->x;
- if (y) *y = rp->y;
- if (w) *w = rp->w;
- if (h) *h = rp->h;
- return;
- }
- }
- if (x) *x = 0;
- if (y) *y = 0;
- if (w) *w = 0;
- if (h) *h = 0;
-}
-
-void
-edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text)
-{
- Evas_List *l;
- Edje *ed;
-
- ed = _edje_fetch(obj);
- if ((!ed) || (!part)) return;
- for (l = ed->parts; l; l = l->next)
- {
- Edje_Real_Part *rp;
-
- rp = l->data;
- if (!strcmp(rp->part->name, part))
- {
- if (rp->part->type == EDJE_PART_TYPE_TEXT)
- {
- if ((!rp->text.text) && (!text))
- return;
- if ((rp->text.text) && (text) &&
- (!strcmp(rp->text.text, text)))
- return;
- if (rp->text.text) free(rp->text.text);
- rp->text.text = strdup(text);
- ed->dirty = 1;
- _edje_recalc(ed);
- }
- return;
- }
- }
-}
-
-const char *
-edje_object_part_text_get(Evas_Object *obj, const char *part)
-{
- Evas_List *l;
- Edje *ed;
-
- ed = _edje_fetch(obj);
- if ((!ed) || (!part)) return NULL;
- for (l = ed->parts; l; l = l->next)
- {
- Edje_Real_Part *rp;
-
- rp = l->data;
- if (!strcmp(rp->part->name, part))
- {
- if (rp->part->type == EDJE_PART_TYPE_TEXT)
- return evas_object_text_text_get(rp->object);
- else
- return NULL;
- }
- }
- return NULL;
-}
-
-int
edje_object_freeze(Evas_Object *obj)
{
Edje *ed;
@@ -244,6 +135,168 @@
ed->text_classes = evas_list_append(ed->text_classes, tc);
ed->dirty = 1;
_edje_recalc(ed);
+}
+
+int
+edje_object_part_exists(Evas_Object *obj, const char *part)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part)) return 0;
+ rp = _edje_real_part_get(ed, (char *)part);
+ if (!rp) return 0;
+ return 1;
+}
+
+void
+edje_object_part_geometry_get(Evas_Object *obj, const char *part, double *x, double
*y, double *w, double *h )
+{
+ Evas_List *l;
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part))
+ {
+ if (x) *x = 0;
+ if (y) *y = 0;
+ if (w) *w = 0;
+ if (h) *h = 0;
+ return;
+ }
+ rp = _edje_real_part_get(ed, (char *)part);
+ if (!rp)
+ {
+ if (x) *x = 0;
+ if (y) *y = 0;
+ if (w) *w = 0;
+ if (h) *h = 0;
+ return;
+ }
+ if (x) *x = rp->x;
+ if (y) *y = rp->y;
+ if (w) *w = rp->w;
+ if (h) *h = rp->h;
+}
+
+void
+edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part)) return;
+ rp = _edje_real_part_get(ed, (char *)part);
+ if (!rp) return;
+ if (rp->part->type != EDJE_PART_TYPE_TEXT) return;
+ if ((!rp->text.text) && (!text))
+ return;
+ if ((rp->text.text) && (text) &&
+ (!strcmp(rp->text.text, text)))
+ return;
+ if (rp->text.text) free(rp->text.text);
+ rp->text.text = strdup(text);
+ ed->dirty = 1;
+ _edje_recalc(ed);
+}
+
+const char *
+edje_object_part_text_get(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_get(ed, (char *)part);
+ if (!rp) return NULL;
+ if (rp->part->type == EDJE_PART_TYPE_TEXT)
+ return evas_object_text_text_get(rp->object);
+ return NULL;
+}
+
+void
+edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow)
+{
+ Edje *ed;
+ Edje_Real_Part *rp;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!part)) return;
+ rp = _edje_real_part_get(ed, (char *)part);
+ if (!rp) return;
+ if (rp->swallowed_object)
+ {
+ evas_object_clip_unset(rp->swallowed_object);
+ rp->swallowed_object = NULL;
+ }
+ if (!obj_swallow) return;
+ rp->swallowed_object = obj_swallow;
+ evas_object_clip_set(rp->swallowed_object, ed->clipper);
+ evas_object_stack_above(rp->swallowed_object, rp->object);
+ ed->dirty = 1;
+ _edje_recalc(ed);
+}
+
+void
+edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
+{
+ Edje *ed;
+ Evas_List *l;
+
+ ed = _edje_fetch(obj);
+ if ((!ed) || (!obj_swallow)) return;
+ for (l = ed->parts; l; l = l->next)
+ {
+ Edje_Real_Part *rp;
+
+ rp = l->data;
+ if (rp->swallowed_object == obj_swallow)
+ {
+ evas_object_clip_unset(rp->swallowed_object);
+ rp->swallowed_object = NULL;
+ ed->dirty = 1;
+ _edje_recalc(ed);
+ return;
+ }
+ }
+}
+
+Evas_Object *
+edje_object_part_swallow_get(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_get(ed, (char *)part);
+ if (!rp) return NULL;
+ return rp->swallowed_object;
+}
+
+
+
+
+
+
+
+Edje_Real_Part *
+_edje_real_part_get(Edje *ed, char *part)
+{
+ Evas_List *l;
+
+ for (l = ed->parts; l; l = l->next)
+ {
+ Edje_Real_Part *rp;
+
+ rp = l->data;
+ if (!strcmp(rp->part->name, part)) return rp;
+ }
+ return NULL;
}
Ejde_Color_Class *
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs