2003-06-23 19:33:04 -07:00
|
|
|
#include "edje_private.h"
|
|
|
|
|
2009-08-07 02:06:04 -07:00
|
|
|
typedef struct _Edje_Box_Layout Edje_Box_Layout;
|
2008-11-23 21:15:15 -08:00
|
|
|
struct _Edje_Box_Layout
|
|
|
|
{
|
2009-08-07 02:06:04 -07:00
|
|
|
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[];
|
2008-11-23 21:15:15 -08:00
|
|
|
};
|
|
|
|
|
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;
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T _edje_scale = ZERO;
|
2011-06-29 22:31:08 -07:00
|
|
|
Eina_Bool _edje_password_show_last = EINA_FALSE;
|
|
|
|
FLOAT_T _edje_password_show_last_timeout = ZERO;
|
2008-09-09 23:39:57 -07:00
|
|
|
int _edje_freeze_val = 0;
|
|
|
|
int _edje_freeze_calc_count = 0;
|
2010-02-14 22:40:58 -08:00
|
|
|
Eina_List *_edje_freeze_calc_list = NULL;
|
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
|
|
|
};
|
|
|
|
|
2011-06-22 07:51:53 -07:00
|
|
|
typedef struct _Edje_List_Refcount Edje_List_Refcount;
|
|
|
|
struct _Edje_List_Refcount
|
|
|
|
{
|
|
|
|
EINA_REFCOUNT;
|
|
|
|
|
|
|
|
Eina_List *lookup;
|
|
|
|
};
|
|
|
|
|
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);
|
2009-12-04 08:20:40 -08:00
|
|
|
static void _edje_object_image_preload_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _edje_object_signal_preload_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
|
2006-01-16 18:41:25 -08:00
|
|
|
|
2011-01-24 05:29:17 -08:00
|
|
|
Edje_Real_Part *_edje_real_part_recursive_get_helper(const Edje *ed, char **path);
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2011-06-23 02:55:57 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_class_member_direct_del(const char *class, Edje_List_Refcount *lookup, Eina_Hash *hash)
|
|
|
|
{
|
|
|
|
Eina_List *members;
|
|
|
|
|
|
|
|
members = eina_hash_find(hash, class);
|
|
|
|
members = eina_list_remove_list(members, lookup->lookup);
|
|
|
|
eina_hash_set(hash, class, members);
|
|
|
|
free(lookup);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_class_member_add(Edje *ed, Eina_Hash **ehash, Eina_Hash **ghash, const char *class)
|
|
|
|
{
|
|
|
|
Edje_List_Refcount *lookup;
|
|
|
|
Eina_List *members;
|
|
|
|
|
|
|
|
if ((!ed) || (!ehash) || (!ghash) || (!class)) return;
|
|
|
|
|
|
|
|
lookup = eina_hash_find(*ehash, class);
|
|
|
|
if (lookup)
|
|
|
|
{
|
|
|
|
EINA_REFCOUNT_REF(lookup);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
lookup = malloc(sizeof (Edje_List_Refcount));
|
|
|
|
if (!lookup) return ;
|
|
|
|
EINA_REFCOUNT_INIT(lookup);
|
|
|
|
|
|
|
|
/* Get members list */
|
|
|
|
members = eina_hash_find(*ghash, class);
|
|
|
|
|
|
|
|
/* Update the member list */
|
|
|
|
lookup->lookup = members = eina_list_prepend(members, ed);
|
|
|
|
|
|
|
|
/* Don't loose track of members list */
|
|
|
|
if (!*ehash)
|
|
|
|
*ehash = eina_hash_string_small_new(NULL);
|
|
|
|
eina_hash_add(*ehash, class, lookup);
|
|
|
|
|
|
|
|
/* Reset the member list to the right pointer */
|
|
|
|
if (!*ghash)
|
|
|
|
*ghash = eina_hash_string_superfast_new(NULL);
|
|
|
|
eina_hash_set(*ghash, class, members);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_class_member_del(Eina_Hash **ehash, Eina_Hash **ghash, const char *class)
|
|
|
|
{
|
|
|
|
Edje_List_Refcount *lookup;
|
|
|
|
Eina_List *members;
|
|
|
|
|
|
|
|
if ((!ehash) || (!ghash) || (!class)) return;
|
|
|
|
members = eina_hash_find(*ghash, class);
|
|
|
|
if (!members) return;
|
|
|
|
|
|
|
|
lookup = eina_hash_find(*ehash, class);
|
|
|
|
if (!lookup) return ;
|
|
|
|
|
|
|
|
EINA_REFCOUNT_UNREF(lookup)
|
|
|
|
{
|
|
|
|
members = eina_list_remove_list(members, lookup->lookup);
|
|
|
|
eina_hash_set(*ghash, class, members);
|
|
|
|
|
|
|
|
eina_hash_del(*ehash, class, lookup);
|
|
|
|
free(lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
member_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
|
|
|
|
{
|
|
|
|
eina_list_free(data);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_class_members_free(Eina_Hash **ghash)
|
|
|
|
{
|
|
|
|
if (!ghash || !*ghash) return;
|
|
|
|
eina_hash_foreach(*ghash, member_list_free, NULL);
|
|
|
|
eina_hash_free(*ghash);
|
|
|
|
*ghash = NULL;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/************************** API Routines **************************/
|
|
|
|
|
2010-02-14 22:40:58 -08:00
|
|
|
#define FASTFREEZE 1
|
2008-09-09 23:39:57 -07:00
|
|
|
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-15 22:15:15 -07:00
|
|
|
edje_freeze(void)
|
|
|
|
{
|
2009-09-17 15:38:35 -07:00
|
|
|
#ifdef FASTFREEZE
|
2008-09-09 23:39:57 -07:00
|
|
|
_edje_freeze_val++;
|
2009-12-22 05:46:00 -08:00
|
|
|
INF("fr ++ ->%i", _edje_freeze_val);
|
2009-09-17 15:38:35 -07:00
|
|
|
#else
|
2008-09-09 23:39:57 -07:00
|
|
|
// 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);
|
2009-09-17 15:38:35 -07:00
|
|
|
#endif
|
2003-07-15 22:15:15 -07:00
|
|
|
}
|
|
|
|
|
2009-09-17 15:38:35 -07:00
|
|
|
#ifdef FASTFREEZE
|
2008-09-10 00:17:24 -07:00
|
|
|
static void
|
|
|
|
_edje_thaw_edje(Edje *ed)
|
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2009-09-17 15:38:35 -07:00
|
|
|
|
2008-09-10 00:17:24 -07:00
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2009-09-17 15:38:35 -07:00
|
|
|
|
2008-09-10 00:17:24 -07:00
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
|
|
|
{
|
|
|
|
Edje *ed2;
|
2009-09-17 15:38:35 -07:00
|
|
|
|
2008-09-10 00:17:24 -07:00
|
|
|
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
|
|
|
|
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2003-07-15 22:15:15 -07:00
|
|
|
edje_thaw(void)
|
|
|
|
{
|
2009-09-17 15:38:35 -07:00
|
|
|
#ifdef FASTFREEZE
|
2008-09-09 23:39:57 -07:00
|
|
|
_edje_freeze_val--;
|
2009-12-22 05:46:00 -08:00
|
|
|
INF("fr -- ->%i", _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
|
|
|
{
|
2010-02-14 22:40:58 -08:00
|
|
|
Edje *ed;
|
2008-09-09 23:39:57 -07:00
|
|
|
|
|
|
|
_edje_freeze_calc_count = 0;
|
2010-02-14 22:40:58 -08:00
|
|
|
EINA_LIST_FREE(_edje_freeze_calc_list, ed)
|
2008-09-09 23:39:57 -07:00
|
|
|
{
|
2010-02-14 22:40:58 -08:00
|
|
|
_edje_thaw_edje(ed);
|
|
|
|
ed->freeze_calc = 0;
|
2008-09-09 23:39:57 -07:00
|
|
|
}
|
|
|
|
}
|
2010-07-02 11:17:37 -07:00
|
|
|
#else
|
2010-04-19 13:37:28 -07:00
|
|
|
Evas_Object *data;
|
|
|
|
|
2008-09-09 23:39:57 -07:00
|
|
|
// 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);
|
2009-09-17 15:38:35 -07:00
|
|
|
#endif
|
2003-07-15 22:15:15 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2010-09-22 19:52:19 -07:00
|
|
|
Eina_List *l;
|
2008-10-22 04:34:42 -07:00
|
|
|
Evas_Object *data;
|
2008-09-09 07:13:34 -07:00
|
|
|
|
2009-12-09 07:44:54 -08:00
|
|
|
if (_edje_scale == FROM_DOUBLE(scale)) return;
|
|
|
|
_edje_scale = FROM_DOUBLE(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)
|
|
|
|
{
|
2009-12-09 07:44:54 -08:00
|
|
|
return TO_DOUBLE(_edje_scale);
|
2008-09-09 07:13:34 -07:00
|
|
|
}
|
|
|
|
|
2011-06-29 22:31:08 -07:00
|
|
|
EAPI void
|
|
|
|
edje_password_show_last_set(Eina_Bool password_show_last)
|
|
|
|
{
|
|
|
|
if (_edje_password_show_last == password_show_last) return;
|
|
|
|
_edje_password_show_last = password_show_last;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_password_show_last_timeout_set(double password_show_last_timeout)
|
|
|
|
{
|
|
|
|
if (_edje_password_show_last_timeout == FROM_DOUBLE(password_show_last_timeout)) return;
|
|
|
|
_edje_password_show_last_timeout = FROM_DOUBLE(password_show_last_timeout);
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2009-02-02 21:07:58 -08:00
|
|
|
edje_object_scale_set(Evas_Object *obj, double scale)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!ed) return EINA_FALSE;
|
|
|
|
if (ed->scale == scale) return EINA_TRUE;
|
2009-12-09 07:44:54 -08:00
|
|
|
ed->scale = FROM_DOUBLE(scale);
|
2009-02-02 21:07:58 -08:00
|
|
|
edje_object_calc_force(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2009-02-02 21:07:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
edje_object_scale_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return 0.0;
|
2009-12-09 07:44:54 -08:00
|
|
|
return TO_DOUBLE(ed->scale);
|
2009-02-02 21:07:58 -08:00
|
|
|
}
|
|
|
|
|
2011-02-01 05:26:49 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_mirrored_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return EINA_FALSE;
|
|
|
|
|
|
|
|
return ed->is_rtl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_object_orientation_inform(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
if (edje_object_mirrored_get(obj))
|
|
|
|
edje_object_signal_emit(obj, "edje,state,rtl", "edje");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(obj, "edje,state,ltr", "edje");
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_object_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2011-02-03 02:16:48 -08:00
|
|
|
unsigned int i;
|
2011-02-01 05:26:49 -08:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return;
|
|
|
|
if (ed->is_rtl == rtl) return;
|
|
|
|
|
|
|
|
ed->is_rtl = rtl;
|
|
|
|
|
|
|
|
for (i = 0 ; i < ed->table_parts_size ; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *ep;
|
|
|
|
const char *s;
|
|
|
|
double v;
|
|
|
|
|
|
|
|
ep = ed->table_parts[i];
|
|
|
|
s = ep->param1.description->state.name,
|
|
|
|
v = ep->param1.description->state.value;
|
|
|
|
_edje_part_description_apply(ed, ep, s, v , NULL, 0.0);
|
|
|
|
ep->chosen_description = ep->param1.description;
|
|
|
|
}
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
|
|
|
_edje_object_orientation_inform(obj);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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;
|
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;
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!ed->collection->data) return NULL;
|
2010-08-12 05:58:54 -07:00
|
|
|
return edje_string_get(eina_hash_find(ed->collection->data, key));
|
2003-08-05 07:33:35 -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;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned 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);
|
|
|
|
}
|
|
|
|
|
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;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned 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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!color_class) return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
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));
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!cc) return EINA_FALSE;
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
2010-07-02 11:17:37 -07:00
|
|
|
if (!_edje_color_class_hash)
|
2009-08-07 02:06:04 -07:00
|
|
|
_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
|
|
|
}
|
|
|
|
|
2010-01-21 00:08:02 -08:00
|
|
|
if (r < 0) r = 0;
|
|
|
|
else if (r > 255) r = 255;
|
|
|
|
if (g < 0) g = 0;
|
|
|
|
else if (g > 255) g = 255;
|
|
|
|
if (b < 0) b = 0;
|
|
|
|
else if (b > 255) b = 255;
|
|
|
|
if (a < 0) a = 0;
|
|
|
|
else 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))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-11-03 22:15:19 -08:00
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2003-11-03 22:15:19 -08:00
|
|
|
_edje_recalc(ed);
|
2009-09-28 10:23:02 -07:00
|
|
|
_edje_emit(ed, "color_class,set", color_class);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
2009-09-28 10:23:02 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_color_class_get(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_Color_Class *cc;
|
|
|
|
|
|
|
|
if (!color_class)
|
|
|
|
cc = NULL;
|
|
|
|
else
|
|
|
|
cc = eina_hash_find(_edje_color_class_hash, color_class);
|
|
|
|
|
|
|
|
if (cc)
|
|
|
|
{
|
|
|
|
#define X(C) if (C) *C = cc->C
|
|
|
|
#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
|
|
|
|
S(r, g, b, a);
|
|
|
|
S(r2, g2, b2, a2);
|
|
|
|
S(r3, g3, b3, a3);
|
|
|
|
#undef S
|
|
|
|
#undef X
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#define X(C) if (C) *C = 0
|
|
|
|
#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
|
|
|
|
S(r, g, b, a);
|
|
|
|
S(r2, g2, b2, a2);
|
|
|
|
S(r3, g3, b3, a3);
|
|
|
|
#undef S
|
|
|
|
#undef X
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-16 18:41:25 -08:00
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2006-01-17 16:43:55 -08:00
|
|
|
_edje_recalc(ed);
|
2009-09-28 10:23:02 -07:00
|
|
|
_edje_emit(ed, "color_class,del", color_class);
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2011-09-10 16:56:50 -07:00
|
|
|
if (!_edje_color_class_member_hash) return NULL;
|
2011-09-10 13:39:24 -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
|
2009-08-24 09:40:42 -07:00
|
|
|
_edje_color_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, 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
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!color_class)) return EINA_FALSE;
|
2010-01-21 00:08:02 -08:00
|
|
|
if (r < 0) r = 0;
|
|
|
|
else if (r > 255) r = 255;
|
|
|
|
if (g < 0) g = 0;
|
|
|
|
else if (g > 255) g = 255;
|
|
|
|
if (b < 0) b = 0;
|
|
|
|
else if (b > 255) b = 255;
|
|
|
|
if (a < 0) a = 0;
|
|
|
|
else if (a > 255) a = 255;
|
2010-03-06 20:50:12 -08:00
|
|
|
color_class = eina_stringshare_add(color_class);
|
|
|
|
if (!color_class) return EINA_FALSE;
|
2008-10-22 04:34:42 -07:00
|
|
|
EINA_LIST_FOREACH(ed->color_classes, l, cc)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2010-03-06 20:50:12 -08:00
|
|
|
if (cc->name == color_class)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2010-03-06 20:50:12 -08:00
|
|
|
eina_stringshare_del(color_class);
|
|
|
|
|
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))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 19:06:46 -07:00
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2003-07-12 19:06:46 -07:00
|
|
|
_edje_recalc(ed);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
}
|
2003-10-29 20:45:18 -08:00
|
|
|
cc = malloc(sizeof(Edje_Color_Class));
|
2010-03-06 20:50:12 -08:00
|
|
|
if (!cc)
|
2003-07-12 19:06:46 -07:00
|
|
|
{
|
2010-03-06 20:50:12 -08:00
|
|
|
eina_stringshare_del(color_class);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
2010-03-06 20:50:12 -08:00
|
|
|
cc->name = color_class;
|
2003-07-12 19:06:46 -07:00
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
2010-07-02 11:17:37 -07:00
|
|
|
edje_object_color_class_set(rp->swallowed_object, color_class,
|
|
|
|
r, g, b, a, r2, g2, b2, a2, r3, g3, b3,
|
2009-08-07 02:06:04 -07:00
|
|
|
a3);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
2003-07-12 19:06:46 -07:00
|
|
|
_edje_recalc(ed);
|
2009-09-28 10:23:02 -07:00
|
|
|
_edje_emit(ed, "color_class,set", color_class);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2009-09-28 10:23:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_color_class_get(const 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 = _edje_fetch(obj);
|
|
|
|
Edje_Color_Class *cc = _edje_color_class_find(ed, color_class);
|
|
|
|
|
|
|
|
if (cc)
|
|
|
|
{
|
|
|
|
#define X(C) if (C) *C = cc->C
|
|
|
|
#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
|
|
|
|
S(r, g, b, a);
|
|
|
|
S(r2, g2, b2, a2);
|
|
|
|
S(r3, g3, b3, a3);
|
|
|
|
#undef S
|
|
|
|
#undef X
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#define X(C) if (C) *C = 0
|
|
|
|
#define S(_r, _g, _b, _a) X(_r); X(_g); X(_b); X(_a)
|
|
|
|
S(r, g, b, a);
|
|
|
|
S(r2, g2, b2, a2);
|
|
|
|
S(r3, g3, b3, a3);
|
|
|
|
#undef S
|
|
|
|
#undef X
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
|
2006-01-16 18:41:25 -08:00
|
|
|
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;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned 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);
|
2011-08-02 12:41:43 -07:00
|
|
|
break;
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
}
|
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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2006-01-17 17:01:05 -08:00
|
|
|
_edje_recalc(ed);
|
2009-09-28 10:23:02 -07:00
|
|
|
_edje_emit(ed, "color_class,del", color_class);
|
2006-01-16 18:41:25 -08:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!text_class) return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
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));
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!tc) return EINA_FALSE;
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
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)))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
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);
|
2010-02-25 22:01:09 -08:00
|
|
|
return EINA_FALSE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2006-03-27 23:45:54 -08:00
|
|
|
_edje_textblock_style_all_update(ed);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->text_part_change = 1;
|
|
|
|
#endif
|
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
|
|
|
}
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-11-03 22:15:19 -08:00
|
|
|
}
|
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
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);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->text_part_change = 1;
|
|
|
|
#endif
|
2006-12-24 02:29:16 -08:00
|
|
|
_edje_recalc(ed);
|
2008-10-22 04:34:42 -07:00
|
|
|
members = eina_list_next(members);
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
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
|
2009-08-24 09:40:42 -07:00
|
|
|
_edje_text_class_list_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data __UNUSED__, 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
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2003-07-12 19:06:46 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!text_class)) return EINA_FALSE;
|
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))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* No font but size is the same, return */
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!tc->font) && (!font) && (tc->size == size)) return EINA_TRUE;
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->text_part_change = 1;
|
|
|
|
#endif
|
2003-07-12 19:06:46 -07:00
|
|
|
_edje_recalc(ed);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
}
|
2006-03-18 20:22:35 -08:00
|
|
|
|
|
|
|
/* No matches, create a new text class */
|
|
|
|
tc = calloc(1, sizeof(Edje_Text_Class));
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!tc) return EINA_FALSE;
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = ed->table_parts[i];
|
|
|
|
if (rp->part->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object)
|
2010-07-02 11:17:37 -07:00
|
|
|
edje_object_text_class_set(rp->swallowed_object, text_class,
|
2009-08-07 02:06:04 -07:00
|
|
|
font, size);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->text_part_change = 1;
|
|
|
|
#endif
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
return EINA_TRUE;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
if (x) *x = rp->x;
|
|
|
|
if (y) *y = rp->y;
|
|
|
|
if (w) *w = rp->w;
|
|
|
|
if (h) *h = rp->h;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
|
2010-05-28 23:40:56 -07:00
|
|
|
EAPI void
|
2010-10-01 20:34:00 -07:00
|
|
|
edje_object_item_provider_set(Evas_Object *obj, Edje_Item_Provider_Cb func, void *data)
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return;
|
|
|
|
ed->item_provider.func = func;
|
|
|
|
ed->item_provider.data = data;
|
|
|
|
}
|
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXDOC: New Function */
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2010-10-01 20:34:00 -07:00
|
|
|
edje_object_text_change_cb_set(Evas_Object *obj, Edje_Text_Change_Cb func, void *data)
|
2004-06-03 02:14:55 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned 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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = ed->table_parts[i];
|
2010-10-01 20:34:00 -07:00
|
|
|
if ((rp->part->type == EDJE_PART_TYPE_GROUP) && (rp->swallowed_object))
|
|
|
|
edje_object_text_change_cb_set(rp->swallowed_object, func, data);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2004-06-03 02:14:55 -07:00
|
|
|
}
|
|
|
|
|
2010-03-26 18:26:10 -07:00
|
|
|
Eina_Bool
|
2009-04-14 16:53:25 -07:00
|
|
|
_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))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
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)))
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2007-05-26 22:28:07 -07:00
|
|
|
_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);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-07-12 23:19:09 -07:00
|
|
|
}
|
|
|
|
|
2011-06-09 01:08:43 -07:00
|
|
|
Eina_Bool
|
|
|
|
_edje_object_part_text_raw_append(Evas_Object *obj, Edje_Real_Part *rp, const char *part, const char *text)
|
|
|
|
{
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
_edje_entry_text_markup_append(rp, text);
|
|
|
|
else if (text)
|
|
|
|
{
|
|
|
|
if (rp->text.text)
|
|
|
|
{
|
|
|
|
char *new = NULL;
|
|
|
|
int len_added = strlen(text);
|
|
|
|
int len_old = strlen(rp->text.text);
|
|
|
|
new = malloc(len_old + len_added + 1);
|
|
|
|
memcpy(new, rp->text.text, len_old);
|
|
|
|
memcpy(new + len_old, text, len_added);
|
|
|
|
new[len_old + len_added] = '\0';
|
|
|
|
eina_stringshare_replace(&rp->text.text, new);
|
|
|
|
free(new);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_stringshare_replace(&rp->text.text, text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2011-06-09 01:08:43 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
if (rp->edje->text_change.func)
|
|
|
|
rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2009-04-14 16:53:25 -07:00
|
|
|
edje_object_part_text_set(Evas_Object *obj, const char *part, const char *text)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-04-14 16:53:25 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-04-14 16:53:25 -07:00
|
|
|
if ((rp->part->type != EDJE_PART_TYPE_TEXT) &&
|
2010-01-14 10:07:24 -08:00
|
|
|
(rp->part->type != EDJE_PART_TYPE_TEXTBLOCK)) return EINA_FALSE;
|
|
|
|
return _edje_object_part_text_raw_set(obj, rp, part, text);
|
2009-04-14 16:53:25 -07:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2009-11-03 01:26:15 -08:00
|
|
|
|
2010-03-26 18:26:10 -07:00
|
|
|
char *
|
2009-04-14 16:53:25 -07:00
|
|
|
_edje_text_escape(const char *text)
|
|
|
|
{
|
2010-02-06 13:42:37 -08:00
|
|
|
Eina_Strbuf *txt;
|
2009-04-14 16:53:25 -07:00
|
|
|
char *ret;
|
|
|
|
const char *text_end;
|
2010-02-06 13:42:37 -08:00
|
|
|
size_t text_len;
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
if (!text) return NULL;
|
|
|
|
|
2010-02-06 13:42:37 -08:00
|
|
|
txt = eina_strbuf_new();
|
2009-04-14 16:53:25 -07:00
|
|
|
text_len = strlen(text);
|
|
|
|
|
|
|
|
text_end = text + text_len;
|
|
|
|
while (text < text_end)
|
|
|
|
{
|
2010-02-06 13:42:37 -08:00
|
|
|
int advance;
|
2009-04-14 16:53:25 -07:00
|
|
|
const char *escaped = evas_textblock_string_escape_get(text, &advance);
|
|
|
|
if (!escaped)
|
|
|
|
{
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_append_char(txt, text[0]);
|
2009-04-14 16:53:25 -07:00
|
|
|
advance = 1;
|
|
|
|
}
|
|
|
|
else
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_append(txt, escaped);
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
text += advance;
|
|
|
|
}
|
|
|
|
|
2010-02-09 13:06:27 -08:00
|
|
|
ret = eina_strbuf_string_steal(txt);
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_free(txt);
|
2009-04-14 16:53:25 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-03-26 18:26:10 -07:00
|
|
|
char *
|
2009-04-14 16:53:25 -07:00
|
|
|
_edje_text_unescape(const char *text)
|
|
|
|
{
|
2010-02-06 13:42:37 -08:00
|
|
|
Eina_Strbuf *txt;
|
2009-04-14 16:53:25 -07:00
|
|
|
char *ret;
|
|
|
|
const char *text_end, *last, *escape_start;
|
2010-02-06 13:42:37 -08:00
|
|
|
size_t text_len;
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
if (!text) return NULL;
|
|
|
|
|
2010-02-06 13:42:37 -08:00
|
|
|
txt = eina_strbuf_new();
|
2009-04-14 16:53:25 -07:00
|
|
|
text_len = strlen(text);
|
|
|
|
|
|
|
|
text_end = text + text_len;
|
|
|
|
last = text;
|
|
|
|
escape_start = NULL;
|
|
|
|
for (; text < text_end; text++)
|
|
|
|
{
|
|
|
|
if (*text == '&')
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
const char *str;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2009-04-14 16:53:25 -07:00
|
|
|
if (last)
|
|
|
|
{
|
|
|
|
len = text - last;
|
|
|
|
str = last;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = text - escape_start;
|
|
|
|
str = escape_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (len > 0)
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_append_n(txt, str, len);
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
escape_start = text;
|
|
|
|
last = NULL;
|
|
|
|
}
|
|
|
|
else if ((*text == ';') && (escape_start))
|
|
|
|
{
|
|
|
|
size_t len;
|
2010-02-06 13:42:37 -08:00
|
|
|
const char *str = evas_textblock_escape_string_range_get(escape_start, text);
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2009-04-14 16:53:25 -07:00
|
|
|
if (str)
|
|
|
|
len = strlen(str);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = escape_start;
|
|
|
|
len = text + 1 - escape_start;
|
|
|
|
}
|
|
|
|
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_append_n(txt, str, len);
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
escape_start = NULL;
|
|
|
|
last = text + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!last && escape_start)
|
|
|
|
last = escape_start;
|
|
|
|
|
|
|
|
if (last && (text > last))
|
|
|
|
{
|
|
|
|
size_t len = text - last;
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_append_n(txt, last, len);
|
2009-04-14 16:53:25 -07:00
|
|
|
}
|
|
|
|
|
2010-02-09 13:06:27 -08:00
|
|
|
ret = eina_strbuf_string_steal(txt);
|
2010-02-06 13:42:37 -08:00
|
|
|
eina_strbuf_free(txt);
|
2009-04-14 16:53:25 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
2009-04-14 16:53:25 -07:00
|
|
|
edje_object_part_text_unescaped_set(Evas_Object *obj, const char *part, const char *text_to_escape)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
2010-01-14 10:07:24 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2009-04-14 16:53:25 -07:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return ret;
|
2009-04-14 16:53:25 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return ret;
|
2009-04-14 16:53:25 -07:00
|
|
|
if (rp->part->type == EDJE_PART_TYPE_TEXT)
|
2010-01-14 10:07:24 -08:00
|
|
|
ret = _edje_object_part_text_raw_set(obj, rp, part, text_to_escape);
|
2009-04-14 16:53:25 -07:00
|
|
|
else if (rp->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
char *text = _edje_text_escape(text_to_escape);
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
ret = _edje_object_part_text_raw_set(obj, rp, part, text);
|
2009-04-14 16:53:25 -07:00
|
|
|
free(text);
|
|
|
|
}
|
2010-01-14 10:07:24 -08:00
|
|
|
return ret;
|
2009-04-14 16:53:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:44 -07:00
|
|
|
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
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
2011-05-15 08:57:38 -07:00
|
|
|
#endif
|
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
if (rp->edje->text_change.func)
|
|
|
|
rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_append(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;
|
2011-06-09 01:08:43 -07:00
|
|
|
_edje_object_part_text_raw_append(obj, rp, part, text);
|
2011-05-15 08:57:38 -07:00
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2011-05-15 08:57:38 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#endif
|
2008-10-16 02:17:44 -07:00
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
if (rp->edje->text_change.func)
|
|
|
|
rp->edje->text_change.func(rp->edje->text_change.data, obj, part);
|
|
|
|
}
|
|
|
|
|
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-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;
|
|
|
|
}
|
|
|
|
|
2010-04-26 07:55:45 -07:00
|
|
|
EAPI const Eina_List *
|
|
|
|
edje_object_part_text_item_list_get(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return NULL;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
return _edje_entry_items_list(rp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part, const char *item, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2010-04-26 07:55:45 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2010-04-26 07:55:45 -07:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
return _edje_entry_item_geometry_get(rp, item, cx, cy, cw, ch);
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2010-04-26 07:55:45 -07:00
|
|
|
}
|
|
|
|
|
2008-10-16 23:40:46 -07:00
|
|
|
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-19 06:36:10 -07:00
|
|
|
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
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-03-10 22:34:20 -08:00
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_select_begin(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_begin(rp);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_select_extend(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_extend(rp);
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
EAPI Eina_Bool
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_next(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_next(rp, cur);
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_prev(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_prev(rp, cur);
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_up(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_up(rp, cur);
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_down(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_down(rp, cur);
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08: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_cursor_begin(rp, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08: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_cursor_end(rp, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_copy(Evas_Object *obj, const char *part, Edje_Cursor src, Edje_Cursor dst)
|
2009-12-01 03:02:46 -08: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_cursor_copy(rp, src, dst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_line_begin_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08: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_cursor_line_begin(rp, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-09-06 23:56:16 -07:00
|
|
|
edje_object_part_text_cursor_line_end_set(Evas_Object *obj, const char *part, Edje_Cursor cur)
|
2009-12-01 03:02:46 -08: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_cursor_line_end(rp, cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-06 23:56:16 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_text_cursor_coord_set(Evas_Object *obj, const char *part,
|
|
|
|
Edje_Cursor cur, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_coord_set(rp, cur, x, y);
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_text_cursor_is_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
2010-06-05 06:07:08 -07:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_is_format_get(rp, cur);
|
|
|
|
}
|
2010-06-05 06:07:08 -07:00
|
|
|
return EINA_FALSE;
|
2009-12-01 03:02:46 -08:00
|
|
|
}
|
2011-04-08 00:45:46 -07:00
|
|
|
|
2009-12-01 03:02:46 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_text_cursor_is_visible_format_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return 0;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return 0;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_is_visible_format_get(rp, cur);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-02 03:32:06 -08:00
|
|
|
EAPI char *
|
2009-12-01 03:02:46 -08:00
|
|
|
edje_object_part_text_cursor_content_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
2010-09-06 23:56:16 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
2009-12-01 03:02:46 -08:00
|
|
|
if (!rp) return NULL;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_content_get(rp, cur);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-27 02:25:22 -08:00
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_cursor_pos_set(Evas_Object *obj, const char *part, Edje_Cursor cur, int pos)
|
|
|
|
{
|
|
|
|
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->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
_edje_entry_cursor_pos_set(rp, cur, pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI int
|
|
|
|
edje_object_part_text_cursor_pos_get(const Evas_Object *obj, const char *part, Edje_Cursor cur)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return 0;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return 0;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_cursor_pos_get(rp, cur);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-25 00:25:37 -07:00
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_input_panel_layout_set(const Evas_Object *obj, const char *part, Edje_Input_Panel_Layout layout)
|
|
|
|
{
|
|
|
|
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->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_input_panel_layout_set(rp, layout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Edje_Input_Panel_Layout
|
|
|
|
edje_object_part_text_input_panel_layout_get(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_input_panel_layout_get(rp);
|
|
|
|
}
|
|
|
|
return EDJE_INPUT_PANEL_LAYOUT_INVALID;
|
|
|
|
}
|
|
|
|
|
2011-10-26 22:42:41 -07:00
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_autocapital_type_set(const Evas_Object *obj, const char *part, Edje_Text_Autocapital_Type autocapital_type)
|
|
|
|
{
|
|
|
|
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_autocapital_type_set(rp, autocapital_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Edje_Text_Autocapital_Type
|
|
|
|
edje_object_part_text_autocapital_type_get(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
|
|
|
if (!rp) return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_autocapital_type_get(rp);
|
|
|
|
}
|
|
|
|
return EDJE_TEXT_AUTOCAPITAL_TYPE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_object_part_text_input_panel_enabled_set(const Evas_Object *obj, const char *part, Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
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->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_input_panel_enabled_set(rp, enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_part_text_input_panel_enabled_get(const Evas_Object *obj, const char *part)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
|
|
|
rp = _edje_real_part_recursive_get(ed, part);
|
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
|
|
|
|
{
|
|
|
|
return _edje_entry_input_panel_enabled_get(rp);
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-05-28 23:40:56 -07:00
|
|
|
EAPI void
|
2010-10-01 20:34:00 -07:00
|
|
|
edje_object_text_insert_filter_callback_add(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data)
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return;
|
|
|
|
cb = calloc(1, sizeof(Edje_Text_Insert_Filter_Callback));
|
|
|
|
cb->part = eina_stringshare_add(part);
|
|
|
|
cb->func = func;
|
2010-10-01 20:34:00 -07:00
|
|
|
cb->data = (void *)data;
|
2010-07-02 11:17:37 -07:00
|
|
|
ed->text_insert_filter_callbacks =
|
2010-05-28 23:40:56 -07:00
|
|
|
eina_list_append(ed->text_insert_filter_callbacks, cb);
|
|
|
|
}
|
|
|
|
|
2010-10-01 20:34:00 -07:00
|
|
|
EAPI void *
|
|
|
|
edje_object_text_insert_filter_callback_del(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func)
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-05-28 23:40:56 -07:00
|
|
|
ed = _edje_fetch(obj);
|
2010-10-01 20:34:00 -07:00
|
|
|
if ((!ed) || (!part)) return NULL;
|
2010-05-28 23:40:56 -07:00
|
|
|
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
|
|
|
|
{
|
2010-10-01 20:34:00 -07:00
|
|
|
if ((!strcmp(cb->part, part)) && (cb->func == func))
|
2010-05-28 23:40:56 -07:00
|
|
|
{
|
2010-10-01 20:34:00 -07:00
|
|
|
void *data = cb->data;
|
2010-07-02 11:17:37 -07:00
|
|
|
ed->text_insert_filter_callbacks =
|
2010-10-01 20:34:00 -07:00
|
|
|
eina_list_remove_list(ed->text_insert_filter_callbacks, l);
|
2010-05-28 23:40:56 -07:00
|
|
|
eina_stringshare_del(cb->part);
|
|
|
|
free(cb);
|
2010-10-01 20:34:00 -07:00
|
|
|
return data;
|
2010-10-29 11:15:09 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
|
|
|
edje_object_text_insert_filter_callback_del_full(Evas_Object *obj, const char *part, Edje_Text_Filter_Cb func, void *data)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
Edje_Text_Insert_Filter_Callback *cb;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if ((!ed) || (!part)) return NULL;
|
|
|
|
EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb)
|
|
|
|
{
|
|
|
|
if ((!strcmp(cb->part, part)) && (cb->func == func) &&
|
|
|
|
(cb->data == data))
|
|
|
|
{
|
2011-06-23 02:55:57 -07:00
|
|
|
void *tmp = cb->data;
|
2010-10-29 11:15:09 -07:00
|
|
|
ed->text_insert_filter_callbacks =
|
|
|
|
eina_list_remove_list(ed->text_insert_filter_callbacks, l);
|
|
|
|
eina_stringshare_del(cb->part);
|
|
|
|
free(cb);
|
2011-06-23 02:55:57 -07:00
|
|
|
return tmp;
|
2010-05-28 23:40:56 -07:00
|
|
|
}
|
|
|
|
}
|
2010-10-01 20:34:00 -07:00
|
|
|
return NULL;
|
2010-05-28 23:40:56 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
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
|
|
|
|
2012-01-06 02:07:45 -08:00
|
|
|
rp = evas_object_data_get(obj_swallow, "\377 edje.swallowing_part");
|
|
|
|
if (rp)
|
|
|
|
{
|
|
|
|
/* The object is already swallowed somewhere, unswallow it first */
|
|
|
|
edje_object_part_unswallow(rp->edje->obj, obj_swallow);
|
|
|
|
}
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
2009-12-02 13:16:42 -08:00
|
|
|
if (rp->part->type != EDJE_PART_TYPE_SWALLOW)
|
|
|
|
{
|
2011-10-26 12:49:09 -07:00
|
|
|
ERR("cannot swallow part %s: not swallow type!", rp->part->name);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2009-12-02 13:16:42 -08:00
|
|
|
}
|
2011-06-07 00:43:32 -07:00
|
|
|
_edje_real_part_swallow(rp, obj_swallow, EINA_TRUE);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1; // ZZZ: ???
|
2007-04-04 05:46:44 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
for (; (base->name) && (base->name[0] == name[0]); base++)
|
2008-11-23 21:15:15 -08:00
|
|
|
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_RIGHT;
|
2010-02-24 06:50:07 -08:00
|
|
|
else
|
|
|
|
return EINA_RBTREE_LEFT;
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-08-17 05:15:04 -07:00
|
|
|
static void
|
2008-11-23 21:15:15 -08:00
|
|
|
_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;
|
2010-12-13 22:19:30 -08:00
|
|
|
size_t name_len;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
name_len = strlen(name) + 1;
|
|
|
|
l = malloc(sizeof(Edje_Box_Layout) + name_len);
|
2011-12-08 08:21:49 -08:00
|
|
|
if (!l) return NULL;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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))
|
|
|
|
{
|
2009-12-22 05:46:00 -08:00
|
|
|
ERR("Cannot register layout '%s': would override builtin!",
|
|
|
|
name);
|
2008-11-23 21:15:15 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-07 00:54:30 -08:00
|
|
|
EAPI void
|
2009-08-24 09:40:42 -07:00
|
|
|
edje_object_part_unswallow(Evas_Object *obj __UNUSED__, Evas_Object *obj_swallow)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
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");
|
2009-12-02 13:16:42 -08:00
|
|
|
if (!rp)
|
|
|
|
return;
|
|
|
|
if (rp->part->type != EDJE_PART_TYPE_SWALLOW)
|
|
|
|
{
|
2010-03-25 10:30:59 -07:00
|
|
|
ERR("cannot unswallow part %s: not swallow type!", rp->part->name);
|
2009-12-02 13:16:42 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (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);
|
2009-10-26 00:28:51 -07:00
|
|
|
evas_object_event_callback_del_full(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_FREE,
|
|
|
|
_edje_object_part_swallow_free_cb,
|
|
|
|
rp->edje->obj);
|
|
|
|
evas_object_event_callback_del_full(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_edje_object_part_swallow_changed_hints_cb,
|
2009-10-26 02:29:55 -07:00
|
|
|
rp);
|
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)
|
2010-02-23 05:39:19 -08:00
|
|
|
_edje_callbacks_del(rp->swallowed_object, rp->edje);
|
|
|
|
_edje_callbacks_focus_del(rp->swallowed_object, rp->edje);
|
2007-05-26 22:28:07 -07:00
|
|
|
|
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
|
|
|
|
2008-09-09 23:39:57 -07:00
|
|
|
pf2 = _edje_freeze_val;
|
2004-11-28 06:52:01 -08:00
|
|
|
pf = ed->freeze;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2008-09-09 23:39:57 -07:00
|
|
|
_edje_freeze_val = 0;
|
2004-11-28 06:52:01 -08:00
|
|
|
ed->freeze = 0;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2008-11-14 03:06:15 -08:00
|
|
|
_edje_recalc_do(ed);
|
2010-07-02 11:17:37 -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
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2010-03-04 12:40:54 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_parts_extends_calc(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2012-01-19 00:17:14 -08:00
|
|
|
Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX;
|
|
|
|
Evas_Coord xx2 = 0, yy2 = 0;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2010-03-04 12:40:54 -08:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed)
|
|
|
|
{
|
|
|
|
if (x) *x = 0;
|
|
|
|
if (y) *y = 0;
|
|
|
|
if (w) *w = 0;
|
|
|
|
if (h) *h = 0;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ed->calc_only = 1;
|
|
|
|
|
|
|
|
/* Need to recalc before providing the object. */
|
|
|
|
ed->dirty = 1;
|
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Evas_Coord rpx1, rpy1;
|
|
|
|
Evas_Coord rpx2, rpy2;
|
|
|
|
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
|
|
|
|
rpx1 = rp->x;
|
|
|
|
rpy1 = rp->y;
|
|
|
|
rpx2 = rpx1 + rp->w;
|
|
|
|
rpy2 = rpy1 + rp->h;
|
|
|
|
|
2012-01-19 00:17:14 -08:00
|
|
|
if (xx1 > rpx1) xx1 = rpx1;
|
|
|
|
if (yy1 > rpy1) yy1 = rpy1;
|
|
|
|
if (xx2 < rpx2) xx2 = rpx2;
|
|
|
|
if (yy2 < rpy2) yy2 = rpy2;
|
2010-03-04 12:40:54 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ed->calc_only = 0;
|
|
|
|
|
2012-01-19 00:17:14 -08:00
|
|
|
if (x) *x = xx1;
|
|
|
|
if (y) *y = yy1;
|
|
|
|
if (w) *w = xx2 - xx1;
|
|
|
|
if (h) *h = yy2 - yy1;
|
2010-03-04 12:40:54 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-04-17 03:22:57 -07:00
|
|
|
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;
|
2011-05-16 07:09:08 -07:00
|
|
|
int okw, okh;
|
2005-09-18 23:51:49 -07:00
|
|
|
int reset_maxwh;
|
|
|
|
Edje_Real_Part *pep = NULL;
|
2011-05-02 03:20:20 -07:00
|
|
|
Eina_Bool has_non_fixed_tb = EINA_FALSE;
|
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
|
|
|
|
2011-05-16 07:09:08 -07:00
|
|
|
do
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2007-09-08 11:31:56 -07:00
|
|
|
|
2011-05-16 07:09:08 -07:00
|
|
|
okw = okh = 0;
|
2003-07-15 01:26:06 -07:00
|
|
|
ed->dirty = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
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;
|
2009-10-07 04:36:23 -07:00
|
|
|
if (ep->chosen_description)
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!ep->chosen_description->fixed.w)
|
2005-09-18 23:51:49 -07:00
|
|
|
{
|
2011-04-28 08:29:50 -07:00
|
|
|
if ((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK))
|
|
|
|
{
|
|
|
|
Evas_Coord tb_mw;
|
|
|
|
evas_object_textblock_size_formatted_get(ep->object,
|
|
|
|
&tb_mw, NULL);
|
|
|
|
tb_mw -= ep->req.w;
|
|
|
|
if (tb_mw > w)
|
|
|
|
{
|
|
|
|
w = tb_mw;
|
|
|
|
}
|
2011-05-02 03:20:20 -07:00
|
|
|
has_non_fixed_tb = EINA_TRUE;
|
2011-04-28 08:29:50 -07:00
|
|
|
}
|
2009-10-07 04:36:23 -07:00
|
|
|
if (w > maxw)
|
2005-09-19 22:49:22 -07:00
|
|
|
{
|
2009-10-07 04:36:23 -07:00
|
|
|
maxw = w;
|
2011-05-16 07:09:08 -07:00
|
|
|
okw = 1;
|
2005-09-19 22:49:22 -07:00
|
|
|
pep = ep;
|
2009-10-07 04:36:23 -07:00
|
|
|
didw = 1;
|
|
|
|
}
|
|
|
|
}
|
2010-07-29 05:02:36 -07:00
|
|
|
if (!ep->chosen_description->fixed.h)
|
2009-10-07 04:36:23 -07:00
|
|
|
{
|
|
|
|
if (!((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
|
2010-07-29 05:02:36 -07:00
|
|
|
(!((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x) &&
|
2009-10-07 04:36:23 -07:00
|
|
|
(didw)))
|
|
|
|
{
|
|
|
|
if (h > maxh)
|
|
|
|
{
|
|
|
|
maxh = h;
|
2011-05-16 07:09:08 -07:00
|
|
|
okh = 1;
|
2009-10-07 04:36:23 -07:00
|
|
|
pep = ep;
|
|
|
|
}
|
2005-09-19 22:49:22 -07:00
|
|
|
}
|
2011-06-13 02:31:58 -07:00
|
|
|
|
|
|
|
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
|
|
|
|
{
|
|
|
|
has_non_fixed_tb = EINA_TRUE;
|
|
|
|
}
|
2005-09-18 23:51:49 -07:00
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
|
|
|
}
|
2011-05-16 07:09:08 -07:00
|
|
|
if (okw)
|
2003-07-15 01:26:06 -07:00
|
|
|
{
|
|
|
|
ed->w += maxw;
|
2008-04-17 03:22:57 -07:00
|
|
|
if (ed->w < restrictedw) ed->w = restrictedw;
|
2011-05-16 07:09:08 -07:00
|
|
|
}
|
|
|
|
if (okh)
|
|
|
|
{
|
|
|
|
ed->h += maxh;
|
2008-04-17 03:22:57 -07:00
|
|
|
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
|
|
|
{
|
2011-05-02 03:20:20 -07:00
|
|
|
/* Only print it if we have a non-fixed textblock.
|
|
|
|
* We should possibly avoid all of this if in this case, but in
|
|
|
|
* the meanwhile, just doing this. */
|
|
|
|
if (!has_non_fixed_tb)
|
|
|
|
{
|
|
|
|
if (pep)
|
|
|
|
ERR("file %s, group %s has a non-fixed part '%s'. Adding 'fixed: 1 1;' to source EDC may help. Continuing discarding faulty part.",
|
|
|
|
ed->path, ed->group, pep->part->name);
|
|
|
|
else
|
|
|
|
ERR("file %s, group %s overflowed 4000x4000 with minimum size of %dx%d. Continuing discarding faulty parts.",
|
|
|
|
ed->path, ed->group, ed->w, ed->h);
|
|
|
|
}
|
2010-10-07 17:24:22 -07:00
|
|
|
|
2005-09-18 23:51:49 -07:00
|
|
|
if (reset_maxwh)
|
|
|
|
{
|
|
|
|
reset_maxwh = 0;
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
}
|
2003-07-15 01:26:06 -07:00
|
|
|
}
|
2011-05-16 07:09:08 -07:00
|
|
|
while (okw || okh);
|
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;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
ed->all_part_change = 1;
|
|
|
|
#endif
|
2003-07-15 01:26:06 -07:00
|
|
|
_edje_recalc(ed);
|
|
|
|
ed->calc_only = 0;
|
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* 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;
|
2009-12-22 05:46:00 -08:00
|
|
|
INF("part not found");
|
2003-07-16 06:50:28 -07:00
|
|
|
return "";
|
|
|
|
}
|
2009-10-07 04:36:23 -07:00
|
|
|
if (rp->chosen_description)
|
2003-07-16 06:50:28 -07:00
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (val_ret) *val_ret = rp->chosen_description->state.value;
|
|
|
|
if (rp->chosen_description->state.name)
|
|
|
|
return rp->chosen_description->state.name;
|
2003-07-16 06:50:28 -07:00
|
|
|
return "default";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rp->param1.description)
|
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
if (val_ret) *val_ret = rp->param1.description->state.value;
|
|
|
|
if (rp->param1.description->state.name)
|
|
|
|
return rp->param1.description->state.name;
|
2003-07-16 06:50:28 -07:00
|
|
|
return "default";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (val_ret) *val_ret = 0;
|
|
|
|
return "";
|
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2010-09-22 06:35:47 -07:00
|
|
|
EAPI Edje_Drag_Dir
|
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;
|
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
|
|
|
if (rp->drag->down.count > 0) return EINA_FALSE;
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((rp->drag->val.x == FROM_DOUBLE(dx)) && (rp->drag->val.y == FROM_DOUBLE(dy))) return EINA_TRUE;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->val.x = FROM_DOUBLE(dx);
|
|
|
|
rp->drag->val.y = FROM_DOUBLE(dy);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-12-09 07:44:54 -08:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_emit(rp->edje, "drag,set", rp->part->name);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2005-09-20 20:11:31 -07:00
|
|
|
|
2004-06-05 21:42:17 -07:00
|
|
|
/* FIXME: Should this be x and y instead of dx/dy? */
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
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);
|
2009-08-11 05:47:00 -07:00
|
|
|
if (!rp || !rp->drag)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2009-12-09 07:44:54 -08:00
|
|
|
ddx = TO_DOUBLE(rp->drag->val.x);
|
|
|
|
ddy = TO_DOUBLE(rp->drag->val.y);
|
2003-08-31 19:53:08 -07:00
|
|
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((rp->drag->size.x == FROM_DOUBLE(dw)) && (rp->drag->size.y == FROM_DOUBLE(dh))) return EINA_TRUE;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->size.x = FROM_DOUBLE(dw);
|
|
|
|
rp->drag->size.y = FROM_DOUBLE(dh);
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_recalc(rp->edje);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
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);
|
2009-08-11 05:47:00 -07:00
|
|
|
if (!rp || !rp->drag)
|
2003-08-15 06:35:25 -07:00
|
|
|
{
|
|
|
|
if (dw) *dw = 0;
|
|
|
|
if (dh) *dh = 0;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2006-12-24 02:29:16 -08:00
|
|
|
}
|
2009-12-09 07:44:54 -08:00
|
|
|
if (dw) *dw = TO_DOUBLE(rp->drag->size.x);
|
|
|
|
if (dh) *dh = TO_DOUBLE(rp->drag->size.y);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-15 06:35:25 -07:00
|
|
|
}
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
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;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->step.x = FROM_DOUBLE(dx);
|
|
|
|
rp->drag->step.y = FROM_DOUBLE(dy);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
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);
|
2009-08-11 05:47:00 -07:00
|
|
|
if (!rp || !rp->drag)
|
2003-08-31 19:53:08 -07:00
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
2009-12-09 07:44:54 -08:00
|
|
|
if (dx) *dx = TO_DOUBLE(rp->drag->step.x);
|
|
|
|
if (dy) *dy = TO_DOUBLE(rp->drag->step.y);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
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;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->page.x = FROM_DOUBLE(dx);
|
|
|
|
rp->drag->page.y = FROM_DOUBLE(dy);
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
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);
|
2009-08-11 05:47:00 -07:00
|
|
|
if (!rp || !rp->drag)
|
2003-08-31 19:53:08 -07:00
|
|
|
{
|
|
|
|
if (dx) *dx = 0;
|
|
|
|
if (dy) *dy = 0;
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_FALSE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
2009-12-09 07:44:54 -08:00
|
|
|
if (dx) *dx = TO_DOUBLE(rp->drag->page.x);
|
|
|
|
if (dy) *dy = TO_DOUBLE(rp->drag->page.y);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T px, py;
|
2003-08-31 19:53:08 -07:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
|
|
|
if (rp->drag->down.count > 0) return EINA_FALSE;
|
2009-08-11 05:47:00 -07:00
|
|
|
px = rp->drag->val.x;
|
|
|
|
py = rp->drag->val.y;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->val.x = ADD(px, MUL(FROM_DOUBLE(dx),
|
|
|
|
MUL(rp->drag->step.x, rp->part->dragable.x)));
|
|
|
|
rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy),
|
|
|
|
MUL(rp->drag->step.y, rp->part->dragable.y)));
|
|
|
|
rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0));
|
|
|
|
rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0));
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) return EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-08-11 05:47:00 -07:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_emit(rp->edje, "drag,step", rp->part->name);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-01-14 10:07:24 -08:00
|
|
|
EAPI Eina_Bool
|
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;
|
2009-12-09 07:44:54 -08:00
|
|
|
FLOAT_T px, py;
|
2003-08-31 19:53:08 -07:00
|
|
|
|
2006-12-24 02:29:16 -08:00
|
|
|
ed = _edje_fetch(obj);
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((!ed) || (!part)) return EINA_FALSE;
|
2007-05-26 22:28:07 -07:00
|
|
|
rp = _edje_real_part_recursive_get(ed, (char *)part);
|
2010-01-14 10:07:24 -08:00
|
|
|
if (!rp) return EINA_FALSE;
|
|
|
|
if (!rp->drag) return EINA_FALSE;
|
|
|
|
if (rp->drag->down.count > 0) return EINA_FALSE;
|
2009-08-11 05:47:00 -07:00
|
|
|
px = rp->drag->val.x;
|
|
|
|
py = rp->drag->val.y;
|
2009-12-09 07:44:54 -08:00
|
|
|
rp->drag->val.x = ADD(px, MUL(FROM_DOUBLE(dx), MUL(rp->drag->page.x, rp->part->dragable.x)));
|
|
|
|
rp->drag->val.y = ADD(py, MUL(FROM_DOUBLE(dy), MUL(rp->drag->page.y, rp->part->dragable.y)));
|
|
|
|
rp->drag->val.x = CLAMP (rp->drag->val.x, ZERO, FROM_DOUBLE(1.0));
|
|
|
|
rp->drag->val.y = CLAMP (rp->drag->val.y, ZERO, FROM_DOUBLE(1.0));
|
2010-01-14 10:07:24 -08:00
|
|
|
if ((px == rp->drag->val.x) && (py == rp->drag->val.y)) return EINA_TRUE;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-08-11 05:47:00 -07:00
|
|
|
_edje_dragable_pos_set(rp->edje, rp, rp->drag->val.x, rp->drag->val.y);
|
2007-05-26 22:28:07 -07:00
|
|
|
_edje_emit(rp->edje, "drag,page", rp->part->name);
|
2010-01-14 10:07:24 -08:00
|
|
|
return EINA_TRUE;
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
void
|
|
|
|
_edje_box_init(void)
|
|
|
|
{
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2008-11-23 21:15:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_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
|
|
|
|
2010-09-28 17:28:54 -07:00
|
|
|
if (!_edje_box_layout_add_child(rp, child_obj))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(rp->object, child_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-09-28 17:28:54 -07:00
|
|
|
if (!_edje_box_layout_add_child(rp, child_obj))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(rp->object, child_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-09-28 17:28:54 -07:00
|
|
|
if (!_edje_box_layout_add_child(rp, child_obj))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(rp->object, child_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-09-28 17:28:54 -07:00
|
|
|
if (!_edje_box_layout_add_child(rp, child_obj))
|
|
|
|
{
|
|
|
|
evas_object_box_remove(rp->object, child_obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
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;
|
2010-09-28 17:28:54 -07:00
|
|
|
_edje_box_layout_remove_child(rp, child_obj);
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2010-09-28 17:28:54 -07:00
|
|
|
_edje_box_layout_remove_child(rp, child_obj);
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2009-08-07 02:06:04 -07:00
|
|
|
int i = 0;
|
2008-11-23 21:15:15 -08:00
|
|
|
|
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;
|
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
|
|
|
{
|
2010-09-28 17:28:54 -07:00
|
|
|
_edje_box_layout_remove_child(rp, child_obj);
|
2009-07-10 16:13:09 -07:00
|
|
|
_edje_box_child_remove(rp, child_obj);
|
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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2009-04-26 19:38:14 -07:00
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-08-10 08:16:51 -07:00
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-04-26 19:38:14 -07:00
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
}
|
|
|
|
|
2010-04-17 13:28:22 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
edje_object_part_table_child_get(Evas_Object *obj, const char *part, unsigned int col, unsigned int row)
|
|
|
|
{
|
|
|
|
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_TABLE) return NULL;
|
|
|
|
|
|
|
|
return evas_object_table_child_get(rp->object, col, row);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
static void
|
2010-06-24 09:16:50 -07:00
|
|
|
_edje_perspective_obj_del(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
|
2010-02-18 22:28:03 -08:00
|
|
|
{
|
2010-06-24 09:16:50 -07:00
|
|
|
Edje_Perspective *ps = data;
|
2010-02-18 22:28:03 -08:00
|
|
|
Evas_Object *o;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
EINA_LIST_FREE(ps->users, o)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(o);
|
|
|
|
if (!ed) continue;
|
|
|
|
ed->persp = NULL;
|
|
|
|
ed->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2010-02-18 22:28:03 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
|
|
|
free(ps);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Edje_Perspective *
|
|
|
|
edje_perspective_new(Evas *e)
|
|
|
|
{
|
|
|
|
Edje_Perspective *ps;
|
|
|
|
Evas_Coord vx, vy, vw, vh;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
if (!e) return NULL;
|
|
|
|
ps = calloc(1, sizeof(Edje_Perspective));
|
|
|
|
ps->obj = evas_object_rectangle_add(e);
|
|
|
|
evas_object_data_set(ps->obj, "_edje_perspective", ps);
|
|
|
|
evas_object_event_callback_add(ps->obj, EVAS_CALLBACK_DEL, _edje_perspective_obj_del, ps);
|
|
|
|
evas_output_viewport_get(e, &vx, &vy, &vw, &vh);
|
|
|
|
ps->e = e;
|
|
|
|
ps->px = vx + (vw / 2);
|
|
|
|
ps->py = vy + (vh / 2);
|
|
|
|
ps->z0 = 0;
|
|
|
|
ps->foc = 1000;
|
|
|
|
return ps;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_perspective_free(Edje_Perspective *ps)
|
|
|
|
{
|
|
|
|
if (!ps) return;
|
|
|
|
evas_object_del(ps->obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_perspective_set(Edje_Perspective *ps, Evas_Coord px, Evas_Coord py, Evas_Coord z0, Evas_Coord foc)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *o;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
if (!ps) return;
|
|
|
|
if ((ps->px == px) && (ps->py == py) && (ps->z0 == z0) && (ps->foc == foc)) return;
|
|
|
|
ps->px = px;
|
|
|
|
ps->py = py;
|
|
|
|
ps->z0 = z0;
|
|
|
|
ps->foc = foc;
|
|
|
|
EINA_LIST_FOREACH(ps->users, l, o)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(o);
|
|
|
|
if (!ed) continue;
|
|
|
|
if (!ed->persp)
|
|
|
|
{
|
|
|
|
ed->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2010-02-18 22:28:03 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ps->global)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, o)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(o);
|
|
|
|
if (!ed) continue;
|
|
|
|
if (!ed->persp)
|
|
|
|
{
|
|
|
|
ed->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2010-02-18 22:28:03 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_perspective_global_set(Edje_Perspective *ps, Eina_Bool global)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
Eina_List *l;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
if (!ps) return;
|
|
|
|
if (ps->global == global) return;
|
|
|
|
if (global)
|
|
|
|
{
|
2010-07-02 11:17:37 -07:00
|
|
|
o = evas_object_name_find(evas_object_evas_get(ps->obj),
|
2010-02-18 22:28:03 -08:00
|
|
|
"_edje_perspective");
|
|
|
|
if (o) evas_object_name_set(o, NULL);
|
|
|
|
evas_object_name_set(ps->obj, "_edje_perspective");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_name_set(ps->obj, NULL);
|
|
|
|
ps->global = global;
|
|
|
|
EINA_LIST_FOREACH(_edje_edjes, l, o)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(o);
|
|
|
|
if (!ed) continue;
|
|
|
|
if (!ed->persp)
|
|
|
|
{
|
|
|
|
ed->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2010-02-18 22:28:03 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_perspective_global_get(const Edje_Perspective *ps)
|
|
|
|
{
|
2010-06-05 06:07:08 -07:00
|
|
|
if (!ps) return EINA_FALSE;
|
2010-02-18 22:28:03 -08:00
|
|
|
return ps->global;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const Edje_Perspective *
|
|
|
|
edje_evas_global_perspective_get(const Evas *e)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
if (!e) return NULL;
|
|
|
|
obj = evas_object_name_find(e, "_edje_perspective");
|
|
|
|
if (!obj) return NULL;
|
|
|
|
return evas_object_data_get(obj, "_edje_perspective");
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
edje_object_perspective_set(Evas_Object *obj, Edje_Perspective *ps)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(obj);
|
|
|
|
if (!ed) return;
|
|
|
|
if (ed->persp == ps) return;
|
|
|
|
if (ed->persp != ps)
|
|
|
|
{
|
|
|
|
if (ed->persp)
|
|
|
|
ed->persp->users = eina_list_remove(ed->persp->users, obj);
|
|
|
|
}
|
|
|
|
ed->persp = ps;
|
|
|
|
if (ps) ps->users = eina_list_append(ps->users, obj);
|
|
|
|
ed->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
ed->recalc_call = 1;
|
2010-02-18 22:28:03 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI const Edje_Perspective *
|
|
|
|
edje_object_perspective_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2010-02-18 22:28:03 -08:00
|
|
|
ed = evas_object_smart_data_get(obj);
|
|
|
|
if (!ed) return NULL;
|
|
|
|
return ed->persp;
|
|
|
|
}
|
|
|
|
|
2009-12-04 08:20:40 -08:00
|
|
|
#define EDJE_PRELOAD_EMISSION "preload,done"
|
|
|
|
#define EDJE_PRELOAD_SOURCE NULL
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
edje_object_preload(Evas_Object *obj, Eina_Bool cancel)
|
|
|
|
{
|
|
|
|
Edje *ed;
|
|
|
|
int count;
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2009-12-04 08:20:40 -08:00
|
|
|
|
|
|
|
ed = _edje_fetch(obj);
|
|
|
|
if (!ed) return EINA_FALSE;
|
|
|
|
|
2009-12-14 09:20:44 -08:00
|
|
|
_edje_recalc_do(ed);
|
|
|
|
|
2009-12-04 08:20:40 -08:00
|
|
|
for (i = 0, count = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Edje_Part *ep;
|
|
|
|
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
ep = rp->part;
|
|
|
|
|
|
|
|
if (ep->type == EDJE_PART_TYPE_IMAGE ||
|
|
|
|
(ep->type == EDJE_PART_TYPE_GROUP && rp->swallowed_object))
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ed->preload_count = count;
|
|
|
|
|
|
|
|
if (count > 0)
|
|
|
|
{
|
|
|
|
for (i = 0; i < ed->table_parts_size; i++)
|
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
Edje_Part *ep;
|
|
|
|
|
|
|
|
rp = ed->table_parts[i];
|
|
|
|
ep = rp->part;
|
|
|
|
|
|
|
|
if (ep->type == EDJE_PART_TYPE_IMAGE)
|
|
|
|
{
|
2009-12-14 09:20:44 -08:00
|
|
|
const char *file = NULL;
|
|
|
|
const char *key = NULL;
|
|
|
|
|
2009-12-04 08:20:40 -08:00
|
|
|
evas_object_event_callback_del_full(rp->object, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
|
|
|
|
|
2009-12-14 09:20:44 -08:00
|
|
|
evas_object_image_file_get(rp->object, &file, &key);
|
|
|
|
if (!file && !key)
|
|
|
|
{
|
|
|
|
ed->preload_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_event_callback_add(rp->object, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
|
|
|
|
evas_object_image_preload(rp->object, cancel);
|
|
|
|
}
|
2009-12-04 08:20:40 -08:00
|
|
|
count--;
|
|
|
|
}
|
|
|
|
else if (ep->type == EDJE_PART_TYPE_GROUP)
|
|
|
|
{
|
|
|
|
if (rp->swallowed_object) {
|
|
|
|
edje_object_signal_callback_del(rp->swallowed_object, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb);
|
|
|
|
edje_object_signal_callback_add(rp->swallowed_object, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb, ed);
|
|
|
|
edje_object_preload(rp->swallowed_object, cancel);
|
|
|
|
|
|
|
|
count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_edje_emit(ed, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
{
|
2010-07-02 11:17:37 -07:00
|
|
|
Eina_Bool ret =
|
2009-08-07 02:06:04 -07:00
|
|
|
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-08-07 02:06:04 -07:00
|
|
|
|
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 *
|
2011-01-24 05:29:17 -08:00
|
|
|
_edje_real_part_recursive_get(const Edje *ed, const char *part)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
|
|
|
char **path;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2010-01-30 14:29:31 -08:00
|
|
|
path = eina_str_split(part, EDJE_PART_PATH_SEPARATOR_STRING, 0);
|
2007-05-26 22:28:07 -07:00
|
|
|
if (!path) return NULL;
|
|
|
|
|
|
|
|
rp = _edje_real_part_recursive_get_helper(ed, path);
|
|
|
|
|
|
|
|
free(*path);
|
|
|
|
free(path);
|
|
|
|
return rp;
|
2003-08-31 19:53:08 -07:00
|
|
|
}
|
|
|
|
|
2010-06-10 08:40:51 -07:00
|
|
|
Evas_Object *
|
|
|
|
_edje_children_get(Edje_Real_Part *rp, const char *partid)
|
|
|
|
{
|
|
|
|
Evas_Object *child;
|
|
|
|
Eina_List *l;
|
2010-08-02 16:35:30 -07:00
|
|
|
long int v;
|
|
|
|
char *p;
|
2010-06-10 08:40:51 -07:00
|
|
|
|
2010-08-02 16:35:30 -07:00
|
|
|
if (!partid) return NULL;
|
2010-06-10 08:40:51 -07:00
|
|
|
|
2010-08-02 16:35:30 -07:00
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
|
|
|
return _edje_external_content_get(rp->swallowed_object, partid);
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
l = evas_object_box_children_get(rp->object);
|
|
|
|
break;
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
|
|
|
l = evas_object_table_children_get(rp->object);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
v = strtol(partid, &p, 10);
|
|
|
|
if ((*p == '\0') && (v >= 0))
|
2010-06-10 08:40:51 -07:00
|
|
|
{
|
2010-08-02 16:35:30 -07:00
|
|
|
child = eina_list_nth(l, v);
|
2010-06-10 08:40:51 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-02 16:35:30 -07:00
|
|
|
Evas_Object *cur;
|
|
|
|
child = NULL;
|
|
|
|
EINA_LIST_FREE(l, cur)
|
|
|
|
{
|
|
|
|
const char *name = evas_object_name_get(cur);
|
|
|
|
if ((name) && (!strcmp(name, partid)))
|
|
|
|
{
|
|
|
|
child = cur;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-06-10 08:40:51 -07:00
|
|
|
}
|
2010-08-02 16:35:30 -07:00
|
|
|
eina_list_free(l);
|
2010-06-10 08:40:51 -07:00
|
|
|
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:27:15 -08:00
|
|
|
/* rebuild alternative path */
|
|
|
|
char *
|
|
|
|
_edje_merge_path(const char *alias, char * const *path)
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
unsigned int length = 1;
|
|
|
|
unsigned int alias_length;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (!alias) return NULL;
|
|
|
|
|
|
|
|
alias_length = strlen(alias);
|
|
|
|
|
|
|
|
for (i = 0; path[i]; i++)
|
|
|
|
length += strlen(path[i]) + 1;
|
|
|
|
|
|
|
|
tmp = malloc(sizeof (char) * (length + alias_length + 2));
|
|
|
|
memcpy(tmp, alias, alias_length);
|
|
|
|
tmp[alias_length] = '\0';
|
|
|
|
|
|
|
|
for (i = 0; path[i]; i++)
|
|
|
|
{
|
|
|
|
strcat(tmp, EDJE_PART_PATH_SEPARATOR_STRING);
|
|
|
|
strcat(tmp, path[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
Edje_Real_Part *
|
2011-01-24 05:29:17 -08:00
|
|
|
_edje_real_part_recursive_get_helper(const Edje *ed, char **path)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2010-06-10 08:40:51 -07:00
|
|
|
Evas_Object *child;
|
|
|
|
char *idx = NULL;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
2011-02-08 06:11:47 -08:00
|
|
|
if (!path[0])
|
|
|
|
return NULL;
|
|
|
|
|
2011-01-24 05:29:17 -08:00
|
|
|
if (ed->collection && ed->collection->alias)
|
2011-02-08 06:11:47 -08:00
|
|
|
{
|
2011-02-10 04:27:15 -08:00
|
|
|
char *alias;
|
|
|
|
|
|
|
|
alias = _edje_merge_path(eina_hash_find(ed->collection->alias, path[0]), path + 1);
|
|
|
|
if (alias) {
|
|
|
|
rp = _edje_real_part_recursive_get(ed, alias);
|
|
|
|
free(alias);
|
|
|
|
return rp;
|
|
|
|
}
|
2011-02-08 06:11:47 -08:00
|
|
|
}
|
2011-01-24 05:29:17 -08:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
//printf(" lookup: %s on %s\n", path[0], ed->parent ? ed->parent : "-");
|
2011-02-10 04:27:15 -08:00
|
|
|
idx = strchr(path[0], EDJE_PART_PATH_SEPARATOR_INDEXL);
|
2010-06-10 08:40:51 -07:00
|
|
|
if (idx)
|
|
|
|
{
|
|
|
|
char *end;
|
|
|
|
|
|
|
|
end = strchr(idx + 1, EDJE_PART_PATH_SEPARATOR_INDEXR);
|
|
|
|
if (end)
|
|
|
|
{
|
|
|
|
*end = '\0';
|
|
|
|
*idx = '\0';
|
|
|
|
idx++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-10 04:27:15 -08:00
|
|
|
rp = _edje_real_part_get(ed, path[0]);
|
|
|
|
if (!path[1] && !idx) return rp;
|
|
|
|
if (!rp) return NULL;
|
2010-06-10 08:40:51 -07:00
|
|
|
|
2010-05-01 10:13:38 -07:00
|
|
|
switch (rp->part->type)
|
|
|
|
{
|
|
|
|
case EDJE_PART_TYPE_GROUP:
|
2010-06-10 08:40:51 -07:00
|
|
|
if (!rp->swallowed_object) return NULL;
|
|
|
|
ed = _edje_fetch(rp->swallowed_object);
|
|
|
|
if (!ed) return NULL;
|
|
|
|
path++;
|
|
|
|
return _edje_real_part_recursive_get_helper(ed, path);
|
|
|
|
case EDJE_PART_TYPE_BOX:
|
|
|
|
case EDJE_PART_TYPE_TABLE:
|
2010-08-01 10:27:31 -07:00
|
|
|
case EDJE_PART_TYPE_EXTERNAL:
|
2010-06-10 08:40:51 -07:00
|
|
|
if (!idx) return rp;
|
|
|
|
path++;
|
|
|
|
|
|
|
|
child = _edje_children_get(rp, idx);
|
|
|
|
|
2011-02-10 04:27:15 -08:00
|
|
|
ed = _edje_fetch(child);
|
|
|
|
|
2010-06-10 08:40:51 -07:00
|
|
|
if (!ed) return NULL;
|
2011-01-24 05:29:17 -08:00
|
|
|
return _edje_real_part_recursive_get_helper(ed, path);
|
2010-05-01 10:13:38 -07:00
|
|
|
default:
|
2010-06-10 08:40:51 -07:00
|
|
|
return NULL;
|
2010-05-01 10:13:38 -07:00
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2004-03-30 02:30:35 -08:00
|
|
|
|
2011-01-21 18:36:57 -08:00
|
|
|
/* Private Routines */
|
2003-07-12 23:19:09 -07:00
|
|
|
Edje_Real_Part *
|
2011-01-24 05:29:17 -08:00
|
|
|
_edje_real_part_get(const Edje *ed, const char *part)
|
2003-07-12 23:19:09 -07:00
|
|
|
{
|
2010-08-12 05:58:54 -07:00
|
|
|
unsigned int i;
|
2003-07-12 23:19:09 -07:00
|
|
|
|
2010-08-11 05:51:39 -07:00
|
|
|
if (!part) return NULL;
|
|
|
|
|
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
|
|
|
{
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_member_add(ed, &ed->members.color_class, &_edje_color_class_member_hash, color_class);
|
|
|
|
}
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2011-06-23 02:55:57 -07:00
|
|
|
void
|
|
|
|
_edje_color_class_member_direct_del(const char *color_class, void *l)
|
|
|
|
{
|
|
|
|
_edje_class_member_direct_del(color_class, l, _edje_color_class_member_hash);
|
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
|
|
|
{
|
|
|
|
if ((!ed) || (!color_class)) return;
|
|
|
|
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_member_del(&ed->members.color_class, &_edje_color_class_member_hash, color_class);
|
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
|
2009-08-24 09:40:42 -07:00
|
|
|
color_class_hash_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
|
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
|
|
|
{
|
2010-07-29 05:02:36 -07:00
|
|
|
unsigned int i;
|
2003-11-03 22:15:19 -08:00
|
|
|
|
2010-07-29 05:02:36 -07:00
|
|
|
if ((ep->default_desc) && (ep->default_desc->color_class))
|
|
|
|
_edje_color_class_member_del(ed, ep->default_desc->color_class);
|
2006-03-18 20:22:35 -08:00
|
|
|
|
2010-08-09 10:34:03 -07:00
|
|
|
for (i = 0; i < ep->other.desc_count; ++i)
|
|
|
|
if (ep->other.desc[i]->color_class)
|
|
|
|
_edje_color_class_member_del(ed, ep->other.desc[i]->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
|
|
|
}
|
|
|
|
|
2011-06-22 02:47:16 -07:00
|
|
|
void
|
|
|
|
_edje_text_class_member_direct_del(const char *text_class,
|
2011-06-22 07:51:53 -07:00
|
|
|
void *l)
|
2011-06-22 02:47:16 -07:00
|
|
|
{
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_member_direct_del(text_class, l, _edje_text_class_member_hash);
|
2011-06-22 02:47:16 -07:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_member_add(ed, &ed->members.text_class, &_edje_text_class_member_hash, text_class);
|
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
|
|
|
{
|
|
|
|
if ((!ed) || (!text_class)) return;
|
|
|
|
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_member_del(&ed->members.text_class, &_edje_text_class_member_hash, text_class);
|
2003-07-12 19:06:46 -07:00
|
|
|
}
|
|
|
|
|
2004-01-12 11:21:25 -08:00
|
|
|
void
|
|
|
|
_edje_text_class_members_free(void)
|
|
|
|
{
|
2011-06-23 02:55:57 -07:00
|
|
|
_edje_class_members_free(&_edje_text_class_member_hash);
|
2004-01-12 11:21:25 -08:00
|
|
|
}
|
|
|
|
|
2008-12-05 19:08:17 -08:00
|
|
|
static Eina_Bool
|
2009-08-24 09:40:42 -07:00
|
|
|
text_class_hash_list_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
|
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;
|
2006-12-24 02:29:16 -08:00
|
|
|
|
2010-04-08 12:21:54 -07:00
|
|
|
if (!evas_object_smart_type_check(obj, "edje"))
|
|
|
|
return NULL;
|
2003-06-23 19:33:04 -07:00
|
|
|
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;
|
2009-08-07 02:06:04 -07:00
|
|
|
|
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;
|
|
|
|
}
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2003-07-20 05:37:49 -07:00
|
|
|
void
|
2011-01-15 20:10:45 -08:00
|
|
|
_edje_object_part_swallow_free_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2003-07-20 05:37:49 -07:00
|
|
|
{
|
|
|
|
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;
|
2003-07-20 05:37:49 -07:00
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
static void
|
|
|
|
_edje_real_part_swallow_hints_update(Edje_Real_Part *rp)
|
2007-05-26 22:28:07 -07:00
|
|
|
{
|
2011-06-07 00:43:32 -07:00
|
|
|
const char *type;
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2011-06-07 00:43:32 -07:00
|
|
|
type = evas_object_type_get(rp->swallowed_object);
|
2010-07-02 11:17:37 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->swallow_params.min.w = 0;
|
2009-08-07 02:06:04 -07:00
|
|
|
rp->swallow_params.min.h = 0;
|
2007-05-26 22:28:07 -07:00
|
|
|
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
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
edje_object_size_min_get(rp->swallowed_object, &w, &h);
|
2007-05-26 22:28:07 -07:00
|
|
|
rp->swallow_params.min.w = w;
|
|
|
|
rp->swallow_params.min.h = h;
|
2009-10-07 20:44:53 -07:00
|
|
|
edje_object_size_max_get(rp->swallowed_object, &w, &h);
|
2007-05-26 22:28:07 -07:00
|
|
|
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
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
evas_object_geometry_get(rp->swallowed_object, NULL, NULL, &w, &h);
|
2007-05-26 22:28:07 -07:00
|
|
|
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
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
evas_object_size_hint_min_get(rp->swallowed_object, &w1, &h1);
|
|
|
|
evas_object_size_hint_max_get(rp->swallowed_object, &w2, &h2);
|
|
|
|
evas_object_size_hint_aspect_get(rp->swallowed_object, &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)
|
|
|
|
{
|
2010-07-02 11:17:37 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_NONE:
|
|
|
|
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NONE;
|
2009-08-07 02:06:04 -07:00
|
|
|
break;
|
2010-07-02 11:17:37 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_NEITHER:
|
|
|
|
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_NEITHER;
|
2009-08-07 02:06:04 -07:00
|
|
|
break;
|
2010-07-02 11:17:37 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_HORIZONTAL:
|
|
|
|
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_HORIZONTAL;
|
2009-08-07 02:06:04 -07:00
|
|
|
break;
|
2010-07-02 11:17:37 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_VERTICAL:
|
2009-08-07 02:06:04 -07:00
|
|
|
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_VERTICAL;
|
|
|
|
break;
|
2010-07-02 11:17:37 -07:00
|
|
|
case EVAS_ASPECT_CONTROL_BOTH:
|
|
|
|
rp->swallow_params.aspect.mode = EDJE_ASPECT_CONTROL_BOTH;
|
2009-08-07 02:06:04 -07:00
|
|
|
break;
|
2010-07-02 11:17:37 -07:00
|
|
|
default:
|
2009-08-07 02:06:04 -07:00
|
|
|
break;
|
2008-10-04 20:37:37 -07:00
|
|
|
}
|
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);
|
|
|
|
}
|
2009-11-02 02:18:14 -08:00
|
|
|
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
2009-10-07 20:44:53 -07:00
|
|
|
}
|
2007-05-26 22:28:07 -07:00
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
void
|
2010-06-24 09:16:50 -07:00
|
|
|
_edje_object_part_swallow_changed_hints_cb(void *data, __UNUSED__ Evas *e, __UNUSED__ Evas_Object *obj, __UNUSED__ void *event_info)
|
2009-10-07 20:44:53 -07:00
|
|
|
{
|
|
|
|
Edje_Real_Part *rp;
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2009-10-07 20:44:53 -07:00
|
|
|
rp = data;
|
|
|
|
_edje_real_part_swallow_hints_update(rp);
|
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-10-07 20:44:53 -07:00
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-06-07 00:43:32 -07:00
|
|
|
_edje_real_part_swallow(Edje_Real_Part *rp,
|
|
|
|
Evas_Object *obj_swallow,
|
|
|
|
Eina_Bool hints_update)
|
2009-10-07 20:44:53 -07:00
|
|
|
{
|
|
|
|
if (rp->swallowed_object)
|
|
|
|
{
|
2009-10-26 01:26:10 -07:00
|
|
|
if (rp->swallowed_object != obj_swallow)
|
|
|
|
{
|
2009-11-09 15:47:42 -08:00
|
|
|
_edje_real_part_swallow_clear(rp);
|
2009-10-26 01:26:10 -07:00
|
|
|
rp->swallowed_object = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-07 00:43:32 -07:00
|
|
|
if (hints_update)
|
|
|
|
_edje_real_part_swallow_hints_update(rp);
|
2009-10-26 01:26:10 -07:00
|
|
|
rp->edje->dirty = 1;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2009-10-26 01:26:10 -07:00
|
|
|
_edje_recalc(rp->edje);
|
|
|
|
return;
|
|
|
|
}
|
2009-10-07 20:44:53 -07:00
|
|
|
}
|
|
|
|
#ifdef EDJE_CALC_CACHE
|
|
|
|
rp->invalidate = 1;
|
|
|
|
#endif
|
|
|
|
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);
|
2011-03-24 20:21:07 -07:00
|
|
|
else evas_object_clip_set(rp->swallowed_object, rp->edje->base.clipper);
|
2009-10-07 20:44:53 -07:00
|
|
|
evas_object_stack_above(rp->swallowed_object, rp->object);
|
2010-06-24 09:16:50 -07:00
|
|
|
evas_object_event_callback_add(rp->swallowed_object,
|
2011-11-24 04:44:41 -08:00
|
|
|
EVAS_CALLBACK_DEL,
|
2009-10-07 20:44:53 -07:00
|
|
|
_edje_object_part_swallow_free_cb,
|
|
|
|
rp->edje->obj);
|
2010-06-24 09:16:50 -07:00
|
|
|
evas_object_event_callback_add(rp->swallowed_object,
|
2009-10-07 20:44:53 -07:00
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_edje_object_part_swallow_changed_hints_cb,
|
|
|
|
rp);
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2011-06-07 00:43:32 -07:00
|
|
|
if (hints_update)
|
|
|
|
_edje_real_part_swallow_hints_update(rp);
|
2010-06-24 09:16:50 -07:00
|
|
|
|
2007-05-26 22:28:07 -07:00
|
|
|
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);
|
2010-02-23 05:39:19 -08:00
|
|
|
_edje_callbacks_focus_add(rp->swallowed_object, rp->edje, rp);
|
2007-05-26 22:28:07 -07:00
|
|
|
|
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;
|
2012-01-13 18:29:13 -08:00
|
|
|
rp->edje->recalc_call = 1;
|
2008-09-16 18:50:16 -07:00
|
|
|
_edje_recalc(rp->edje);
|
2007-05-26 22:28:07 -07:00
|
|
|
}
|
2009-11-09 15:47:42 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
_edje_real_part_swallow_clear(Edje_Real_Part *rp)
|
|
|
|
{
|
|
|
|
evas_object_smart_member_del(rp->swallowed_object);
|
|
|
|
evas_object_event_callback_del_full(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_FREE,
|
|
|
|
_edje_object_part_swallow_free_cb,
|
|
|
|
rp->edje->obj);
|
|
|
|
evas_object_event_callback_del_full(rp->swallowed_object,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_edje_object_part_swallow_changed_hints_cb,
|
|
|
|
rp);
|
|
|
|
evas_object_clip_unset(rp->swallowed_object);
|
|
|
|
evas_object_data_del(rp->swallowed_object, "\377 edje.swallowing_part");
|
|
|
|
if (rp->part->mouse_events)
|
2010-02-23 05:39:19 -08:00
|
|
|
_edje_callbacks_del(rp->swallowed_object, rp->edje);
|
|
|
|
_edje_callbacks_focus_del(rp->swallowed_object, rp->edje);
|
2009-11-09 15:47:42 -08:00
|
|
|
}
|
2009-12-04 08:20:40 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_edje_object_preload(Edje *ed)
|
|
|
|
{
|
|
|
|
ed->preload_count--;
|
|
|
|
if (!ed->preload_count)
|
|
|
|
_edje_emit(ed, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-24 09:16:50 -07:00
|
|
|
_edje_object_image_preload_cb(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
|
2009-12-04 08:20:40 -08:00
|
|
|
{
|
|
|
|
Edje *ed = data;
|
|
|
|
|
|
|
|
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_IMAGE_PRELOADED, _edje_object_image_preload_cb, ed);
|
|
|
|
_edje_object_preload(ed);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-06-24 09:16:50 -07:00
|
|
|
_edje_object_signal_preload_cb(void *data, Evas_Object *obj, __UNUSED__ const char *emission, __UNUSED__ const char *source)
|
2009-12-04 08:20:40 -08:00
|
|
|
{
|
|
|
|
Edje *ed = data;
|
|
|
|
|
|
|
|
edje_object_signal_callback_del(obj, EDJE_PRELOAD_EMISSION, EDJE_PRELOAD_SOURCE, _edje_object_signal_preload_cb);
|
|
|
|
_edje_object_preload(ed);
|
|
|
|
}
|
2010-08-06 04:07:47 -07:00
|
|
|
|
2011-04-08 00:45:46 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* for edje_cc
|
|
|
|
*/
|
2010-08-15 19:04:01 -07:00
|
|
|
EAPI void
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p)
|
2010-08-06 04:07:47 -07:00
|
|
|
{
|
|
|
|
Edje_Program ***array;
|
|
|
|
unsigned int *count;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (!p->signal && !p->source)
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.nocmp;
|
|
|
|
count = &edc->programs.nocmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
2010-08-21 06:52:25 -07:00
|
|
|
else if (p->signal && !strpbrk(p->signal, "*?[\\")
|
|
|
|
&& p->source && !strpbrk(p->source, "*?[\\"))
|
2010-08-06 04:07:47 -07:00
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strcmp;
|
|
|
|
count = &edc->programs.strcmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else if (p->signal && edje_program_is_strncmp(p->signal)
|
|
|
|
&& p->source && edje_program_is_strncmp(p->source))
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strncmp;
|
|
|
|
count = &edc->programs.strncmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else if (p->signal && edje_program_is_strrncmp(p->signal)
|
|
|
|
&& p->source && edje_program_is_strrncmp(p->source))
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strrncmp;
|
|
|
|
count = &edc->programs.strrncmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.fnmatch;
|
|
|
|
count = &edc->programs.fnmatch_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < *count; ++i)
|
|
|
|
if ((*array)[i] == p)
|
|
|
|
{
|
|
|
|
memmove(*array + i, *array + i + 1, sizeof (Edje_Program *) * (*count - i -1));
|
|
|
|
(*count)--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-08 00:45:46 -07:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* for edje_cc
|
|
|
|
*/
|
2010-08-15 19:04:01 -07:00
|
|
|
EAPI void
|
2010-08-15 11:14:33 -07:00
|
|
|
_edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p)
|
2010-08-06 04:07:47 -07:00
|
|
|
{
|
|
|
|
Edje_Program ***array;
|
|
|
|
unsigned int *count;
|
|
|
|
|
|
|
|
if (!p->signal && !p->source)
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.nocmp;
|
|
|
|
count = &edc->programs.nocmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
2010-08-21 06:52:25 -07:00
|
|
|
else if (p->signal && !strpbrk(p->signal, "*?[\\")
|
|
|
|
&& p->source && !strpbrk(p->source, "*?[\\"))
|
2010-08-06 04:07:47 -07:00
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strcmp;
|
|
|
|
count = &edc->programs.strcmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else if (p->signal && edje_program_is_strncmp(p->signal)
|
|
|
|
&& p->source && edje_program_is_strncmp(p->source))
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strncmp;
|
|
|
|
count = &edc->programs.strncmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else if (p->signal && edje_program_is_strrncmp(p->signal)
|
|
|
|
&& p->source && edje_program_is_strrncmp(p->source))
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.strrncmp;
|
|
|
|
count = &edc->programs.strrncmp_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-15 11:14:33 -07:00
|
|
|
array = &edc->programs.fnmatch;
|
|
|
|
count = &edc->programs.fnmatch_count;
|
2010-08-06 04:07:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
*array = realloc(*array, sizeof (Edje_Program *) * (*count + 1));
|
|
|
|
(*array)[(*count)++] = p;
|
|
|
|
}
|
|
|
|
|
2010-08-12 05:58:54 -07:00
|
|
|
const char *
|
|
|
|
edje_string_get(const Edje_String *es)
|
|
|
|
{
|
|
|
|
/* FIXME: Handle localization here */
|
|
|
|
if (!es) return NULL;
|
|
|
|
return es->str;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
edje_string_id_get(const Edje_String *es)
|
|
|
|
{
|
|
|
|
/* FIXME: Handle localization here */
|
|
|
|
if (!es) return NULL;
|
|
|
|
return es->str;
|
|
|
|
}
|
2010-09-06 23:56:16 -07:00
|
|
|
|
2011-11-18 02:35:38 -08:00
|
|
|
static void
|
|
|
|
_cb_subobj_del(void *data, __UNUSED__ Evas *e, Evas_Object *obj, __UNUSED__ void *event_info)
|
|
|
|
{
|
|
|
|
Edje *ed = data;
|
|
|
|
ed->subobjs = eina_list_remove(ed->subobjs, obj);
|
|
|
|
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
|
|
|
|
_cb_subobj_del, ed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_edje_subobj_register(Edje *ed, Evas_Object *ob)
|
|
|
|
{
|
|
|
|
ed->subobjs = eina_list_append(ed->subobjs, ob);
|
|
|
|
evas_object_event_callback_add(ob, EVAS_CALLBACK_DEL,
|
|
|
|
_cb_subobj_del, ed);
|
|
|
|
}
|
2010-09-06 23:56:16 -07:00
|
|
|
|
|
|
|
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|