2005-02-24 02:25:40 -08:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
2008-06-07 03:06:14 -07:00
|
|
|
|
2008-10-26 10:18:19 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
struct _Edje_Box_Layout
|
|
|
|
{
|
|
|
|
EINA_RBTREE;
|
|
|
|
Evas_Object_Box_Layout func;
|
|
|
|
void *(*layout_data_get)(void *);
|
|
|
|
void (*layout_data_free)(void *);
|
|
|
|
void *data;
|
|
|
|
void (*free_data)(void *);
|
|
|
|
char name[];
|
|
|
|
};
|
|
|
|
typedef struct _Edje_Box_Layout Edje_Box_Layout;
|
|
|
|
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
static Eina_Hash *_edje_color_class_hash = NULL;
|
|
|
|
static Eina_Hash *_edje_color_class_member_hash = NULL;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
static Eina_Hash *_edje_text_class_hash = NULL;
|
|
|
|
static Eina_Hash *_edje_text_class_member_hash = NULL;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
static Eina_Rbtree *_edje_box_layout_registry = NULL;
|
|
|
|
|
2005-03-20 08:49:10 -08:00
|
|
|
char *_edje_fontset_append = NULL;
|
2008-09-09 07:13:34 -07:00
|
|
|
double _edje_scale = 1.0;
|
2008-09-09 23:39:57 -07:00
|
|
|
int _edje_freeze_val = 0;
|
|
|
|
int _edje_freeze_calc_count = 0;
|
2004-06-05 21:42:17 -07:00
|
|
|
|
2006-01-16 18:41:25 -08:00
|
|
|
typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
|
|
|
|
|
|
|
|
struct _Edje_List_Foreach_Data
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *list;
|
2006-01-16 18:41:25 -08:00
|
|
|
};
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
static Eina_Bool _edje_color_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata);
|
|
|
|
static Eina_Bool _edje_text_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata);
|
2006-01-16 18:41:25 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje *ed, char **path);
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/************************** API Routines **************************/
|
|
|
|
|
|
|
|
/* FIXDOC: These all need to be looked over, Verified/Expanded upon. I just got lazy and stopped putting FIXDOC next to each function in this file. */
|
|
|
|
|
2008-09-09 23:39:57 -07:00
|
|
|
//#define FASTFREEZE 1
|
|
|
|
|
2007-04-14 21:24:07 -07:00
|
|
|
/** Freeze all Edje objects in the current process.
|
|
|
|
*
|
|
|
|
* See edje_object_freeze() for more.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-15 22:15:15 -07:00
|
|
|
edje_freeze(void)
|
|
|
|
{
|
2008-09-09 23:39:57 -07:00
|
|
|
#ifdef FASTFREEZE
|
|
|
|
_edje_freeze_val++;
|
|
|
|
printf("fr ++ ->%i\n", _edje_freeze_val);
|
|
|
|
#else
|
|
|
|
// FIXME: could just have a global freeze instead of per object
|
|
|
|
// above i tried.. but this broke some things. notable e17's menus. why?
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *data;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
|
|
|
edje_object_freeze(data);
|
2008-09-09 23:39:57 -07:00
|
|
|
#endif
|
2003-07-15 22:15:15 -07:00
|
|
|
}
|
|
|
|
|
2008-09-10 00:17:24 -07:00
|
|
|
#ifdef FASTFREEZE
|
|
|
|
static void
|
|
|
|
_edje_thaw_edje(Edje *ed)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
{
|
|
|
|
Edje *ed2;
|
|
|
|
|
|
|
|
ed2 = _edje_fetch(rp->swallowed_object);
|
|
|
|
if (ed2) _edje_thaw_edje(ed2);
|
|
|
|
}
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
if ((ed->recalc) && (ed->freeze <= 0)) _edje_recalc_do(ed);
|
2008-09-10 00:17:24 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-04-14 21:24:07 -07:00
|
|
|
/** Thaw all Edje objects in the current process.
|
|
|
|
*
|
|
|
|
* See edje_object_thaw() for more.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-15 22:15:15 -07:00
|
|
|
edje_thaw(void)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Evas_Object *data;
|
2008-09-09 23:39:57 -07:00
|
|
|
#ifdef FASTFREEZE
|
|
|
|
_edje_freeze_val--;
|
|
|
|
printf("fr -- ->%i\n", _edje_freeze_val);
|
2008-09-10 00:17:24 -07:00
|
|
|
if ((_edje_freeze_val <= 0) && (_edje_freeze_calc_count > 0))
|
2008-09-09 23:39:57 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2008-09-09 23:39:57 -07:00
|
|
|
|
|
|
|
_edje_freeze_calc_count = 0;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
2008-09-09 23:39:57 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(data);
|
2008-09-10 00:17:24 -07:00
|
|
|
if (ed) _edje_thaw_edje(ed);
|
2008-09-09 23:39:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
// FIXME: could just have a global freeze instead of per object
|
|
|
|
// comment as above.. why?
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
|
|
|
edje_object_thaw(data);
|
2008-09-09 23:39:57 -07:00
|
|
|
#endif
|
2003-07-15 22:15:15 -07:00
|
|
|
}
|
|
|
|
|
2005-03-20 08:49:10 -08:00
|
|
|
/* FIXDOC: Expand */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2007-07-16 00:31:06 -07:00
|
|
|
edje_fontset_append_set(const char *fonts)
|
2005-03-20 08:49:10 -08:00
|
|
|
{
|
|
|
|
if (_edje_fontset_append)
|
|
|
|
free(_edje_fontset_append);
|
2005-03-28 06:26:29 -08:00
|
|
|
_edje_fontset_append = fonts ? strdup(fonts) : NULL;
|
2005-03-20 08:49:10 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXDOC: Expand */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI const char *
|
2005-03-20 08:49:10 -08:00
|
|
|
edje_fontset_append_get(void)
|
|
|
|
{
|
|
|
|
return _edje_fontset_append;
|
|
|
|
}
|
|
|
|
|
2008-09-09 07:13:34 -07:00
|
|
|
EAPI void
|
|
|
|
edje_scale_set(double scale)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *data;
|
2008-09-09 07:13:34 -07:00
|
|
|
|
|
|
|
if (_edje_scale == scale) return;
|
|
|
|
_edje_scale = scale;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, data)
|
|
|
|
edje_object_calc_force(data);
|
2008-09-09 07:13:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_scale_get(void)
|
|
|
|
{
|
|
|
|
return _edje_scale;
|
|
|
|
}
|
|
|
|
|
2009-02-02 21:07:58 -08:00
|
|
|
EAPI void
|
|
|
|
edje_object_scale_set(Evas_Object *obj, double scale)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return;
|
|
|
|
if (ed->scale == scale) return;
|
|
|
|
ed->scale = scale;
|
|
|
|
edje_object_calc_force(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_object_scale_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return 0.0;
|
|
|
|
return ed->scale;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: Verify/Expand */
|
|
|
|
/** Get Edje object data
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param key The data key
|
|
|
|
* @return The data string
|
2007-04-14 21:24:07 -07:00
|
|
|
*
|
|
|
|
* This fetches data specified at the object level.
|
|
|
|
*
|
|
|
|
* In EDC this comes from a data block within the group block that @a obj
|
|
|
|
* was loaded from. E.g.
|
|
|
|
*
|
|
|
|
* @code
|
|
|
|
* collections {
|
|
|
|
* group {
|
|
|
|
* name: "a_group";
|
|
|
|
* data {
|
|
|
|
* item: "key1" "value1";
|
|
|
|
* item: "key2" "value2";
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* @endcode
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI const char *
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_data_get(const Evas_Object *obj, const char *key)
|
2003-08-05 07:33:35 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Data *di;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-08-05 07:33:35 -07:00
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!key))
|
|
|
|
return NULL;
|
|
|
|
if (!ed->collection) return NULL;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->collection->data, l, di)
|
|
|
|
if ((di->key) && (!strcmp(di->key, key)))
|
|
|
|
return (const char *)di->value;
|
2003-08-05 07:33:35 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: Verify/Expand */
|
|
|
|
/** Freeze object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @return The frozen state\n
|
|
|
|
* 0 on Error
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* This puts all changes on hold. Successive freezes will nest,
|
|
|
|
* requiring an equal number of thaws.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2003-07-12 19:06:46 -07:00
|
|
|
edje_object_freeze(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return 0;
|
2007-05-26 22:28:07 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_freeze(rp->swallowed_object);
|
|
|
|
}
|
2003-07-12 19:06:46 -07:00
|
|
|
return _edje_freeze(ed);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Thaw object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @return The frozen state\n
|
|
|
|
* 0 on Error
|
|
|
|
*
|
|
|
|
* This allows frozen changes to occur.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2003-07-12 19:06:46 -07:00
|
|
|
edje_object_thaw(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return 0;
|
2007-05-26 22:28:07 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_thaw(rp->swallowed_object);
|
|
|
|
}
|
2003-07-12 19:06:46 -07:00
|
|
|
return _edje_thaw(ed);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set Edje color class
|
|
|
|
* @param color_class
|
|
|
|
* @param r Object Red value
|
|
|
|
* @param g Object Green value
|
|
|
|
* @param b Object Blue value
|
|
|
|
* @param a Object Alpha value
|
|
|
|
* @param r2 Outline Red value
|
|
|
|
* @param g2 Outline Green value
|
|
|
|
* @param b2 Outline Blue value
|
|
|
|
* @param a2 Outline Alpha value
|
|
|
|
* @param r3 Shadow Red value
|
|
|
|
* @param g3 Shadow Green value
|
|
|
|
* @param b3 Shadow Blue value
|
|
|
|
* @param a3 Shadow Alpha value
|
|
|
|
*
|
2006-12-24 02:29:16 -08:00
|
|
|
* Sets the color values for a process level color class. This will cause all
|
2006-01-16 18:41:25 -08:00
|
|
|
* edje parts in the current process that have the specified color class to
|
2006-12-24 02:29:16 -08:00
|
|
|
* have their colors multiplied by these values. (Object level color classes
|
|
|
|
* set by edje_object_color_class_set() will override the values set by this
|
2006-01-16 18:41:25 -08:00
|
|
|
* function).
|
|
|
|
*
|
|
|
|
* The first color is the object, the second is the text outline, and the
|
|
|
|
* third is the text shadow. (Note that the second two only apply to text parts)
|
2006-12-24 02:29:16 -08:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-11-03 22:15:19 -08:00
|
|
|
edje_color_class_set(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)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
Edje_Color_Class *cc;
|
|
|
|
|
|
|
|
if (!color_class) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
cc = eina_hash_find(_edje_color_class_hash, color_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!cc)
|
|
|
|
{
|
2005-01-12 22:00:37 -08:00
|
|
|
cc = calloc(1, sizeof(Edje_Color_Class));
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!cc) return;
|
2008-10-15 07:11:11 -07:00
|
|
|
cc->name = eina_stringshare_add(color_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!cc->name)
|
|
|
|
{
|
|
|
|
free(cc);
|
|
|
|
return;
|
|
|
|
}
|
2008-12-17 00:04:42 -08:00
|
|
|
if (!_edje_color_class_hash) _edje_color_class_hash = eina_hash_string_superfast_new(NULL);
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_add(_edje_color_class_hash, color_class, cc);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (r < 0) r = 0;
|
|
|
|
if (r > 255) r = 255;
|
|
|
|
if (g < 0) g = 0;
|
|
|
|
if (g > 255) g = 255;
|
|
|
|
if (b < 0) b = 0;
|
|
|
|
if (b > 255) b = 255;
|
|
|
|
if (a < 0) a = 0;
|
|
|
|
if (a > 255) a = 255;
|
2006-12-24 02:29:16 -08:00
|
|
|
if ((cc->r == r) && (cc->g == g) &&
|
2003-11-03 22:15:19 -08:00
|
|
|
(cc->b == b) && (cc->a == a) &&
|
|
|
|
(cc->r2 == r2) && (cc->g2 == g2) &&
|
|
|
|
(cc->b2 == b2) && (cc->a2 == a2) &&
|
|
|
|
(cc->r3 == r3) && (cc->g3 == g3) &&
|
|
|
|
(cc->b3 == b3) && (cc->a3 == a3))
|
|
|
|
return;
|
|
|
|
cc->r = r;
|
|
|
|
cc->g = g;
|
|
|
|
cc->b = b;
|
|
|
|
cc->a = a;
|
|
|
|
cc->r2 = r2;
|
|
|
|
cc->g2 = g2;
|
|
|
|
cc->b2 = b2;
|
|
|
|
cc->a2 = a2;
|
|
|
|
cc->r3 = r3;
|
|
|
|
cc->g3 = g3;
|
|
|
|
cc->b3 = b3;
|
|
|
|
cc->a3 = a3;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_color_class_member_hash, color_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
while (members)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
ed = eina_list_data_get(members);
|
2003-11-03 22:15:19 -08:00
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-16 18:41:25 -08:00
|
|
|
/**
|
|
|
|
* @param color_class
|
|
|
|
*
|
|
|
|
* Deletes any values at the process level for the specified color class.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
edje_color_class_del(const char *color_class)
|
|
|
|
{
|
|
|
|
Edje_Color_Class *cc;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2006-01-16 18:41:25 -08:00
|
|
|
|
|
|
|
if (!color_class) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
cc = eina_hash_find(_edje_color_class_hash, color_class);
|
2006-01-16 18:41:25 -08:00
|
|
|
if (!cc) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_color_class_hash, color_class, cc);
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(cc->name);
|
2006-01-16 18:41:25 -08:00
|
|
|
free(cc);
|
2006-01-17 16:43:55 -08:00
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_color_class_member_hash, color_class);
|
2006-01-17 16:43:55 -08:00
|
|
|
while (members)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
ed = eina_list_data_get(members);
|
2006-01-17 16:43:55 -08:00
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2006-01-17 16:43:55 -08:00
|
|
|
}
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lists all color classes known about by the current process.
|
|
|
|
*
|
|
|
|
* @return A list of color class names (strings). These strings and the list
|
|
|
|
* must be free()'d by the caller.
|
|
|
|
*/
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *
|
2006-01-16 18:41:25 -08:00
|
|
|
edje_color_class_list(void)
|
|
|
|
{
|
2007-03-01 14:39:01 -08:00
|
|
|
Edje_List_Foreach_Data fdata;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-03-01 14:39:01 -08:00
|
|
|
memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_color_class_member_hash,
|
2008-02-15 11:30:12 -08:00
|
|
|
_edje_color_class_list_foreach, &fdata);
|
2007-03-01 13:53:33 -08:00
|
|
|
|
2007-03-01 14:39:01 -08:00
|
|
|
return fdata.list;
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_color_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
2006-01-16 18:41:25 -08:00
|
|
|
{
|
|
|
|
Edje_List_Foreach_Data *fd;
|
|
|
|
|
|
|
|
fd = fdata;
|
2008-10-22 04:34:42 -07:00
|
|
|
fd->list = eina_list_append(fd->list, strdup(key));
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Sets the object color class
|
2004-10-27 12:24:42 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param color_class
|
|
|
|
* @param r Object Red value
|
|
|
|
* @param g Object Green value
|
|
|
|
* @param b Object Blue value
|
|
|
|
* @param a Object Alpha value
|
|
|
|
* @param r2 Outline Red value
|
|
|
|
* @param g2 Outline Green value
|
|
|
|
* @param b2 Outline Blue value
|
|
|
|
* @param a2 Outline Alpha value
|
|
|
|
* @param r3 Shadow Red value
|
|
|
|
* @param g3 Shadow Green value
|
|
|
|
* @param b3 Shadow Blue value
|
|
|
|
* @param a3 Shadow Alpha value
|
|
|
|
*
|
2006-12-24 02:29:16 -08:00
|
|
|
* Sets the color values for an object level color class. This will cause all
|
2006-01-16 18:41:25 -08:00
|
|
|
* edje parts in the specified object that have the specified color class to
|
2006-12-24 02:29:16 -08:00
|
|
|
* have their colors multiplied by these values.
|
2006-01-16 18:41:25 -08:00
|
|
|
*
|
|
|
|
* The first color is the object, the second is the text outline, and the
|
|
|
|
* third is the text shadow. (Note that the second two only apply to text parts)
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-12 19:06:46 -07:00
|
|
|
edje_object_color_class_set(Evas_Object *obj, 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)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2003-10-29 20:45:18 -08:00
|
|
|
Edje_Color_Class *cc;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!color_class)) return;
|
|
|
|
if (r < 0) r = 0;
|
|
|
|
if (r > 255) r = 255;
|
|
|
|
if (g < 0) g = 0;
|
|
|
|
if (g > 255) g = 255;
|
|
|
|
if (b < 0) b = 0;
|
|
|
|
if (b > 255) b = 255;
|
|
|
|
if (a < 0) a = 0;
|
|
|
|
if (a > 255) a = 255;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->color_classes, l, cc)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2005-12-05 02:08:30 -08:00
|
|
|
if ((cc->name) && (!strcmp(cc->name, color_class)))
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2006-12-24 02:29:16 -08:00
|
|
|
if ((cc->r == r) && (cc->g == g) &&
|
2003-07-12 19:06:46 -07:00
|
|
|
(cc->b == b) && (cc->a == a) &&
|
2006-12-24 02:29:16 -08:00
|
|
|
(cc->r2 == r2) && (cc->g2 == g2) &&
|
2003-07-12 19:06:46 -07:00
|
|
|
(cc->b2 == b2) && (cc->a2 == a2) &&
|
2006-12-24 02:29:16 -08:00
|
|
|
(cc->r3 == r3) && (cc->g3 == g3) &&
|
2003-07-12 19:06:46 -07:00
|
|
|
(cc->b3 == b3) && (cc->a3 == a3))
|
|
|
|
return;
|
|
|
|
cc->r = r;
|
|
|
|
cc->g = g;
|
|
|
|
cc->b = b;
|
|
|
|
cc->a = a;
|
|
|
|
cc->r2 = r2;
|
|
|
|
cc->g2 = g2;
|
|
|
|
cc->b2 = b2;
|
|
|
|
cc->a2 = a2;
|
|
|
|
cc->r3 = r3;
|
|
|
|
cc->g3 = g3;
|
|
|
|
cc->b3 = b3;
|
|
|
|
cc->a3 = a3;
|
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2003-10-29 20:45:18 -08:00
|
|
|
cc = malloc(sizeof(Edje_Color_Class));
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!cc) return;
|
2008-10-15 07:11:11 -07:00
|
|
|
cc->name = eina_stringshare_add(color_class);
|
2003-07-12 19:06:46 -07:00
|
|
|
if (!cc->name)
|
|
|
|
{
|
|
|
|
free(cc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cc->r = r;
|
|
|
|
cc->g = g;
|
|
|
|
cc->b = b;
|
|
|
|
cc->a = a;
|
|
|
|
cc->r2 = r2;
|
|
|
|
cc->g2 = g2;
|
|
|
|
cc->b2 = b2;
|
|
|
|
cc->a2 = a2;
|
|
|
|
cc->r3 = r3;
|
|
|
|
cc->g3 = g3;
|
|
|
|
cc->b3 = b3;
|
|
|
|
cc->a3 = a3;
|
2008-10-22 04:34:42 -07:00
|
|
|
ed->color_classes = eina_list_append(ed->color_classes, cc);
|
2003-07-12 19:06:46 -07:00
|
|
|
ed->dirty = 1;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_color_class_set(rp->swallowed_object, color_class, r, g, b, a, r2, g2, b2, a2, r3, g3, b3, a3);
|
|
|
|
}
|
|
|
|
|
2003-07-12 19:06:46 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
}
|
|
|
|
|
2006-01-16 18:41:25 -08:00
|
|
|
/**
|
|
|
|
* @param color_class
|
|
|
|
*
|
|
|
|
* Deletes any values at the object level for the specified object and
|
|
|
|
* color class.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
edje_object_color_class_del(Evas_Object *obj, const char *color_class)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2006-01-16 18:41:25 -08:00
|
|
|
Edje_Color_Class *cc = NULL;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2006-01-16 18:41:25 -08:00
|
|
|
|
|
|
|
if (!color_class) return;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->color_classes, l, cc)
|
2006-01-16 18:41:25 -08:00
|
|
|
{
|
|
|
|
if (!strcmp(cc->name, color_class))
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
ed->color_classes = eina_list_remove(ed->color_classes, cc);
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(cc->name);
|
2006-01-16 18:41:25 -08:00
|
|
|
free(cc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-01-17 16:43:55 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_color_class_del(rp->swallowed_object, color_class);
|
|
|
|
}
|
|
|
|
|
2006-01-17 17:01:05 -08:00
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set the Edje text class
|
|
|
|
* @param text_class The text class name ?!
|
|
|
|
* @param font The font name
|
|
|
|
* @param size The font size
|
|
|
|
*
|
2006-03-27 23:45:54 -08:00
|
|
|
* This sets updates all edje members which belong to this text class
|
2006-12-24 02:29:16 -08:00
|
|
|
* with the new font attributes.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-11-03 22:15:19 -08:00
|
|
|
edje_text_class_set(const char *text_class, const char *font, Evas_Font_Size size)
|
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
Edje_Text_Class *tc;
|
|
|
|
|
|
|
|
if (!text_class) return;
|
|
|
|
if (!font) font = "";
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
tc = eina_hash_find(_edje_text_class_hash, text_class);
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Create new text class */
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!tc)
|
|
|
|
{
|
|
|
|
tc = calloc(1, sizeof(Edje_Text_Class));
|
|
|
|
if (!tc) return;
|
2008-10-15 07:11:11 -07:00
|
|
|
tc->name = eina_stringshare_add(text_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!tc->name)
|
|
|
|
{
|
|
|
|
free(tc);
|
|
|
|
return;
|
|
|
|
}
|
2008-12-17 00:04:42 -08:00
|
|
|
if (!_edje_text_class_hash) _edje_text_class_hash = eina_hash_string_superfast_new(NULL);
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_add(_edje_text_class_hash, text_class, tc);
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2008-10-15 07:11:11 -07:00
|
|
|
tc->font = eina_stringshare_add(font);
|
2003-11-03 22:15:19 -08:00
|
|
|
tc->size = size;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* If the class found is the same just return */
|
2005-12-05 02:08:30 -08:00
|
|
|
if ((tc->size == size) && (tc->font) && (!strcmp(tc->font, font)))
|
2003-11-03 22:15:19 -08:00
|
|
|
return;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Update the class found */
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(tc->font);
|
|
|
|
tc->font = eina_stringshare_add(font);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!tc->font)
|
|
|
|
{
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_text_class_hash, text_class, tc);
|
2003-11-03 22:15:19 -08:00
|
|
|
free(tc);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
tc->size = size;
|
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Tell all members of the text class to recalc */
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_text_class_member_hash, text_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
while (members)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
ed = eina_list_data_get(members);
|
2003-11-03 22:15:19 -08:00
|
|
|
ed->dirty = 1;
|
2006-03-27 23:45:54 -08:00
|
|
|
_edje_textblock_style_all_update(ed);
|
2003-11-03 22:15:19 -08:00
|
|
|
_edje_recalc(ed);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
/**
|
|
|
|
* @param text_class
|
|
|
|
*
|
|
|
|
* Deletes any values at the process level for the specified text class.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
edje_text_class_del(const char *text_class)
|
|
|
|
{
|
|
|
|
Edje_Text_Class *tc;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
|
|
|
if (!text_class) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
tc = eina_hash_find(_edje_text_class_hash, text_class);
|
2006-12-24 02:29:16 -08:00
|
|
|
if (!tc) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_text_class_hash, text_class, tc);
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(tc->name);
|
|
|
|
eina_stringshare_del(tc->font);
|
2006-12-24 02:29:16 -08:00
|
|
|
free(tc);
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_text_class_member_hash, text_class);
|
2006-12-24 02:29:16 -08:00
|
|
|
while (members)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
ed = eina_list_data_get(members);
|
2006-12-24 02:29:16 -08:00
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_textblock_style_all_update(ed);
|
|
|
|
_edje_recalc(ed);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lists all text classes known about by the current process.
|
|
|
|
*
|
|
|
|
* @return A list of text class names (strings). These strings are stringshares and
|
|
|
|
* the list must be free()'d by the caller.
|
|
|
|
*/
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *
|
2006-12-24 02:29:16 -08:00
|
|
|
edje_text_class_list(void)
|
|
|
|
{
|
2007-03-01 14:39:01 -08:00
|
|
|
Edje_List_Foreach_Data fdata;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-03-01 14:39:01 -08:00
|
|
|
memset(&fdata, 0, sizeof(Edje_List_Foreach_Data));
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_text_class_member_hash,
|
2008-02-15 11:30:12 -08:00
|
|
|
_edje_text_class_list_foreach, &fdata);
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2007-03-01 14:39:01 -08:00
|
|
|
return fdata.list;
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_edje_text_class_list_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
2006-12-24 02:29:16 -08:00
|
|
|
{
|
|
|
|
Edje_List_Foreach_Data *fd;
|
|
|
|
|
|
|
|
fd = fdata;
|
2008-10-22 04:34:42 -07:00
|
|
|
fd->list = eina_list_append(fd->list, eina_stringshare_add(key));
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Sets Edje text class
|
2005-09-20 20:11:31 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param text_class The text class name
|
|
|
|
* @param font Font name
|
|
|
|
* @param size Font Size
|
|
|
|
*
|
|
|
|
* Sets the text class for the Edje.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:54 -07:00
|
|
|
edje_object_text_class_set(Evas_Object *obj, const char *text_class, const char *font, Evas_Font_Size size)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2003-10-29 20:45:18 -08:00
|
|
|
Edje_Text_Class *tc;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!text_class)) return;
|
2006-03-27 23:45:54 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* for each text_class in the edje */
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_classes, l, tc)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2005-12-05 02:08:30 -08:00
|
|
|
if ((tc->name) && (!strcmp(tc->name, text_class)))
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Match and the same, return */
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((tc->font) && (font) && (!strcmp(tc->font, font)) &&
|
2003-07-12 19:06:46 -07:00
|
|
|
(tc->size == size))
|
|
|
|
return;
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* No font but size is the same, return */
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!tc->font) && (!font) && (tc->size == size)) return;
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* Update new text class properties */
|
2008-10-15 07:11:11 -07:00
|
|
|
if (tc->font) eina_stringshare_del(tc->font);
|
|
|
|
if (font) tc->font = eina_stringshare_add(font);
|
2003-07-12 19:06:46 -07:00
|
|
|
else tc->font = NULL;
|
|
|
|
tc->size = size;
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* Update edje */
|
2003-07-12 19:06:46 -07:00
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* No matches, create a new text class */
|
|
|
|
tc = calloc(1, sizeof(Edje_Text_Class));
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!tc) return;
|
2008-10-15 07:11:11 -07:00
|
|
|
tc->name = eina_stringshare_add(text_class);
|
2003-07-12 19:06:46 -07:00
|
|
|
if (!tc->name)
|
|
|
|
{
|
|
|
|
free(tc);
|
|
|
|
return;
|
|
|
|
}
|
2008-10-15 07:11:11 -07:00
|
|
|
if (font) tc->font = eina_stringshare_add(font);
|
2003-07-12 19:06:46 -07:00
|
|
|
else tc->font = NULL;
|
|
|
|
tc->size = size;
|
2006-03-18 20:22:35 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_text_class_set(rp->swallowed_object, text_class, font, size);
|
|
|
|
}
|
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Add to edje's text class list */
|
2008-10-22 04:34:42 -07:00
|
|
|
ed->text_classes = eina_list_append(ed->text_classes, tc);
|
2003-07-12 19:06:46 -07:00
|
|
|
ed->dirty = 1;
|
2006-12-24 02:29:16 -08:00
|
|
|
_edje_textblock_style_all_update(ed);
|
2003-07-12 19:06:46 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Check if Edje part exists
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name to check
|
|
|
|
* @return 0 on Error\n
|
|
|
|
* 1 if Edje part exists
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_exists(const Evas_Object *obj, const char *part)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-12 23:19:09 -07:00
|
|
|
if ((!ed) || (!part)) return 0;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-12 23:19:09 -07:00
|
|
|
if (!rp) return 0;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-08-19 11:22:01 -07:00
|
|
|
/**
|
|
|
|
* Gets the Evas_Object corresponding to a given part.
|
|
|
|
* You should never modify the state of the returned object
|
|
|
|
* (with evas_object_move() or evas_object_hide() for example),
|
2007-04-14 21:24:07 -07:00
|
|
|
* but you can safely query info about its current state
|
2006-08-19 11:22:01 -07:00
|
|
|
* (with evas_object_visible_get() or evas_object_color_get() for example)
|
|
|
|
*
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The Edje part
|
|
|
|
* @return Returns the Evas_Object corresponding to the given part,
|
|
|
|
* or NULL on failure (if the part doesn't exist)
|
|
|
|
**/
|
2008-08-14 11:21:27 -07:00
|
|
|
EAPI const Evas_Object *
|
|
|
|
edje_object_part_object_get(const Evas_Object *obj, const char *part)
|
2006-08-19 11:22:01 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2006-08-19 11:22:01 -07:00
|
|
|
if ((!ed) || (!part)) return NULL;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2006-08-19 11:22:01 -07:00
|
|
|
if (!rp) return NULL;
|
|
|
|
return rp->object;
|
|
|
|
}
|
|
|
|
|
2007-04-14 21:24:07 -07:00
|
|
|
/** Get the geometry of an Edje part
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The Edje part
|
|
|
|
* @param x The x coordinate pointer
|
|
|
|
* @param y The y coordinate pointer
|
|
|
|
* @param w The width pointer
|
|
|
|
* @param h The height pointer
|
|
|
|
*
|
2007-04-14 21:24:07 -07:00
|
|
|
* Gets the geometry of an Edje part
|
|
|
|
*
|
|
|
|
* It is valid to pass NULL as any of @a x, @a y, @a w or @a h, whose
|
|
|
|
* values you are uninterested in.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h )
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-12 23:19:09 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: New Function */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2004-06-03 02:14:55 -07:00
|
|
|
edje_object_text_change_cb_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, const char *part), void *data)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2007-05-26 22:28:07 -07:00
|
|
|
int i;
|
2004-06-03 02:14:55 -07:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2004-06-03 02:14:55 -07:00
|
|
|
if (!ed) return;
|
|
|
|
ed->text_change.func = func;
|
|
|
|
ed->text_change.data = data;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
edje_object_text_change_cb_set(rp->swallowed_object, func, data);
|
|
|
|
}
|
2004-06-03 02:14:55 -07:00
|
|
|
}
|
|
|
|
|
2009-04-14 16:53:25 -07:00
|
|
|
static void
|
|
|
|
_edje_object_part_text_raw_set(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
if ((!rp->text.text) && (!text))
|
|
|
|
return;
|
2006-12-24 02:29:16 -08:00
|
|
|
if ((rp->text.text) && (text) &&
|
2003-07-12 23:19:09 -07:00
|
|
|
(!strcmp(rp->text.text, text)))
|
|
|
|
return;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (rp->text.text)
|
|
|
|
{
|
2008-10-15 07:11:11 -07:00
|
|
|
eina_stringshare_del(rp->text.text);
|
2008-10-15 02:58:25 -07:00
|
|
|
rp->text.text = NULL;
|
|
|
|
}
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
2008-10-16 02:17:44 -07:00
|
|
|
_edje_entry_text_markup_set(rp, text);
|
2008-10-15 02:58:25 -07:00
|
|
|
else
|
2008-10-15 07:11:11 -07:00
|
|
|
if (text) rp->text.text = eina_stringshare_add(text);
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
2008-03-24 01:22:01 -07:00
|
|
|
if (rp->edje->text_change.func)
|
2008-02-15 11:30:12 -08:00
|
|
|
rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
|
2009-04-14 16:53:25 -07:00
|
|
|
/** Sets the text for an object part
|
|
|
|
* @param obj A valid Evas Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param text The text string
|
|
|
|
*/
|
|
|
|
EAPI 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_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
|
|
|
|
_edje_object_part_text_raw_set(obj, rp, part, text);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Returns the text of the object part
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @return The text string
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI const char *
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_text_get(const Evas_Object *obj, const char *part)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-12 23:19:09 -07:00
|
|
|
if ((!ed) || (!part)) return NULL;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-12 23:19:09 -07:00
|
|
|
if (!rp) return NULL;
|
2008-10-15 02:58:25 -07:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
2008-11-16 21:54:01 -08:00
|
|
|
return _edje_entry_text_get(rp);
|
2008-10-15 02:58:25 -07:00
|
|
|
else
|
|
|
|
{
|
2008-10-16 02:17:44 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT) return rp->text.text;
|
2009-04-14 16:53:25 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
return evas_object_textblock_text_markup_get(rp->object);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
static Eina_Bool
|
|
|
|
_edje_strbuf_append(char **p_str, size_t *allocated, size_t *used, const char *news, size_t news_len)
|
|
|
|
{
|
|
|
|
if (*used + news_len >= *allocated)
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
size_t to_allocate = ((((*used + news_len) >> 4) + 1) << 4);
|
|
|
|
|
|
|
|
tmp = realloc(*p_str, to_allocate);
|
|
|
|
if (!tmp)
|
|
|
|
{
|
|
|
|
free(*p_str);
|
|
|
|
*p_str = NULL;
|
|
|
|
*allocated = 0;
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_FALSE;
|
2009-04-14 16:53:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*p_str = tmp;
|
|
|
|
*allocated = to_allocate;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(*p_str + *used, news, news_len);
|
|
|
|
*used = *used + news_len;
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2009-04-14 16:53:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_edje_text_escape(const char *text)
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
const char *text_end;
|
|
|
|
size_t text_len, ret_len, used;
|
|
|
|
|
|
|
|
if (!text) return NULL;
|
|
|
|
|
|
|
|
text_len = strlen(text);
|
|
|
|
ret_len = (((text_len >> 4) + 1) << 4); /* rough guess */
|
|
|
|
ret = malloc(ret_len);
|
|
|
|
if (!ret) return NULL;
|
|
|
|
|
|
|
|
text_end = text + text_len;
|
|
|
|
used = 0;
|
|
|
|
while (text < text_end)
|
|
|
|
{
|
|
|
|
int advance, escaped_len;
|
|
|
|
const char *escaped = evas_textblock_string_escape_get(text, &advance);
|
|
|
|
if (!escaped)
|
|
|
|
{
|
|
|
|
escaped = text;
|
|
|
|
escaped_len = 1;
|
|
|
|
advance = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
escaped_len = strlen(escaped);
|
|
|
|
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, escaped, escaped_len))
|
|
|
|
return NULL;
|
|
|
|
text += advance;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, "", 1))
|
|
|
|
return NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_edje_text_unescape(const char *text)
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
const char *text_end, *last, *escape_start;
|
|
|
|
size_t text_len, ret_len, used;
|
|
|
|
|
|
|
|
if (!text) return NULL;
|
|
|
|
|
|
|
|
text_len = strlen(text);
|
|
|
|
ret_len = text_len;
|
|
|
|
ret = malloc(ret_len);
|
|
|
|
if (!ret) return NULL;
|
|
|
|
|
|
|
|
text_end = text + text_len;
|
|
|
|
used = 0;
|
|
|
|
last = text;
|
|
|
|
escape_start = NULL;
|
|
|
|
for (; text < text_end; text++)
|
|
|
|
{
|
|
|
|
if (*text == '&')
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
const char *str;
|
|
|
|
if (last)
|
|
|
|
{
|
|
|
|
len = text - last;
|
|
|
|
str = last;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = text - escape_start;
|
|
|
|
str = escape_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len > 0)
|
|
|
|
{
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, str, len))
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
escape_start = text;
|
|
|
|
last = NULL;
|
|
|
|
}
|
|
|
|
else if ((*text == ';') && (escape_start))
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
const char *str = evas_textblock_escape_string_range_get
|
|
|
|
(escape_start, text);
|
|
|
|
if (str)
|
|
|
|
len = strlen(str);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = escape_start;
|
|
|
|
len = text + 1 - escape_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, str, len))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
escape_start = NULL;
|
|
|
|
last = text + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!last && escape_start)
|
|
|
|
last = escape_start;
|
|
|
|
|
|
|
|
if (last && (text > last))
|
|
|
|
{
|
|
|
|
size_t len = text - last;
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, last, len))
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_edje_strbuf_append(&ret, &ret_len, &used, "", 1))
|
|
|
|
return NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Sets the raw (non escaped) text for an object part.
|
|
|
|
*
|
|
|
|
* This will do escape for you if it is a TEXTBLOCK part, that is, if
|
|
|
|
* text contain tags, these tags will not be interpreted/parsed by
|
|
|
|
* TEXTBLOCK.
|
|
|
|
*
|
|
|
|
* @param obj A valid Evas Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param text The text string
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT)
|
|
|
|
_edje_object_part_text_raw_set(obj, rp, part, text_to_escape);
|
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
char *text = _edje_text_escape(text_to_escape);
|
|
|
|
_edje_object_part_text_raw_set(obj, rp, part, text);
|
|
|
|
free(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Returns the text of the object part, without escaping.
|
|
|
|
*
|
|
|
|
* Counterpart of edje_object_part_text_unescaped_set(). Please notice
|
|
|
|
* that the result is newly allocated memory and should be released
|
|
|
|
* with free() when done.
|
|
|
|
*
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @return The @b allocated text string without escaping, or NULL on problems.
|
|
|
|
*/
|
|
|
|
EAPI char *
|
|
|
|
edje_object_part_text_unescaped_get(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return NULL;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
const char *t = _edje_entry_text_get(rp);
|
|
|
|
return _edje_text_unescape(t);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT) return strdup(rp->text.text);
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
const char *t = evas_object_textblock_text_markup_get(rp->object);
|
|
|
|
return _edje_text_unescape(t);
|
|
|
|
}
|
2008-10-15 02:58:25 -07:00
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-04-14 16:53:25 -07:00
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
/** Returns the selection text of the object part
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @return The text string
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
edje_object_part_text_selection_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_selection_get(rp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-11-18 00:45:27 -08:00
|
|
|
/** sets the selection to be none
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_select_none(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_select_none(rp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** sets the selection to be everything
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_select_all(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_select_all(rp);
|
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
/** Inserts the text for an object part just before the cursor position
|
|
|
|
* @param obj A valid Evas Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param text The text string
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_insert(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_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return;
|
|
|
|
if (rp->part->entry_mode <= EDJE_ENTRY_EDIT_MODE_NONE) return;
|
|
|
|
_edje_entry_text_markup_insert(rp, text);
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
if (rp->edje->text_change.func)
|
|
|
|
rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
/** Returns a list of char * anchor names
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
2008-12-05 19:08:17 -08:00
|
|
|
* @return The list of anchors (const char *), do not modify!
|
2008-10-16 23:40:46 -07:00
|
|
|
*/
|
2008-12-05 19:08:17 -08:00
|
|
|
EAPI const Eina_List *
|
2008-10-16 23:40:46 -07:00
|
|
|
edje_object_part_text_anchor_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_anchors_list(rp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-23 17:44:26 -07:00
|
|
|
/** Returns a list of Evas_Textblock_Rectangle * anchor rectangles
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param anchor The anchor name
|
2008-12-05 19:08:17 -08:00
|
|
|
* @return The list of anchor rects (const Evas_Textblock_Rectangle *), do not modify!
|
2008-10-23 17:44:26 -07:00
|
|
|
*/
|
2008-12-05 19:08:17 -08:00
|
|
|
EAPI const Eina_List *
|
2008-10-23 17:44:26 -07:00
|
|
|
edje_object_part_text_anchor_geometry_get(const Evas_Object *obj, const char *part, const char *anchor)
|
|
|
|
{
|
|
|
|
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_anchor_geometry_get(rp, anchor);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
/** Returns the cursor geometry of the part relative to the edje object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param x Cursor X position
|
|
|
|
* @param y Cursor Y position
|
|
|
|
* @param w Cursor width
|
|
|
|
* @param h Cursor height
|
|
|
|
*/
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
_edje_entry_cursor_geometry_get(rp, x, y, w, h);
|
|
|
|
if (x) *x -= rp->edje->x;
|
|
|
|
if (y) *y -= rp->edje->y;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-20 08:07:39 -07:00
|
|
|
/** Enables selection if the entyr is an EXPLICIT selection mode type
|
2009-03-19 06:36:10 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
*/
|
|
|
|
EAPI void
|
2009-06-17 04:10:32 -07:00
|
|
|
edje_object_part_text_select_allow_set(const Evas_Object *obj, const char *part, Eina_Bool allow)
|
2009-03-19 06:36:10 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_select_allow_set(rp, allow);
|
|
|
|
}
|
|
|
|
|
2009-03-20 08:07:39 -07:00
|
|
|
/** Aborts any selection action on a part
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_select_abort(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_select_abort(rp);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Swallows an object into the edje
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param obj_swallow The object to swallow
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Swallows the object into the edje part so that all geometry changes
|
|
|
|
* for the part affect the swallowed object. (e.g. resize, move, show,
|
|
|
|
* raise/lower, etc.).
|
2007-04-14 21:24:07 -07:00
|
|
|
*
|
|
|
|
* If an object has already been swallowed into this part, then it will
|
|
|
|
* first be unswallowed before the new object is swallowed.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-12 23:19:09 -07:00
|
|
|
edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_swallow)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-12 23:19:09 -07:00
|
|
|
if ((!ed) || (!part)) return;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
2009-01-21 14:38:52 -08:00
|
|
|
// XXX: I guess this is not required, removing for testing purposes
|
|
|
|
// XXX: uncomment if you see glitches in e17 or others.
|
|
|
|
// XXX: by Gustavo, January 21th 2009.
|
2009-01-21 15:30:50 -08:00
|
|
|
// XXX: I got a backtrace with over 30000 calls without this,
|
|
|
|
// XXX: only with 32px shelves. The problem is probably somewhere else,
|
|
|
|
// XXX: but until it's found, leave this here.
|
|
|
|
// XXX: by Sachiel, January 21th 2009, 19:30 UTC
|
|
|
|
_edje_recalc_do(ed);
|
2008-11-14 03:06:15 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-12 23:19:09 -07:00
|
|
|
if (!rp) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return;
|
|
|
|
_edje_real_part_swallow(rp, obj_swallow);
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
|
2007-04-04 05:46:44 -07:00
|
|
|
static void
|
|
|
|
_recalc_extern_parent(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *parent;
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
parent = evas_object_smart_parent_get(obj);
|
|
|
|
ed = _edje_fetch(parent);
|
|
|
|
|
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set the object minimum size
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param minw The minimum width
|
|
|
|
* @param minh The minimum height
|
|
|
|
*
|
|
|
|
* This sets the minimum size restriction for the object.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:54 -07:00
|
|
|
edje_extern_object_min_size_set(Evas_Object *obj, Evas_Coord minw, Evas_Coord minh)
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
2007-04-04 05:46:44 -07:00
|
|
|
Edje_Real_Part *rp;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-10-04 20:37:37 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2007-04-04 05:46:44 -07:00
|
|
|
rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
|
|
|
|
if (rp)
|
|
|
|
{
|
2008-10-04 20:37:37 -07:00
|
|
|
rp->swallow_params.min.w = minw;
|
|
|
|
rp->swallow_params.min.h = minh;
|
2007-04-04 05:46:44 -07:00
|
|
|
|
|
|
|
_recalc_extern_parent(obj);
|
|
|
|
}
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set the object maximum size
|
2005-09-20 20:11:31 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param maxw The maximum width
|
|
|
|
* @param maxh The maximum height
|
|
|
|
*
|
|
|
|
* This sets the maximum size restriction for the object.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:54 -07:00
|
|
|
edje_extern_object_max_size_set(Evas_Object *obj, Evas_Coord maxw, Evas_Coord maxh)
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
2007-04-04 05:46:44 -07:00
|
|
|
Edje_Real_Part *rp;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-10-04 20:37:37 -07:00
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
2007-04-04 05:46:44 -07:00
|
|
|
rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
|
|
|
|
if (rp)
|
|
|
|
{
|
2008-10-04 20:37:37 -07:00
|
|
|
rp->swallow_params.max.w = maxw;
|
|
|
|
rp->swallow_params.max.h = maxh;
|
2007-04-04 05:46:44 -07:00
|
|
|
|
|
|
|
_recalc_extern_parent(obj);
|
|
|
|
}
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
|
|
|
|
2006-07-23 06:50:02 -07:00
|
|
|
/** Set the object aspect size
|
|
|
|
* @param obj A valid Evas_Object handle
|
2006-07-23 12:33:27 -07:00
|
|
|
* @param aspect The aspect control axes
|
2006-07-23 06:50:02 -07:00
|
|
|
* @param aw The aspect radio width
|
|
|
|
* @param ah The aspect ratio height
|
|
|
|
*
|
|
|
|
* This sets the desired aspect ratio to keep an object that will be swallowed
|
|
|
|
* by Edje. The width and height define a preferred size ASPECT and the
|
|
|
|
* object may be scaled to be larger or smaller, but retaining the relative
|
2007-04-14 21:24:07 -07:00
|
|
|
* scale of both aspect width and height.
|
2006-07-23 06:50:02 -07:00
|
|
|
*/
|
|
|
|
EAPI void
|
2006-07-23 12:33:27 -07:00
|
|
|
edje_extern_object_aspect_set(Evas_Object *obj, Edje_Aspect_Control aspect, Evas_Coord aw, Evas_Coord ah)
|
2006-07-23 06:50:02 -07:00
|
|
|
{
|
2007-04-04 05:46:44 -07:00
|
|
|
Edje_Real_Part *rp;
|
2008-10-04 20:37:37 -07:00
|
|
|
Evas_Aspect_Control asp;
|
2006-07-23 12:33:27 -07:00
|
|
|
|
2008-10-04 20:37:37 -07:00
|
|
|
asp = EVAS_ASPECT_CONTROL_NONE;
|
|
|
|
switch (aspect)
|
|
|
|
{
|
|
|
|
case EDJE_ASPECT_CONTROL_NONE: asp = EVAS_ASPECT_CONTROL_NONE; break;
|
|
|
|
case EDJE_ASPECT_CONTROL_NEITHER: asp = EVAS_ASPECT_CONTROL_NEITHER; break;
|
|
|
|
case EDJE_ASPECT_CONTROL_HORIZONTAL: asp = EVAS_ASPECT_CONTROL_HORIZONTAL; break;
|
|
|
|
case EDJE_ASPECT_CONTROL_VERTICAL: asp = EVAS_ASPECT_CONTROL_VERTICAL; break;
|
|
|
|
case EDJE_ASPECT_CONTROL_BOTH: asp = EVAS_ASPECT_CONTROL_BOTH; break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
if (aw < 1) aw = 1;
|
|
|
|
if (ah < 1) ah = 1;
|
|
|
|
evas_object_size_hint_aspect_set(obj, asp, aw, ah);
|
2007-04-04 05:46:44 -07:00
|
|
|
rp = evas_object_data_get(obj, "\377 edje.swallowing_part");
|
|
|
|
if (rp)
|
|
|
|
{
|
2008-10-04 20:37:37 -07:00
|
|
|
rp->swallow_params.aspect.mode = aspect;
|
|
|
|
rp->swallow_params.aspect.w = aw;
|
|
|
|
rp->swallow_params.aspect.h = ah;
|
2007-04-04 05:46:44 -07:00
|
|
|
_recalc_extern_parent(obj);
|
|
|
|
}
|
2006-07-23 06:50:02 -07:00
|
|
|
}
|
|
|
|
|
2008-12-20 05:18:27 -08:00
|
|
|
struct edje_box_layout_builtin {
|
2008-11-23 21:15:15 -08:00
|
|
|
const char *name;
|
|
|
|
Evas_Object_Box_Layout cb;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Evas_Object_Box_Layout
|
|
|
|
_edje_box_layout_builtin_find(const char *name)
|
|
|
|
{
|
2008-12-20 05:18:27 -08:00
|
|
|
const struct edje_box_layout_builtin _edje_box_layout_builtin[] = {
|
|
|
|
{"horizontal", evas_object_box_layout_horizontal},
|
|
|
|
{"horizontal_flow", evas_object_box_layout_flow_horizontal},
|
|
|
|
{"horizontal_homogeneous", evas_object_box_layout_homogeneous_horizontal},
|
|
|
|
{"horizontal_max", evas_object_box_layout_homogeneous_max_size_horizontal},
|
|
|
|
{"stack", evas_object_box_layout_stack},
|
|
|
|
{"vertical", evas_object_box_layout_vertical},
|
|
|
|
{"vertical_flow", evas_object_box_layout_flow_vertical},
|
|
|
|
{"vertical_homogeneous", evas_object_box_layout_homogeneous_vertical},
|
|
|
|
{"vertical_max", evas_object_box_layout_homogeneous_max_size_vertical},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2008-11-23 21:15:15 -08:00
|
|
|
const struct edje_box_layout_builtin *base;
|
|
|
|
|
|
|
|
switch (name[0])
|
|
|
|
{
|
|
|
|
case 'h':
|
|
|
|
base = _edje_box_layout_builtin + 0;
|
|
|
|
break;
|
|
|
|
case 's':
|
|
|
|
base = _edje_box_layout_builtin + 4;
|
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
base = _edje_box_layout_builtin + 5;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; (base->name != NULL) && (base->name[0] == name[0]); base++)
|
|
|
|
if (strcmp(base->name, name) == 0)
|
|
|
|
return base->cb;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Rbtree_Direction
|
|
|
|
_edje_box_layout_external_node_cmp(const Eina_Rbtree *left, const Eina_Rbtree *right, __UNUSED__ void *data)
|
|
|
|
{
|
|
|
|
Edje_Box_Layout *l = (Edje_Box_Layout *)left;
|
|
|
|
Edje_Box_Layout *r = (Edje_Box_Layout *)right;
|
|
|
|
|
|
|
|
if (strcmp(l->name, r->name) < 0)
|
|
|
|
return EINA_RBTREE_LEFT;
|
|
|
|
else
|
|
|
|
return EINA_RBTREE_RIGHT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_edje_box_layout_external_find_cmp(const Eina_Rbtree *node, const void *key, __UNUSED__ int length, __UNUSED__ void *data)
|
|
|
|
{
|
|
|
|
Edje_Box_Layout *l = (Edje_Box_Layout *)node;
|
|
|
|
return strcmp(key, l->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Edje_Box_Layout *
|
|
|
|
_edje_box_layout_external_find(const char *name)
|
|
|
|
{
|
|
|
|
return (Edje_Box_Layout *)eina_rbtree_inline_lookup
|
|
|
|
(_edje_box_layout_registry, name, 0, _edje_box_layout_external_find_cmp,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_box_layout_find(const char *name, Evas_Object_Box_Layout *cb, void **data, void (**free_data)(void *data))
|
|
|
|
{
|
|
|
|
const Edje_Box_Layout *l;
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!name) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
*cb = _edje_box_layout_builtin_find(name);
|
|
|
|
if (*cb)
|
|
|
|
{
|
|
|
|
*free_data = NULL;
|
|
|
|
*data = NULL;
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
l = _edje_box_layout_external_find(name);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!l) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
*cb = l->func;
|
|
|
|
*free_data = l->layout_data_free;
|
|
|
|
if (l->layout_data_get)
|
|
|
|
*data = l->layout_data_get(l->data);
|
|
|
|
else
|
|
|
|
*data = NULL;
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_box_layout_external_free(Eina_Rbtree *node, __UNUSED__ void *data)
|
|
|
|
{
|
|
|
|
Edje_Box_Layout *l = (Edje_Box_Layout *)node;
|
|
|
|
|
|
|
|
if (l->data && l->free_data)
|
|
|
|
l->free_data(l->data);
|
|
|
|
free(l);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Edje_Box_Layout *
|
|
|
|
_edje_box_layout_external_new(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data)
|
|
|
|
{
|
|
|
|
Edje_Box_Layout *l;
|
|
|
|
int name_len;
|
|
|
|
|
|
|
|
name_len = strlen(name) + 1;
|
|
|
|
l = malloc(sizeof(Edje_Box_Layout) + name_len);
|
|
|
|
if (!l)
|
|
|
|
{
|
|
|
|
perror("malloc");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
l->func = func;
|
|
|
|
l->layout_data_get = layout_data_get;
|
|
|
|
l->layout_data_free = layout_data_free;
|
|
|
|
l->free_data = free_data;
|
|
|
|
l->data = data;
|
|
|
|
|
|
|
|
memcpy(l->name, name, name_len);
|
|
|
|
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Registers a custom layout to be used in edje boxes
|
|
|
|
* @param name The name of the layout
|
|
|
|
* @param func The function defining the layout
|
|
|
|
* @param layout_data_get This function gets the custom data pointer for func
|
|
|
|
* @param layout_data_free Passed to func to free its private data when needed
|
|
|
|
* @param free_data Frees data
|
|
|
|
* @param data Private pointer passed to layout_data_get
|
|
|
|
*
|
|
|
|
* This function registers custom layouts that can be referred from themes
|
|
|
|
* by the registered name.
|
|
|
|
* The Evas_Object_Box_Layout functions receive two pointers for internal
|
|
|
|
* use, one being private data, and the other the function to free that
|
|
|
|
* data when it's not longer needed. From Edje, this private data will be
|
|
|
|
* retrieved by calling layout_data_get, and layout_data_free will be the
|
|
|
|
* free function passed to func. layout_data_get will be called with data
|
|
|
|
* as its parameter, and this one will be freed by free_data whenever the
|
|
|
|
* layout is unregistered from Edje.
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*layout_data_get)(void *), void (*layout_data_free)(void *), void (*free_data)(void *), void *data)
|
|
|
|
{
|
|
|
|
Edje_Box_Layout *l;
|
|
|
|
|
|
|
|
if (!name) return;
|
|
|
|
|
|
|
|
if (_edje_box_layout_builtin_find(name))
|
|
|
|
{
|
|
|
|
fprintf(stderr,
|
|
|
|
"ERROR: cannot register layout '%s': would override builtin!\n",
|
|
|
|
name);
|
|
|
|
|
|
|
|
if (data && free_data) free_data(data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = _edje_box_layout_external_find(name);
|
|
|
|
if (!l)
|
|
|
|
{
|
|
|
|
if (!func)
|
|
|
|
{
|
|
|
|
if (data && free_data) free_data(data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = _edje_box_layout_external_new
|
|
|
|
(name, func, layout_data_get, layout_data_free, free_data, data);
|
|
|
|
if (!l)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_edje_box_layout_registry = eina_rbtree_inline_insert
|
|
|
|
(_edje_box_layout_registry, (Eina_Rbtree *)l,
|
|
|
|
_edje_box_layout_external_node_cmp, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
if (l->data && l->free_data) l->free_data(l->data);
|
|
|
|
|
|
|
|
l->func = func;
|
|
|
|
l->layout_data_get = layout_data_get;
|
|
|
|
l->layout_data_free = layout_data_free;
|
|
|
|
l->free_data = free_data;
|
|
|
|
l->data = data;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (data && free_data) free_data(data);
|
|
|
|
|
|
|
|
_edje_box_layout_registry = eina_rbtree_inline_remove
|
|
|
|
(_edje_box_layout_registry, (Eina_Rbtree *)l,
|
|
|
|
_edje_box_layout_external_node_cmp, NULL);
|
|
|
|
_edje_box_layout_external_free((Eina_Rbtree *)l, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Unswallow an object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param obj_swallow The swallowed object
|
|
|
|
*
|
|
|
|
* Causes the edje to regurgitate a previously swallowed object. :)
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-12 23:19:09 -07:00
|
|
|
edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
|
|
|
|
{
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_Real_Part *rp;
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
if (!obj_swallow) return;
|
|
|
|
|
|
|
|
rp = (Edje_Real_Part *)evas_object_data_get(obj_swallow, "\377 edje.swallowing_part");
|
|
|
|
if (rp && rp->swallowed_object == obj_swallow)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
2007-05-26 22:28:07 -07:00
|
|
|
evas_object_smart_member_del(rp->swallowed_object);
|
|
|
|
evas_object_event_callback_del(rp->swallowed_object,
|
2008-02-15 11:30:12 -08:00
|
|
|
EVAS_CALLBACK_FREE,
|
|
|
|
_edje_object_part_swallow_free_cb);
|
2007-05-26 22:28:07 -07:00
|
|
|
evas_object_clip_unset(rp->swallowed_object);
|
|
|
|
evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
|
|
|
|
|
|
|
|
if (rp->part->mouse_events)
|
|
|
|
_edje_callbacks_del(rp->swallowed_object);
|
|
|
|
|
|
|
|
rp->swallowed_object = NULL;
|
|
|
|
rp->swallow_params.min.w = 0;
|
|
|
|
rp->swallow_params.min.h = 0;
|
|
|
|
rp->swallow_params.max.w = 0;
|
|
|
|
rp->swallow_params.max.h = 0;
|
|
|
|
rp->edje->dirty = 1;
|
2008-11-14 03:06:15 -08:00
|
|
|
_edje_recalc_do(rp->edje);
|
2007-05-26 22:28:07 -07:00
|
|
|
return;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-14 21:24:07 -07:00
|
|
|
/** Get the object currently swallowed by a part
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
2007-04-14 21:24:07 -07:00
|
|
|
* @return The swallowed object, or NULL if there is none.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI Evas_Object *
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_swallow_get(const Evas_Object *obj, const char *part)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-12 23:19:09 -07:00
|
|
|
if ((!ed) || (!part)) return NULL;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-12 23:19:09 -07:00
|
|
|
if (!rp) return NULL;
|
|
|
|
return rp->swallowed_object;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Get the minimum size for an object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param minw Minimum width pointer
|
|
|
|
* @param minh Minimum height pointer
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Gets the object's minimum size values from the Edje. These are set
|
|
|
|
* to zero if no Edje is connected to the Evas Object.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_size_min_get(const Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-27 06:16:51 -07:00
|
|
|
if ((!ed) || (!ed->collection))
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
|
|
|
if (minw) *minw = 0;
|
|
|
|
if (minh) *minh = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (minw) *minw = ed->collection->prop.min.w;
|
|
|
|
if (minh) *minh = ed->collection->prop.min.h;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Get the maximum size for an object
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param maxw Maximum width pointer
|
|
|
|
* @param maxh Maximum height pointer
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Gets the object's maximum size values from the Edje. These are set
|
|
|
|
* to zero if no Edje is connected to the Evas Object.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-27 06:16:51 -07:00
|
|
|
if ((!ed) || (!ed->collection))
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
|
|
|
if (maxw) *maxw = 0;
|
|
|
|
if (maxh) *maxh = 0;
|
|
|
|
return;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
if (ed->collection->prop.max.w == 0)
|
|
|
|
{
|
2007-10-19 12:31:42 -07:00
|
|
|
/* XXX TODO: convert maxw to 0, fix things that break. */
|
|
|
|
if (maxw) *maxw = EDJE_INF_MAX_W;
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (maxw) *maxw = ed->collection->prop.max.w;
|
|
|
|
}
|
|
|
|
if (ed->collection->prop.max.h == 0)
|
|
|
|
{
|
2007-10-19 12:31:42 -07:00
|
|
|
/* XXX TODO: convert maxh to 0, fix things that break. */
|
|
|
|
if (maxh) *maxh = EDJE_INF_MAX_H;
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (maxh) *maxh = ed->collection->prop.max.h;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-20 20:11:31 -07:00
|
|
|
/** Force a Size/Geometry calculation
|
2004-11-28 06:52:01 -08:00
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Forces the object @p obj to recalculation layout regardless of
|
|
|
|
* freeze/thaw.
|
2004-11-28 06:52:01 -08:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2004-11-28 06:52:01 -08:00
|
|
|
edje_object_calc_force(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2008-09-09 23:39:57 -07:00
|
|
|
int pf, pf2;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2004-11-28 06:52:01 -08:00
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return;
|
|
|
|
ed->dirty = 1;
|
2008-09-09 23:39:57 -07:00
|
|
|
|
|
|
|
pf2 = _edje_freeze_val;
|
2004-11-28 06:52:01 -08:00
|
|
|
pf = ed->freeze;
|
2008-09-09 23:39:57 -07:00
|
|
|
|
|
|
|
_edje_freeze_val = 0;
|
2004-11-28 06:52:01 -08:00
|
|
|
ed->freeze = 0;
|
2008-09-09 23:39:57 -07:00
|
|
|
|
2008-11-14 03:06:15 -08:00
|
|
|
_edje_recalc_do(ed);
|
2008-09-09 23:39:57 -07:00
|
|
|
|
2004-11-28 06:52:01 -08:00
|
|
|
ed->freeze = pf;
|
2008-09-09 23:39:57 -07:00
|
|
|
_edje_freeze_val = pf2;
|
2004-11-28 06:52:01 -08:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Calculate minimum size
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param minw Minimum width pointer
|
|
|
|
* @param minh Minimum height pointer
|
|
|
|
*
|
|
|
|
* Calculates the object's minimum size ?!
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-10-17 20:34:54 -07:00
|
|
|
edje_object_size_min_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh)
|
2008-04-17 03:22:57 -07:00
|
|
|
{
|
|
|
|
edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Calculate minimum size
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param minw Minimum width pointer
|
|
|
|
* @param minh Minimum height pointer
|
|
|
|
* @param restrictedw Do not allow object min width calc to be less than this
|
|
|
|
* @param restrictedh Do not allow object min height calc to be less than this
|
|
|
|
*
|
|
|
|
* Calculates the object's minimum size ?!
|
|
|
|
*/
|
|
|
|
EAPI void
|
|
|
|
edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2006-12-24 02:29:16 -08:00
|
|
|
Evas_Coord pw, ph;
|
2003-07-15 01:26:06 -07:00
|
|
|
int maxw, maxh;
|
|
|
|
int ok;
|
2005-09-18 23:51:49 -07:00
|
|
|
int reset_maxwh;
|
|
|
|
Edje_Real_Part *pep = NULL;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-27 06:16:51 -07:00
|
|
|
if ((!ed) || (!ed->collection))
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
2008-04-17 03:22:57 -07:00
|
|
|
if (minw) *minw = restrictedw;
|
|
|
|
if (minh) *minh = restrictedh;
|
2003-07-20 05:37:49 -07:00
|
|
|
return;
|
|
|
|
}
|
2005-09-18 23:51:49 -07:00
|
|
|
reset_maxwh = 1;
|
2003-07-15 01:26:06 -07:00
|
|
|
ed->calc_only = 1;
|
|
|
|
pw = ed->w;
|
|
|
|
ph = ed->h;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2005-09-18 23:51:49 -07:00
|
|
|
again:
|
2008-04-17 03:22:57 -07:00
|
|
|
ed->w = restrictedw;
|
|
|
|
ed->h = restrictedh;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
maxw = 0;
|
|
|
|
maxh = 0;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
ok = 1;
|
|
|
|
while (ok)
|
|
|
|
{
|
2007-05-26 16:57:21 -07:00
|
|
|
int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
ok = 0;
|
|
|
|
ed->dirty = 1;
|
2008-11-14 03:06:15 -08:00
|
|
|
_edje_recalc_do(ed);
|
2005-09-18 23:51:49 -07:00
|
|
|
if (reset_maxwh)
|
|
|
|
{
|
|
|
|
maxw = 0;
|
|
|
|
maxh = 0;
|
|
|
|
}
|
|
|
|
pep = NULL;
|
2007-05-26 16:57:21 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *ep;
|
|
|
|
int w, h;
|
2005-09-19 22:49:22 -07:00
|
|
|
int didw;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
ep = ed->table_parts[i];
|
2003-07-15 01:26:06 -07:00
|
|
|
w = ep->w - ep->req.w;
|
|
|
|
h = ep->h - ep->req.h;
|
2005-09-19 22:49:22 -07:00
|
|
|
didw = 0;
|
2005-09-18 23:51:49 -07:00
|
|
|
if (!((ep->chosen_description) &&
|
|
|
|
(ep->chosen_description->fixed.w)))
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
2005-09-18 23:51:49 -07:00
|
|
|
if (w > maxw)
|
|
|
|
{
|
|
|
|
maxw = w;
|
|
|
|
ok = 1;
|
|
|
|
pep = ep;
|
2005-09-19 22:49:22 -07:00
|
|
|
didw = 1;
|
2005-09-18 23:51:49 -07:00
|
|
|
}
|
2008-03-31 14:38:51 -07:00
|
|
|
if ((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
{
|
|
|
|
/* FIXME: do something */
|
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
2005-09-18 23:51:49 -07:00
|
|
|
if (!((ep->chosen_description) &&
|
|
|
|
(ep->chosen_description->fixed.h)))
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
2005-09-19 22:49:22 -07:00
|
|
|
if (!((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
|
|
|
(!ep->chosen_description->text.min_x) &&
|
|
|
|
(didw)))
|
2005-09-18 23:51:49 -07:00
|
|
|
{
|
2005-09-19 22:49:22 -07:00
|
|
|
if (h > maxh)
|
|
|
|
{
|
|
|
|
maxh = h;
|
|
|
|
ok = 1;
|
|
|
|
pep = ep;
|
|
|
|
}
|
2005-09-18 23:51:49 -07:00
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ok)
|
|
|
|
{
|
|
|
|
ed->w += maxw;
|
|
|
|
ed->h += maxh;
|
2008-04-17 03:22:57 -07:00
|
|
|
if (ed->w < restrictedw) ed->w = restrictedw;
|
|
|
|
if (ed->h < restrictedh) ed->h = restrictedh;
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
2006-10-08 23:01:13 -07:00
|
|
|
if ((ed->w > 4000) || (ed->h > 4000))
|
2005-09-18 23:51:49 -07:00
|
|
|
{
|
2006-08-30 06:23:57 -07:00
|
|
|
printf("EDJE ERROR: file %s, group %s has a non-fixed part. add fixed: 1 1; ???\n",
|
2008-08-14 11:04:43 -07:00
|
|
|
ed->path, ed->group);
|
2005-09-18 23:51:49 -07:00
|
|
|
if (pep)
|
2006-08-30 06:23:57 -07:00
|
|
|
printf(" Problem part is: %s\n", pep->part->name);
|
|
|
|
printf(" Will recalc min size not allowing broken parts to affect the result.\n");
|
2005-09-18 23:51:49 -07:00
|
|
|
if (reset_maxwh)
|
|
|
|
{
|
|
|
|
reset_maxwh = 0;
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
|
|
|
ed->min.w = ed->w;
|
|
|
|
ed->min.h = ed->h;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
if (minw) *minw = ed->min.w;
|
|
|
|
if (minh) *minh = ed->min.h;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-15 01:26:06 -07:00
|
|
|
ed->w = pw;
|
|
|
|
ed->h = ph;
|
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc(ed);
|
|
|
|
ed->calc_only = 0;
|
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2005-09-20 20:11:31 -07:00
|
|
|
/** Returns the state of the Edje part
|
2007-04-14 21:24:07 -07:00
|
|
|
* @param obj A valid Evas_Object handle
|
2004-06-05 21:42:17 -07:00
|
|
|
* @param part The part name
|
2006-12-24 02:29:16 -08:00
|
|
|
* @param val_ret
|
2004-06-05 21:42:17 -07:00
|
|
|
*
|
|
|
|
* @return The part state:\n
|
|
|
|
* "default" for the default state\n
|
|
|
|
* "" for other states
|
|
|
|
*/
|
|
|
|
/* FIXME: Correctly return other states */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI const char *
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val_ret)
|
2003-07-16 06:50:28 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-07-16 06:50:28 -07:00
|
|
|
if ((!ed) || (!part))
|
|
|
|
{
|
|
|
|
if (val_ret) *val_ret = 0;
|
|
|
|
return "";
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-07-16 06:50:28 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
if (val_ret) *val_ret = 0;
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
if (!rp->chosen_description)
|
|
|
|
{
|
|
|
|
if (val_ret) *val_ret = rp->chosen_description->state.value;
|
|
|
|
if (rp->chosen_description->state.name)
|
|
|
|
return rp->chosen_description->state.name;
|
|
|
|
return "default";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rp->param1.description)
|
|
|
|
{
|
|
|
|
if (val_ret) *val_ret = rp->param1.description->state.value;
|
|
|
|
if (rp->param1.description->state.name)
|
|
|
|
return rp->param1.description->state.name;
|
|
|
|
return "default";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (val_ret) *val_ret = 0;
|
|
|
|
return "";
|
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Determine dragable directions
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
*
|
|
|
|
* @return 0: Not dragable\n
|
|
|
|
* 1: Dragable in X direction\n
|
|
|
|
* 2: Dragable in Y direction\n
|
|
|
|
* 3: Dragable in X & Y directions
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI int
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE;
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return EDJE_DRAG_DIR_NONE;
|
2003-08-15 06:35:25 -07:00
|
|
|
if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY;
|
|
|
|
else if (rp->part->dragable.x) return EDJE_DRAG_DIR_X;
|
|
|
|
else if (rp->part->dragable.y) return EDJE_DRAG_DIR_Y;
|
|
|
|
return EDJE_DRAG_DIR_NONE;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set the dragable object location
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The x value
|
|
|
|
* @param dy The y value
|
|
|
|
*
|
|
|
|
* Places the dragable object at the given location.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-15 06:35:25 -07:00
|
|
|
edje_object_part_drag_value_set(Evas_Object *obj, const char *part, double dx, double dy)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2006-04-29 07:15:16 -07:00
|
|
|
if (rp->drag.down.count > 0) return;
|
2004-11-19 20:43:37 -08:00
|
|
|
if (rp->part->dragable.confine_id != -1)
|
|
|
|
{
|
2004-12-11 11:08:55 -08:00
|
|
|
dx = CLAMP(dx, 0.0, 1.0);
|
|
|
|
dy = CLAMP(dy, 0.0, 1.0);
|
2004-11-19 20:43:37 -08:00
|
|
|
}
|
2003-08-31 19:53:08 -07:00
|
|
|
if (rp->part->dragable.x < 0) dx = 1.0 - dx;
|
|
|
|
if (rp->part->dragable.y < 0) dy = 1.0 - dy;
|
|
|
|
if ((rp->drag.val.x == dx) && (rp->drag.val.y == dy)) return;
|
2003-08-15 06:35:25 -07:00
|
|
|
rp->drag.val.x = dx;
|
|
|
|
rp->drag.val.y = dy;
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, dx, dy);
|
|
|
|
_edje_emit(rp->edje, "drag,set", rp->part->name);
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2005-09-20 20:11:31 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Get the dragable object location
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The X value pointer
|
|
|
|
* @param dy The Y value pointer
|
|
|
|
*
|
|
|
|
* Gets the drag location values.
|
|
|
|
*/
|
|
|
|
/* FIXME: Should this be x and y instead of dx/dy? */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
2003-08-31 19:53:08 -07:00
|
|
|
double ddx, ddy;
|
2003-08-15 06:35:25 -07:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-08-15 06:35:25 -07:00
|
|
|
if ((!ed) || (!part))
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-08-15 06:35:25 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
2003-08-31 19:53:08 -07:00
|
|
|
ddx = rp->drag.val.x;
|
|
|
|
ddy = rp->drag.val.y;
|
|
|
|
if (rp->part->dragable.x < 0) ddx = 1.0 - ddx;
|
|
|
|
if (rp->part->dragable.y < 0) ddy = 1.0 - ddy;
|
|
|
|
if (dx) *dx = ddx;
|
|
|
|
if (dy) *dy = ddy;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Set the dragable object size
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dw The drag width
|
|
|
|
* @param dh The drag height
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Sets the size of the dragable object.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-15 06:35:25 -07:00
|
|
|
edje_object_part_drag_size_set(Evas_Object *obj, const char *part, double dw, double dh)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2003-08-15 06:35:25 -07:00
|
|
|
if (dw < 0.0) dw = 0.0;
|
|
|
|
else if (dw > 1.0) dw = 1.0;
|
|
|
|
if (dh < 0.0) dh = 0.0;
|
|
|
|
else if (dh > 1.0) dh = 1.0;
|
2003-08-31 19:53:08 -07:00
|
|
|
if ((rp->drag.size.x == dw) && (rp->drag.size.y == dh)) return;
|
2003-08-15 06:35:25 -07:00
|
|
|
rp->drag.size.x = dw;
|
|
|
|
rp->drag.size.y = dh;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Get the dragable object size
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dw The drag width pointer
|
|
|
|
* @param dh The drag height pointer
|
|
|
|
*
|
|
|
|
* Gets the dragable object size.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double *dw, double *dh)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-08-15 06:35:25 -07:00
|
|
|
if ((!ed) || (!part))
|
|
|
|
{
|
|
|
|
if (dw) *dw = 0;
|
|
|
|
if (dh) *dh = 0;
|
|
|
|
return;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-08-15 06:35:25 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
if (dw) *dw = 0;
|
|
|
|
if (dh) *dh = 0;
|
|
|
|
return;
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
2003-08-15 06:35:25 -07:00
|
|
|
if (dw) *dw = rp->drag.size.x;
|
|
|
|
if (dh) *dh = rp->drag.size.y;
|
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Sets the drag step increment
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The x step ammount
|
|
|
|
* @param dy The y step ammount
|
|
|
|
*
|
|
|
|
* Sets the x,y step increments for a dragable object.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-31 19:53:08 -07:00
|
|
|
edje_object_part_drag_step_set(Evas_Object *obj, const char *part, double dx, double dy)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2003-08-31 19:53:08 -07:00
|
|
|
if (dx < 0.0) dx = 0.0;
|
|
|
|
else if (dx > 1.0) dx = 1.0;
|
|
|
|
if (dy < 0.0) dy = 0.0;
|
|
|
|
else if (dy > 1.0) dy = 1.0;
|
|
|
|
rp->drag.step.x = dx;
|
|
|
|
rp->drag.step.y = dy;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Gets the drag step increment values.
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part
|
|
|
|
* @param dx The x step increment pointer
|
|
|
|
* @param dy The y step increment pointer
|
|
|
|
*
|
|
|
|
* Gets the x and y step increments for the dragable object.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
|
2003-08-31 19:53:08 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-08-31 19:53:08 -07:00
|
|
|
if ((!ed) || (!part))
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-08-31 19:53:08 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (dx) *dx = rp->drag.step.x;
|
|
|
|
if (dy) *dy = rp->drag.step.y;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Sets the page step increments
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The x page step increment
|
2004-10-27 12:24:42 -07:00
|
|
|
* @param dy The y page step increment
|
2004-06-05 21:42:17 -07:00
|
|
|
*
|
|
|
|
* Sets the x,y page step increment values.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-31 19:53:08 -07:00
|
|
|
edje_object_part_drag_page_set(Evas_Object *obj, const char *part, double dx, double dy)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2003-08-31 19:53:08 -07:00
|
|
|
if (dx < 0.0) dx = 0.0;
|
|
|
|
else if (dx > 1.0) dx = 1.0;
|
|
|
|
if (dy < 0.0) dy = 0.0;
|
|
|
|
else if (dy > 1.0) dy = 1.0;
|
|
|
|
rp->drag.page.x = dx;
|
|
|
|
rp->drag.page.y = dy;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Gets the page step increments
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The dx page increment pointer
|
|
|
|
* @param dy The dy page increment pointer
|
|
|
|
*
|
|
|
|
* Gets the x,y page step increments for the dragable object.
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2008-08-14 11:21:27 -07:00
|
|
|
edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double *dx, double *dy)
|
2003-08-31 19:53:08 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2003-08-31 19:53:08 -07:00
|
|
|
if ((!ed) || (!part))
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
2008-11-14 03:06:15 -08:00
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2003-08-31 19:53:08 -07:00
|
|
|
if (!rp)
|
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (dx) *dx = rp->drag.page.x;
|
|
|
|
if (dy) *dy = rp->drag.page.y;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Steps the dragable x,y steps
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The x step
|
|
|
|
* @param dy The y step
|
|
|
|
*
|
2005-09-20 20:11:31 -07:00
|
|
|
* Steps x,y where the step increment is the amount set by
|
|
|
|
* edje_object_part_drag_step_set.
|
2004-06-05 21:42:17 -07:00
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-31 19:53:08 -07:00
|
|
|
edje_object_part_drag_step(Evas_Object *obj, const char *part, double dx, double dy)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
double px, py;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2003-08-31 19:53:08 -07:00
|
|
|
if (rp->drag.down.count > 0) return;
|
|
|
|
px = rp->drag.val.x;
|
|
|
|
py = rp->drag.val.y;
|
|
|
|
rp->drag.val.x += dx * rp->drag.step.x * rp->part->dragable.x;
|
|
|
|
rp->drag.val.y += dy * rp->drag.step.y * rp->part->dragable.y;
|
2004-12-11 11:08:55 -08:00
|
|
|
rp->drag.val.x = CLAMP (rp->drag.val.x, 0.0, 1.0);
|
|
|
|
rp->drag.val.y = CLAMP (rp->drag.val.y, 0.0, 1.0);
|
2003-08-31 19:53:08 -07:00
|
|
|
if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, rp->drag.val.x, rp->drag.val.y);
|
|
|
|
_edje_emit(rp->edje, "drag,step", rp->part->name);
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/** Pages x,y steps
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param dx The x step
|
|
|
|
* @param dy The y step
|
|
|
|
*
|
|
|
|
* Pages x,y where the increment is defined by edje_object_part_drag_page_set.\n
|
|
|
|
* WARNING: Paging is bugged!
|
|
|
|
*/
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-08-31 19:53:08 -07:00
|
|
|
edje_object_part_drag_page(Evas_Object *obj, const char *part, double dx, double dy)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
double px, py;
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2008-02-15 11:30:12 -08:00
|
|
|
if ((!ed) || (!part)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!rp) return;
|
2003-08-31 19:53:08 -07:00
|
|
|
if (rp->drag.down.count > 0) return;
|
|
|
|
px = rp->drag.val.x;
|
|
|
|
py = rp->drag.val.y;
|
|
|
|
rp->drag.val.x += dx * rp->drag.page.x * rp->part->dragable.x;
|
|
|
|
rp->drag.val.y += dy * rp->drag.page.y * rp->part->dragable.y;
|
2004-12-11 11:08:55 -08:00
|
|
|
rp->drag.val.x = CLAMP (rp->drag.val.x, 0.0, 1.0);
|
|
|
|
rp->drag.val.y = CLAMP (rp->drag.val.y, 0.0, 1.0);
|
2003-08-31 19:53:08 -07:00
|
|
|
if ((px == rp->drag.val.x) && (py == rp->drag.val.y)) return;
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, rp->drag.val.x, rp->drag.val.y);
|
|
|
|
_edje_emit(rp->edje, "drag,page", rp->part->name);
|
|
|
|
}
|
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
void
|
|
|
|
_edje_box_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_box_shutdown(void)
|
|
|
|
{
|
|
|
|
if (!_edje_box_layout_registry)
|
|
|
|
return;
|
|
|
|
|
|
|
|
eina_rbtree_delete
|
|
|
|
(_edje_box_layout_registry, _edje_box_layout_external_free, NULL);
|
|
|
|
_edje_box_layout_registry = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Appends an object to the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to append
|
|
|
|
*
|
|
|
|
* @return 1: Successfully added.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Appends child to the box indicated by part.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
edje_object_part_box_append(Evas_Object *obj, const char *part, Evas_Object *child)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part) || (!child)) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
return _edje_real_part_box_append(rp, child);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Prepends an object to the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to prepend
|
|
|
|
*
|
|
|
|
* @return 1: Successfully added.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Prepends child to the box indicated by part.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
edje_object_part_box_prepend(Evas_Object *obj, const char *part, Evas_Object *child)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
return _edje_real_part_box_prepend(rp, child);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Adds an object to the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to insert
|
|
|
|
* @param reference The object to be used as reference
|
|
|
|
*
|
|
|
|
* @return 1: Successfully added.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Inserts child in the box given by part, in the position marked by reference.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
edje_object_part_box_insert_before(Evas_Object *obj, const char *part, Evas_Object *child, const Evas_Object *reference)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
return _edje_real_part_box_insert_before(rp, child, reference);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Inserts an object to the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to insert
|
|
|
|
* @param pos The position where to insert child
|
|
|
|
*
|
|
|
|
* @return 1: Successfully added.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Adds child to the box indicated by part, in the position given by pos.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
edje_object_part_box_insert_at(Evas_Object *obj, const char *part, Evas_Object *child, unsigned int pos)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
return _edje_real_part_box_insert_at(rp, child, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Removes an object from the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to remove
|
|
|
|
*
|
|
|
|
* @return 1: Successfully removed.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Removes child from the box indicated by part.\n
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
edje_object_part_box_remove(Evas_Object *obj, const char *part, Evas_Object *child)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return NULL;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return NULL;
|
|
|
|
|
|
|
|
return _edje_real_part_box_remove(rp, child);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Removes an object from the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param pos
|
|
|
|
*
|
|
|
|
* @return 1: Successfully removed.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Removes from the box indicated by part, the object in the position pos.\n
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
edje_object_part_box_remove_at(Evas_Object *obj, const char *part, unsigned int pos)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return NULL;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return NULL;
|
|
|
|
|
|
|
|
return _edje_real_part_box_remove_at(rp, pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Removes all elements from the box
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param clear Delete objects on removal
|
|
|
|
*
|
|
|
|
* @return 1: Successfully cleared.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Removes all the external objects from the box indicated by part.
|
|
|
|
* Elements created from the theme will not be removed.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_box_remove_all(Evas_Object *obj, const char *part, Eina_Bool clear)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_BOX) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
return _edje_real_part_box_remove_all(rp, clear);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
static void
|
|
|
|
_edje_box_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UNUSED__, void *einfo __UNUSED__)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_box_child_add(Edje_Real_Part *rp, Evas_Object *child)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
|
|
|
|
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_box_child_remove(Edje_Real_Part *rp, Evas_Object *child)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(child, EVAS_CALLBACK_DEL, _edje_box_child_del_cb, rp);
|
|
|
|
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_real_part_box_append(Edje_Real_Part *rp, Evas_Object *child_obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
|
|
|
|
opt = evas_object_box_append(rp->object, child_obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!opt) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_box_child_add(rp, child_obj);
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_real_part_box_prepend(Edje_Real_Part *rp, Evas_Object *child_obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
|
|
|
|
opt = evas_object_box_prepend(rp->object, child_obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!opt) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_box_child_add(rp, child_obj);
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_real_part_box_insert_before(Edje_Real_Part *rp, Evas_Object *child_obj, const Evas_Object *ref)
|
|
|
|
{
|
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
|
|
|
|
opt = evas_object_box_insert_before(rp->object, child_obj, ref);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!opt) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_box_child_add(rp, child_obj);
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-11-23 21:15:15 -08:00
|
|
|
_edje_real_part_box_insert_at(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned int pos)
|
|
|
|
{
|
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
|
|
|
|
opt = evas_object_box_insert_at(rp->object, child_obj, pos);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!opt) return EINA_FALSE;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_box_child_add(rp, child_obj);
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
_edje_real_part_box_remove(Edje_Real_Part *rp, Evas_Object *child_obj)
|
|
|
|
{
|
|
|
|
if (evas_object_data_get(child_obj, "\377 edje.box_item")) return NULL;
|
2009-04-26 19:38:14 -07:00
|
|
|
if (!evas_object_box_remove(rp->object, child_obj)) return NULL;
|
|
|
|
_edje_box_child_remove(rp, child_obj);
|
|
|
|
return child_obj;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
_edje_real_part_box_remove_at(Edje_Real_Part *rp, unsigned int pos)
|
|
|
|
{
|
|
|
|
Evas_Object_Box_Option *opt;
|
|
|
|
Evas_Object_Box_Data *priv;
|
|
|
|
Evas_Object *child_obj;
|
|
|
|
|
|
|
|
priv = evas_object_smart_data_get(rp->object);
|
|
|
|
opt = eina_list_nth(priv->children, pos);
|
|
|
|
if (!opt) return NULL;
|
|
|
|
child_obj = opt->obj;
|
|
|
|
if (evas_object_data_get(child_obj, "\377 edje.box_item")) return NULL;
|
2009-04-26 19:38:14 -07:00
|
|
|
if (!evas_object_box_remove_at(rp->object, pos)) return NULL;
|
|
|
|
_edje_box_child_remove(rp, child_obj);
|
|
|
|
return child_obj;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_real_part_box_remove_all(Edje_Real_Part *rp, Eina_Bool clear)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2008-12-17 18:43:20 -08:00
|
|
|
Eina_List *children;
|
2008-11-23 21:15:15 -08:00
|
|
|
int i;
|
|
|
|
|
|
|
|
i = 0;
|
2008-12-17 18:43:20 -08:00
|
|
|
children = evas_object_box_children_get(rp->object);
|
|
|
|
while (children)
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2008-12-17 18:43:20 -08:00
|
|
|
Evas_Object *child_obj = children->data;
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_box_child_remove(rp, child_obj);
|
2008-11-23 21:15:15 -08:00
|
|
|
if (evas_object_data_get(child_obj, "\377 edje.box_item"))
|
2008-12-17 18:43:20 -08:00
|
|
|
i++;
|
|
|
|
else
|
2008-11-23 21:15:15 -08:00
|
|
|
{
|
2008-12-17 18:43:20 -08:00
|
|
|
if (!evas_object_box_remove_at(rp->object, i))
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
if (clear)
|
|
|
|
evas_object_del(child_obj);
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
2008-12-17 18:43:20 -08:00
|
|
|
children = eina_list_remove_list(children, children);
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
static void
|
|
|
|
_edje_table_child_del_cb(void *data, Evas *e __UNUSED__, Evas_Object *child __UNUSED__, void *einfo __UNUSED__)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp = data;
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_table_child_add(Edje_Real_Part *rp, Evas_Object *child)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
|
|
|
|
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_table_child_remove(Edje_Real_Part *rp, Evas_Object *child)
|
|
|
|
{
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(child, EVAS_CALLBACK_DEL, _edje_table_child_del_cb, rp);
|
|
|
|
|
|
|
|
rp->edje->dirty = 1;
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
2008-12-17 18:43:20 -08:00
|
|
|
/** Packs an object into the table
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to pack in
|
|
|
|
* @param col The column to place it in
|
|
|
|
* @param row The row to place it in
|
|
|
|
* @param colspan Columns the child will take
|
|
|
|
* @param rowspan Rows the child will take
|
|
|
|
*
|
|
|
|
* @return 1: Successfully added.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Packs an object into the table indicated by part.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-12-17 18:43:20 -08:00
|
|
|
edje_object_part_table_pack(Evas_Object *obj, const char *part, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
return _edje_real_part_table_pack(rp, child_obj, col, row, colspan, rowspan);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Removes an object from the table
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param child The object to pack in
|
|
|
|
*
|
|
|
|
* @return 1: Successfully removed.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
|
|
|
* Removes an object from the table indicated by part.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-12-17 18:43:20 -08:00
|
|
|
edje_object_part_table_unpack(Evas_Object *obj, const char *part, Evas_Object *child_obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
return _edje_real_part_table_unpack(rp, child_obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Gets the number of columns and rows the table has
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param cols Pointer where to store number of columns (can be NULL)
|
|
|
|
* @param rows Pointer where to store number of rows (can be NULL)
|
|
|
|
*
|
2008-12-31 03:49:42 -08:00
|
|
|
* @return 1: Successfully get some data.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
2008-12-17 18:43:20 -08:00
|
|
|
* Retrieves the size of the table in number of columns and rows.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
2008-12-17 18:43:20 -08:00
|
|
|
edje_object_part_table_col_row_size_get(const Evas_Object *obj, const char *part, int *cols, int *rows)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
2008-12-31 03:49:42 -08:00
|
|
|
evas_object_table_col_row_size_get(rp->object, cols, rows);
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-12-17 18:43:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Removes all object from the table
|
|
|
|
* @param obj A valid Evas_Object handle
|
|
|
|
* @param part The part name
|
|
|
|
* @param clear If set, will delete subobjs on remove
|
|
|
|
*
|
2008-12-31 03:49:42 -08:00
|
|
|
* @return 1: Successfully clear table.\n
|
|
|
|
* 0: An error occured.
|
|
|
|
*
|
2008-12-17 18:43:20 -08:00
|
|
|
* Removes all object from the table indicated by part, except
|
|
|
|
* the internal ones set from the theme.\n
|
|
|
|
*/
|
2009-06-17 04:10:32 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_table_clear(Evas_Object *obj, const char *part, Eina_Bool clear)
|
2008-12-17 18:43:20 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2009-06-17 04:10:32 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-06-17 04:10:32 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_TABLE) return EINA_FALSE;
|
2008-12-17 18:43:20 -08:00
|
|
|
|
2008-12-31 03:49:42 -08:00
|
|
|
_edje_real_part_table_clear(rp, clear);
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2008-12-17 18:43:20 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-12-17 18:43:20 -08:00
|
|
|
_edje_real_part_table_pack(Edje_Real_Part *rp, Evas_Object *child_obj, unsigned short col, unsigned short row, unsigned short colspan, unsigned short rowspan)
|
|
|
|
{
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool ret = evas_object_table_pack(rp->object, child_obj, col, row, colspan, rowspan);
|
2009-04-26 19:38:14 -07:00
|
|
|
|
|
|
|
_edje_table_child_add(rp, child_obj);
|
|
|
|
|
|
|
|
return ret;
|
2008-12-17 18:43:20 -08:00
|
|
|
}
|
|
|
|
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool
|
2008-12-17 18:43:20 -08:00
|
|
|
_edje_real_part_table_unpack(Edje_Real_Part *rp, Evas_Object *child_obj)
|
|
|
|
{
|
2009-06-17 04:10:32 -07:00
|
|
|
Eina_Bool ret = evas_object_table_unpack(rp->object, child_obj);
|
2009-04-26 19:38:14 -07:00
|
|
|
|
|
|
|
if (ret)
|
|
|
|
_edje_table_child_remove(rp, child_obj);
|
|
|
|
|
|
|
|
return ret;
|
2008-12-17 18:43:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-06-17 04:10:32 -07:00
|
|
|
_edje_real_part_table_clear(Edje_Real_Part *rp, Eina_Bool clear)
|
2008-12-17 18:43:20 -08:00
|
|
|
{
|
|
|
|
Eina_List *children;
|
|
|
|
|
|
|
|
children = evas_object_table_children_get(rp->object);
|
|
|
|
while (children)
|
|
|
|
{
|
|
|
|
Evas_Object *child_obj = children->data;
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_table_child_remove(rp, child_obj);
|
2008-12-17 18:43:20 -08:00
|
|
|
if (!evas_object_data_get(child_obj, "\377 edje.table_item"))
|
|
|
|
{
|
|
|
|
evas_object_table_unpack(rp->object, child_obj);
|
|
|
|
if (clear)
|
|
|
|
evas_object_del(child_obj);
|
|
|
|
}
|
|
|
|
children = eina_list_remove_list(children, children);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_Real_Part *
|
|
|
|
_edje_real_part_recursive_get(Edje *ed, const char *part)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
char **path;
|
|
|
|
path = ecore_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
|
|
|
|
if (!path) return NULL;
|
|
|
|
|
|
|
|
//printf("recursive get: %s\n", part);
|
|
|
|
rp = _edje_real_part_recursive_get_helper(ed, path);
|
|
|
|
|
|
|
|
free(*path);
|
|
|
|
free(path);
|
|
|
|
return rp;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_Real_Part *
|
|
|
|
_edje_real_part_recursive_get_helper(Edje *ed, char **path)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
|
|
|
|
rp = _edje_real_part_get(ed, path[0]);
|
2008-02-15 11:30:12 -08:00
|
|
|
if (path[1] == NULL) return rp;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2008-03-24 01:22:01 -07:00
|
|
|
if ((!rp) || (rp->part->type != EDJE_PART_TYPE_GROUP) ||
|
2008-02-15 11:30:12 -08:00
|
|
|
(!rp->swallowed_object)) return NULL;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(rp->swallowed_object);
|
|
|
|
if (!ed) return NULL;
|
|
|
|
|
|
|
|
path++;
|
|
|
|
return _edje_real_part_recursive_get_helper(ed, path);
|
|
|
|
}
|
2004-03-30 02:30:35 -08:00
|
|
|
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* Private Routines */
|
2004-03-30 02:30:35 -08:00
|
|
|
|
2003-07-12 23:19:09 -07:00
|
|
|
Edje_Real_Part *
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_real_part_get(Edje *ed, const char *part)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
2007-05-26 16:57:21 -07:00
|
|
|
int i;
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 16:57:21 -07:00
|
|
|
rp = ed->table_parts[i];
|
2005-12-05 02:08:30 -08:00
|
|
|
if ((rp->part->name) && (!strcmp(rp->part->name, part))) return rp;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-10-29 20:45:18 -08:00
|
|
|
Edje_Color_Class *
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_color_class_find(Edje *ed, const char *color_class)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
2006-01-10 19:19:45 -08:00
|
|
|
Edje_Color_Class *cc = NULL;
|
2006-01-29 09:04:41 -08:00
|
|
|
|
2004-01-12 11:21:25 -08:00
|
|
|
if ((!ed) || (!color_class)) return NULL;
|
2006-01-10 19:19:45 -08:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
/* first look through the object scope */
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->color_classes, l, cc)
|
|
|
|
if ((cc->name) && (!strcmp(color_class, cc->name))) return cc;
|
2006-01-10 19:19:45 -08:00
|
|
|
|
|
|
|
/* next look through the global scope */
|
2008-12-15 13:00:19 -08:00
|
|
|
cc = eina_hash_find(_edje_color_class_hash, color_class);
|
2006-01-10 19:19:45 -08:00
|
|
|
if (cc) return cc;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2006-01-10 19:19:45 -08:00
|
|
|
/* finally, look through the file scope */
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
|
|
|
|
if ((cc->name) && (!strcmp(color_class, cc->name))) return cc;
|
2006-01-10 19:19:45 -08:00
|
|
|
|
|
|
|
return NULL;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_color_class_member_add(Edje *ed, const char *color_class)
|
2003-11-03 22:15:19 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
|
|
|
if ((!ed) || (!color_class)) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_color_class_member_hash, color_class);
|
2008-03-24 01:22:01 -07:00
|
|
|
if (members)
|
2008-02-15 11:30:12 -08:00
|
|
|
{
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_color_class_member_hash, color_class, members);
|
2008-02-15 11:30:12 -08:00
|
|
|
}
|
2008-03-24 01:22:01 -07:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_prepend(members, ed);
|
2008-12-17 00:04:42 -08:00
|
|
|
if (!_edje_color_class_member_hash) _edje_color_class_member_hash = eina_hash_string_superfast_new(NULL);
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_add(_edje_color_class_member_hash, color_class, members);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_color_class_member_del(Edje *ed, const char *color_class)
|
2003-11-03 22:15:19 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
|
|
|
if ((!ed) || (!color_class)) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_color_class_member_hash, color_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!members) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_color_class_member_hash, color_class, members);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_remove(members, ed);
|
2008-03-24 01:22:01 -07:00
|
|
|
if (members)
|
2008-02-15 11:30:12 -08:00
|
|
|
{
|
2008-12-17 00:04:42 -08:00
|
|
|
eina_hash_add(_edje_color_class_member_hash, color_class, members);
|
2008-02-15 11:30:12 -08:00
|
|
|
}
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
2004-01-13 09:14:31 -08:00
|
|
|
/**
|
|
|
|
* Used to free the member lists that are stored in the text_class
|
|
|
|
* and color_class hashtables.
|
|
|
|
*/
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
|
|
|
member_list_free(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
2004-01-13 09:14:31 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
eina_list_free(data);
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2004-01-13 09:14:31 -08:00
|
|
|
}
|
|
|
|
|
2004-01-12 11:21:25 -08:00
|
|
|
void
|
|
|
|
_edje_color_class_members_free(void)
|
|
|
|
{
|
|
|
|
if (!_edje_color_class_member_hash) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_color_class_member_hash, member_list_free, NULL);
|
|
|
|
eina_hash_free(_edje_color_class_member_hash);
|
2004-01-12 11:21:25 -08:00
|
|
|
_edje_color_class_member_hash = NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
|
|
|
color_class_hash_list_free(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
2005-01-12 22:29:52 -08:00
|
|
|
{
|
2008-02-15 11:30:12 -08:00
|
|
|
Edje_Color_Class *cc;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-02-15 11:30:12 -08:00
|
|
|
cc = data;
|
2008-10-15 07:11:11 -07:00
|
|
|
if (cc->name) eina_stringshare_del(cc->name);
|
2008-02-15 11:30:12 -08:00
|
|
|
free(cc);
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2005-01-12 22:29:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_color_class_hash_free(void)
|
|
|
|
{
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!_edje_color_class_hash) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_color_class_hash, color_class_hash_list_free, NULL);
|
|
|
|
eina_hash_free(_edje_color_class_hash);
|
2008-02-15 11:30:12 -08:00
|
|
|
_edje_color_class_hash = NULL;
|
2005-01-12 22:29:52 -08:00
|
|
|
}
|
|
|
|
|
2003-11-03 22:15:19 -08:00
|
|
|
void
|
2003-11-24 23:22:19 -08:00
|
|
|
_edje_color_class_on_del(Edje *ed, Edje_Part *ep)
|
2003-11-03 22:15:19 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *tmp;
|
|
|
|
Edje_Part_Description *desc;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_color_class_member_del(ed, ep->default_desc->color_class);
|
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ep->other_desc, tmp, desc)
|
|
|
|
if (desc->color_class)
|
|
|
|
_edje_color_class_member_del(ed, desc->color_class);
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
|
2003-10-29 20:45:18 -08:00
|
|
|
Edje_Text_Class *
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_text_class_find(Edje *ed, const char *text_class)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Edje_Text_Class *tc;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2004-01-12 11:21:25 -08:00
|
|
|
if ((!ed) || (!text_class)) return NULL;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_classes, l, tc)
|
|
|
|
if ((tc->name) && (!strcmp(text_class, tc->name))) return tc;
|
2008-12-15 13:00:19 -08:00
|
|
|
return eina_hash_find(_edje_text_class_hash, text_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_text_class_member_add(Edje *ed, const char *text_class)
|
2003-11-03 22:15:19 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
|
|
|
if ((!ed) || (!text_class)) return;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Get members list */
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_text_class_member_hash, text_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Remove members list */
|
2008-03-24 01:22:01 -07:00
|
|
|
if (members)
|
2008-02-15 11:30:12 -08:00
|
|
|
{
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_text_class_member_hash, text_class, members);
|
2008-02-15 11:30:12 -08:00
|
|
|
}
|
2008-03-24 01:22:01 -07:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Update the member list */
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_prepend(members, ed);
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2006-03-18 20:22:35 -08:00
|
|
|
/* Add the member list back */
|
2008-12-17 00:04:42 -08:00
|
|
|
if (!_edje_text_class_member_hash) _edje_text_class_member_hash = eina_hash_string_superfast_new(NULL);
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_add(_edje_text_class_member_hash, text_class, members);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-18 20:22:35 -08:00
|
|
|
_edje_text_class_member_del(Edje *ed, const char *text_class)
|
2003-11-03 22:15:19 -08:00
|
|
|
{
|
2008-10-22 04:34:42 -07:00
|
|
|
Eina_List *members;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
|
|
|
if ((!ed) || (!text_class)) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
members = eina_hash_find(_edje_text_class_member_hash, text_class);
|
2003-11-03 22:15:19 -08:00
|
|
|
if (!members) return;
|
|
|
|
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_del(_edje_text_class_member_hash, text_class, members);
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_remove(members, ed);
|
2008-03-24 01:22:01 -07:00
|
|
|
if (members)
|
2008-02-15 11:30:12 -08:00
|
|
|
{
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_add(_edje_text_class_member_hash, text_class, members);
|
2008-02-15 11:30:12 -08:00
|
|
|
}
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
|
2004-01-12 11:21:25 -08:00
|
|
|
void
|
|
|
|
_edje_text_class_members_free(void)
|
|
|
|
{
|
|
|
|
if (!_edje_text_class_member_hash) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_text_class_member_hash, member_list_free, NULL);
|
|
|
|
eina_hash_free(_edje_text_class_member_hash);
|
2004-01-12 11:21:25 -08:00
|
|
|
_edje_text_class_member_hash = NULL;
|
|
|
|
}
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
|
|
|
text_class_hash_list_free(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
2005-01-12 22:29:52 -08:00
|
|
|
{
|
2008-02-15 11:30:12 -08:00
|
|
|
Edje_Text_Class *tc;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2008-02-15 11:30:12 -08:00
|
|
|
tc = data;
|
2008-10-15 07:11:11 -07:00
|
|
|
if (tc->name) eina_stringshare_del(tc->name);
|
|
|
|
if (tc->font) eina_stringshare_del(tc->font);
|
2008-02-15 11:30:12 -08:00
|
|
|
free(tc);
|
2009-06-17 04:10:32 -07:00
|
|
|
return EINA_TRUE;
|
2005-01-12 22:29:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_text_class_hash_free(void)
|
|
|
|
{
|
2008-02-15 11:30:12 -08:00
|
|
|
if (!_edje_text_class_hash) return;
|
2008-12-15 13:00:19 -08:00
|
|
|
eina_hash_foreach(_edje_text_class_hash, text_class_hash_list_free, NULL);
|
|
|
|
eina_hash_free(_edje_text_class_hash);
|
2008-02-15 11:30:12 -08:00
|
|
|
_edje_text_class_hash = NULL;
|
2005-01-12 22:29:52 -08:00
|
|
|
}
|
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
Edje *
|
2008-08-14 11:21:27 -07:00
|
|
|
_edje_fetch(const Evas_Object *obj)
|
2003-06-23 19:33:04 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
char *type;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-06-23 19:33:04 -07:00
|
|
|
type = (char *)evas_object_type_get(obj);
|
|
|
|
if (!type) return NULL;
|
|
|
|
if (strcmp(type, "edje")) return NULL;
|
|
|
|
ed = evas_object_smart_data_get(obj);
|
2005-09-28 00:13:16 -07:00
|
|
|
if ((ed) && (ed->delete_me)) return NULL;
|
2003-06-23 19:33:04 -07:00
|
|
|
return ed;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_edje_freeze(Edje *ed)
|
|
|
|
{
|
|
|
|
ed->freeze++;
|
2004-08-12 11:55:45 -07:00
|
|
|
// printf("FREEZE %i\n", ed->freeze);
|
2003-06-23 19:33:04 -07:00
|
|
|
return ed->freeze;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_edje_thaw(Edje *ed)
|
|
|
|
{
|
|
|
|
ed->freeze--;
|
2004-08-12 11:55:45 -07:00
|
|
|
if (ed->freeze < 0)
|
|
|
|
{
|
|
|
|
// printf("-------------########### OVER THAW\n");
|
|
|
|
ed->freeze = 0;
|
|
|
|
}
|
2006-12-24 02:29:16 -08:00
|
|
|
if ((ed->freeze == 0) && (ed->recalc))
|
2004-08-12 11:55:45 -07:00
|
|
|
{
|
|
|
|
// printf("thaw recalc\n");
|
|
|
|
_edje_recalc(ed);
|
|
|
|
}
|
2003-06-23 19:33:04 -07:00
|
|
|
return ed->freeze;
|
|
|
|
}
|
2003-07-20 05:37:49 -07:00
|
|
|
|
2003-08-25 17:16:49 -07:00
|
|
|
int
|
|
|
|
_edje_block(Edje *ed)
|
|
|
|
{
|
2004-10-29 19:30:55 -07:00
|
|
|
_edje_ref(ed);
|
2003-08-25 17:16:49 -07:00
|
|
|
ed->block++;
|
|
|
|
return ed->block;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_edje_unblock(Edje *ed)
|
|
|
|
{
|
2004-10-29 19:30:55 -07:00
|
|
|
int ret = 0;
|
2004-10-30 04:08:17 -07:00
|
|
|
if (!ed) return ret;
|
2004-10-29 19:30:55 -07:00
|
|
|
|
2003-08-25 17:16:49 -07:00
|
|
|
ed->block--;
|
2008-02-15 11:30:12 -08:00
|
|
|
if (ed->block == 0) ed->block_break = 0;
|
2004-10-29 19:30:55 -07:00
|
|
|
ret = ed->block;
|
|
|
|
_edje_unref(ed);
|
|
|
|
return ret;
|
2003-08-25 17:16:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
_edje_block_break(Edje *ed)
|
|
|
|
{
|
|
|
|
if (ed->block_break) return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_block_violate(Edje *ed)
|
|
|
|
{
|
|
|
|
if (ed->block > 0) ed->block_break = 1;
|
|
|
|
}
|
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
void
|
|
|
|
_edje_object_part_swallow_free_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Object *edje_obj;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
edje_obj = data;
|
|
|
|
edje_object_part_unswallow(edje_obj, obj);
|
2003-10-18 19:11:06 -07:00
|
|
|
return;
|
|
|
|
e = NULL;
|
|
|
|
event_info = NULL;
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
_edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow)
|
|
|
|
{
|
|
|
|
char *type;
|
|
|
|
|
|
|
|
if (rp->swallowed_object)
|
|
|
|
{
|
|
|
|
evas_object_smart_member_del(rp->swallowed_object);
|
|
|
|
evas_object_event_callback_del(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_FREE,
|
|
|
|
_edje_object_part_swallow_free_cb);
|
|
|
|
evas_object_clip_unset(rp->swallowed_object);
|
|
|
|
evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
|
|
|
|
if (rp->part->mouse_events)
|
|
|
|
_edje_callbacks_del(rp->swallowed_object);
|
|
|
|
rp->swallowed_object = NULL;
|
|
|
|
}
|
|
|
|
if (!obj_swallow) return;
|
|
|
|
rp->swallowed_object = obj_swallow;
|
|
|
|
evas_object_smart_member_add(rp->swallowed_object, rp->edje->obj);
|
|
|
|
if (rp->clip_to)
|
|
|
|
evas_object_clip_set(rp->swallowed_object, rp->clip_to->object);
|
|
|
|
else evas_object_clip_set(rp->swallowed_object, rp->edje->clipper);
|
|
|
|
evas_object_stack_above(rp->swallowed_object, rp->object);
|
2008-02-15 11:30:12 -08:00
|
|
|
evas_object_event_callback_add(rp->swallowed_object, EVAS_CALLBACK_FREE,
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_object_part_swallow_free_cb,
|
|
|
|
rp->edje->obj);
|
|
|
|
type = (char *)evas_object_type_get(obj_swallow);
|
|
|
|
rp->swallow_params.min.w = 0;
|
|
|
|
rp->swallow_params.min.w = 0;
|
|
|
|
rp->swallow_params.max.w = -1;
|
|
|
|
rp->swallow_params.max.h = -1;
|
|
|
|
if ((type) && (!strcmp(type, "edje")))
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
edje_object_size_min_get(obj_swallow, &w, &h);
|
|
|
|
rp->swallow_params.min.w = w;
|
|
|
|
rp->swallow_params.min.h = h;
|
|
|
|
edje_object_size_max_get(obj_swallow, &w, &h);
|
|
|
|
rp->swallow_params.max.w = w;
|
|
|
|
rp->swallow_params.max.h = h;
|
|
|
|
}
|
2008-02-15 11:30:12 -08:00
|
|
|
else if ((type) && ((!strcmp(type, "text")) || (!strcmp(type, "polygon")) ||
|
2007-05-26 22:28:07 -07:00
|
|
|
(!strcmp(type, "line"))))
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
evas_object_geometry_get(obj_swallow, NULL, NULL, &w, &h);
|
|
|
|
rp->swallow_params.min.w = w;
|
|
|
|
rp->swallow_params.min.h = h;
|
|
|
|
rp->swallow_params.max.w = w;
|
|
|
|
rp->swallow_params.max.h = h;
|
|
|
|
}
|
|
|
|
{
|
2008-10-04 20:37:37 -07:00
|
|
|
Evas_Coord w1, h1, w2, h2, aw, ah;
|
|
|
|
Evas_Aspect_Control am;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2008-10-04 20:37:37 -07:00
|
|
|
evas_object_size_hint_min_get(obj_swallow, &w1, &h1);
|
|
|
|
evas_object_size_hint_max_get(obj_swallow, &w2, &h2);
|
|
|
|
evas_object_size_hint_aspect_get(obj_swallow, &am, &aw, &ah);
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->swallow_params.min.w = w1;
|
|
|
|
rp->swallow_params.min.h = h1;
|
|
|
|
if (w2 > 0) rp->swallow_params.max.w = w2;
|
|
|
|
if (h2 > 0) rp->swallow_params.max.h = h2;
|
2008-10-04 20:37:37 -07:00
|
|
|
switch (am)
|
|
|
|
{
|
|
|
|
case EVAS_ASPECT_CONTROL_NONE: rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE; break;
|
|
|
|
case EVAS_ASPECT_CONTROL_NEITHER: rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER; break;
|
|
|
|
case EVAS_ASPECT_CONTROL_HORIZONTAL: rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL; break;
|
|
|
|
case EVAS_ASPECT_CONTROL_VERTICAL: rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL; break;
|
|
|
|
case EVAS_ASPECT_CONTROL_BOTH: rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH; break;
|
|
|
|
default: break;
|
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->swallow_params.aspect.w = aw;
|
|
|
|
rp->swallow_params.aspect.h = ah;
|
|
|
|
evas_object_data_set(rp->swallowed_object, "\377 edje.swallowing_part", rp);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rp->part->mouse_events)
|
|
|
|
{
|
|
|
|
_edje_callbacks_add(obj_swallow, rp->edje, rp);
|
|
|
|
if (rp->part->repeat_events)
|
|
|
|
evas_object_repeat_events_set(obj_swallow, 1);
|
2007-07-24 07:20:07 -07:00
|
|
|
if (rp->part->pointer_mode != EVAS_OBJECT_POINTER_MODE_AUTOGRAB)
|
|
|
|
evas_object_pointer_mode_set(obj_swallow, rp->part->pointer_mode);
|
2007-10-19 09:07:43 -07:00
|
|
|
evas_object_pass_events_set(obj_swallow, 0);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_pass_events_set(obj_swallow, 1);
|
|
|
|
|
2007-07-23 07:22:57 -07:00
|
|
|
if (rp->part->precise_is_inside)
|
|
|
|
evas_object_precise_is_inside_set(obj_swallow, 1);
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
rp->edje->dirty = 1;
|
2008-09-16 18:50:16 -07:00
|
|
|
_edje_recalc(rp->edje);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|