2015-04-03 07:12:59 -07:00
|
|
|
#include "evas_common_private.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
2015-04-03 07:13:06 -07:00
|
|
|
#include "evas_vg_private.h"
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
#include <string.h>
|
2015-04-03 07:23:20 -07:00
|
|
|
#include <math.h>
|
2015-04-03 07:12:59 -07:00
|
|
|
|
|
|
|
#define MY_CLASS EVAS_VG_NODE_CLASS
|
|
|
|
|
|
|
|
// FIXME:
|
|
|
|
// - share private structure with evas_object_vg
|
|
|
|
// - mark parent canvas evas_object dirty after any change on the object
|
|
|
|
// - add a virtual render function as part of the private data field
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_transformation_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
const Eina_Matrix3 *m)
|
|
|
|
{
|
|
|
|
if (!pd->m)
|
|
|
|
{
|
|
|
|
pd->m = malloc(sizeof (Eina_Matrix3));
|
|
|
|
if (!pd->m) return ;
|
|
|
|
}
|
|
|
|
memcpy(pd->m, m, sizeof (Eina_Matrix3));
|
|
|
|
}
|
|
|
|
|
|
|
|
const Eina_Matrix3 *
|
|
|
|
_evas_vg_node_transformation_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->m;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_origin_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
double x, double y)
|
|
|
|
{
|
|
|
|
pd->x = x;
|
|
|
|
pd->y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_origin_get(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
double *x, double *y)
|
|
|
|
{
|
|
|
|
if (x) *x = pd->x;
|
|
|
|
if (y) *y = pd->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:20 -07:00
|
|
|
_evas_vg_node_efl_gfx_base_position_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
int x, int y)
|
|
|
|
{
|
|
|
|
pd->x = lrint(x);
|
|
|
|
pd->y = lrint(y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_efl_gfx_base_position_get(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
int *x, int *y)
|
|
|
|
{
|
|
|
|
if (x) *x = pd->x;
|
|
|
|
if (y) *y = pd->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_efl_gfx_base_visible_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd, Eina_Bool v)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
|
|
|
pd->visibility = v;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:20 -07:00
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
Eina_Bool
|
2015-04-03 07:23:20 -07:00
|
|
|
_evas_vg_node_efl_gfx_base_visible_get(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
|
|
|
return pd->visibility;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:20 -07:00
|
|
|
_evas_vg_node_efl_gfx_base_color_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
int r, int g, int b, int a)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
|
|
|
pd->r = r;
|
|
|
|
pd->g = g;
|
|
|
|
pd->b = b;
|
|
|
|
pd->a = a;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:30:33 -07:00
|
|
|
Eina_Bool
|
|
|
|
_evas_vg_node_efl_gfx_base_color_part_set(Eo *obj, Evas_VG_Node_Data *pd,
|
|
|
|
const char *part,
|
|
|
|
int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
if (part) return EINA_FALSE;
|
|
|
|
|
|
|
|
_evas_vg_node_efl_gfx_base_color_set(obj, pd, r, g, b, a);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
void
|
2015-04-03 07:23:20 -07:00
|
|
|
_evas_vg_node_efl_gfx_base_color_get(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
int *r, int *g, int *b, int *a)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
|
|
|
if (r) *r = pd->r;
|
|
|
|
if (g) *g = pd->g;
|
|
|
|
if (b) *b = pd->b;
|
|
|
|
if (a) *a = pd->a;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:30:33 -07:00
|
|
|
Eina_Bool
|
|
|
|
_evas_vg_node_efl_gfx_base_color_part_get(Eo *obj, Evas_VG_Node_Data *pd,
|
|
|
|
const char *part,
|
|
|
|
int *r, int *g, int *b, int *a)
|
|
|
|
{
|
|
|
|
if (part) return EINA_FALSE;
|
|
|
|
|
|
|
|
_evas_vg_node_efl_gfx_base_color_get(obj, pd, r, g, b, a);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
void
|
|
|
|
_evas_vg_node_mask_set(Eo *obj EINA_UNUSED,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
Evas_VG_Node *r)
|
|
|
|
{
|
|
|
|
Evas_VG_Node *tmp = pd->mask;
|
|
|
|
|
|
|
|
pd->mask = eo_ref(r);
|
|
|
|
eo_unref(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_VG_Node*
|
|
|
|
_evas_vg_node_mask_get(Eo *obj EINA_UNUSED, Evas_VG_Node_Data *pd)
|
|
|
|
{
|
|
|
|
return pd->mask;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:20 -07:00
|
|
|
void
|
|
|
|
_evas_vg_node_efl_gfx_base_size_get(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd EINA_UNUSED,
|
|
|
|
int *w, int *h)
|
|
|
|
{
|
|
|
|
Eina_Rectangle bound = { 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
eo_do(obj, evas_vg_node_bound_get(&bound));
|
|
|
|
if (w) *w = bound.w;
|
|
|
|
if (h) *h = bound.h;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
// Parent should be a container otherwise dismissing the stacking operation
|
2015-04-03 07:22:54 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_evas_vg_node_parent_checked_get(Eo *obj,
|
|
|
|
Eo **parent, Evas_VG_Container_Data **cd)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:22:54 -07:00
|
|
|
eo_do(obj, *parent = eo_parent_get());
|
|
|
|
if (eo_isa(*parent, EVAS_VG_CONTAINER_CLASS))
|
2015-04-03 07:13:06 -07:00
|
|
|
{
|
2015-04-03 07:22:54 -07:00
|
|
|
*cd = eo_data_scope_get(*parent, EVAS_VG_CONTAINER_CLASS);
|
|
|
|
if (!*cd)
|
2015-04-03 07:22:26 -07:00
|
|
|
{
|
|
|
|
ERR("Can't get EVAS_VG_CONTAINER_CLASS data.");
|
2015-04-03 07:22:54 -07:00
|
|
|
goto on_error;
|
2015-04-03 07:22:26 -07:00
|
|
|
}
|
|
|
|
}
|
2015-04-03 07:22:54 -07:00
|
|
|
else if (*parent != NULL)
|
2015-04-03 07:22:26 -07:00
|
|
|
{
|
2015-04-03 07:22:54 -07:00
|
|
|
ERR("Parent of unauthorized class.");
|
|
|
|
goto on_error;
|
2015-04-03 07:13:06 -07:00
|
|
|
}
|
2015-04-03 07:22:54 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
*parent = NULL;
|
|
|
|
*cd = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_evas_vg_node_eo_base_constructor(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_VG_Container_Data *cd = NULL;
|
|
|
|
Eo *parent;
|
|
|
|
|
|
|
|
eo_do_super(obj, MY_CLASS, eo_constructor());
|
|
|
|
|
|
|
|
if (!_evas_vg_node_parent_checked_get(obj, &parent, &cd))
|
|
|
|
eo_error_set(obj);
|
|
|
|
|
|
|
|
if (cd)
|
|
|
|
cd->children = eina_list_append(cd->children, obj);
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:13:06 -07:00
|
|
|
_evas_vg_node_eo_base_parent_set(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd EINA_UNUSED,
|
|
|
|
Eo *parent)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:22:26 -07:00
|
|
|
Evas_VG_Container_Data *cd = NULL;
|
|
|
|
Evas_VG_Container_Data *old_cd = NULL;
|
2015-04-03 07:13:06 -07:00
|
|
|
Eo *old_parent;
|
|
|
|
|
2015-04-03 07:22:26 -07:00
|
|
|
if (eo_isa(parent, EVAS_VG_CONTAINER_CLASS))
|
2015-04-03 07:13:06 -07:00
|
|
|
{
|
2015-04-03 07:22:26 -07:00
|
|
|
cd = eo_data_scope_get(parent, EVAS_VG_CONTAINER_CLASS);
|
2015-04-03 07:22:54 -07:00
|
|
|
if (!cd)
|
|
|
|
{
|
|
|
|
ERR("Can't get EVAS_VG_CONTAINER_CLASS data from %p.", parent);
|
|
|
|
goto on_error;
|
|
|
|
}
|
2015-04-03 07:22:26 -07:00
|
|
|
}
|
|
|
|
else if (parent != NULL && !eo_isa(parent, EVAS_VG_CLASS))
|
|
|
|
{
|
|
|
|
ERR("%p not even an EVAS_VG_CLASS.", parent);
|
|
|
|
goto on_error;
|
2015-04-03 07:13:06 -07:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:22:54 -07:00
|
|
|
if (!_evas_vg_node_parent_checked_get(obj, &old_parent, &old_cd))
|
|
|
|
goto on_error;
|
2015-04-03 07:13:06 -07:00
|
|
|
|
|
|
|
// FIXME: this may become slow with to much object
|
2015-04-03 07:22:26 -07:00
|
|
|
if (old_cd)
|
|
|
|
old_cd->children = eina_list_remove(old_cd->children, obj);
|
2015-04-03 07:13:06 -07:00
|
|
|
|
|
|
|
eo_do_super(obj, MY_CLASS, eo_parent_set(parent));
|
2015-04-03 07:22:26 -07:00
|
|
|
if (cd)
|
|
|
|
cd->children = eina_list_append(cd->children, obj);
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eo_error_set(obj);
|
|
|
|
return ;
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:23 -07:00
|
|
|
_evas_vg_node_efl_gfx_stack_raise(Eo *obj, Evas_VG_Node_Data *pd EINA_UNUSED)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:13:06 -07:00
|
|
|
Evas_VG_Container_Data *cd;
|
|
|
|
Eina_List *lookup, *next;
|
2015-04-03 07:12:59 -07:00
|
|
|
Eo *parent;
|
|
|
|
|
|
|
|
eo_do(obj, parent = eo_parent_get());
|
2015-04-03 07:13:06 -07:00
|
|
|
cd = eo_data_scope_get(parent, EVAS_VG_CONTAINER_CLASS);
|
|
|
|
if (!cd) goto on_error;
|
|
|
|
|
|
|
|
// FIXME: this could become slow with to much object
|
|
|
|
lookup = eina_list_data_find_list(cd->children, obj);
|
|
|
|
if (!lookup) goto on_error;
|
|
|
|
|
|
|
|
next = eina_list_next(lookup);
|
|
|
|
if (!next) return ;
|
|
|
|
|
|
|
|
cd->children = eina_list_remove_list(cd->children, lookup);
|
|
|
|
cd->children = eina_list_append_relative_list(cd->children, obj, next);
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eo_error_set(obj);
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:23 -07:00
|
|
|
_evas_vg_node_efl_gfx_stack_stack_above(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd EINA_UNUSED,
|
|
|
|
Efl_Gfx_Stack *above)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:13:06 -07:00
|
|
|
Evas_VG_Container_Data *cd;
|
|
|
|
Eina_List *lookup, *ref;
|
2015-04-03 07:12:59 -07:00
|
|
|
Eo *parent;
|
|
|
|
|
|
|
|
eo_do(obj, parent = eo_parent_get());
|
2015-04-03 07:13:06 -07:00
|
|
|
cd = eo_data_scope_get(parent, EVAS_VG_CONTAINER_CLASS);
|
|
|
|
if (!cd) goto on_error;
|
|
|
|
|
|
|
|
// FIXME: this could become slow with to much object
|
|
|
|
lookup = eina_list_data_find_list(cd->children, obj);
|
|
|
|
if (!lookup) goto on_error;
|
|
|
|
|
|
|
|
ref = eina_list_data_find_list(cd->children, above);
|
|
|
|
if (!ref) goto on_error;
|
|
|
|
|
|
|
|
cd->children = eina_list_remove_list(cd->children, lookup);
|
|
|
|
cd->children = eina_list_append_relative_list(cd->children, obj, ref);
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eo_error_set(obj);
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:23 -07:00
|
|
|
_evas_vg_node_efl_gfx_stack_stack_below(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd EINA_UNUSED,
|
|
|
|
Efl_Gfx_Stack *below)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:13:06 -07:00
|
|
|
Evas_VG_Container_Data *cd;
|
|
|
|
Eina_List *lookup, *ref;
|
2015-04-03 07:12:59 -07:00
|
|
|
Eo *parent;
|
|
|
|
|
|
|
|
eo_do(obj, parent = eo_parent_get());
|
2015-04-03 07:13:06 -07:00
|
|
|
cd = eo_data_scope_get(parent, EVAS_VG_CONTAINER_CLASS);
|
|
|
|
if (!cd) goto on_error;
|
|
|
|
|
|
|
|
// FIXME: this could become slow with to much object
|
|
|
|
lookup = eina_list_data_find_list(cd->children, obj);
|
|
|
|
if (!lookup) goto on_error;
|
|
|
|
|
|
|
|
ref = eina_list_data_find_list(cd->children, below);
|
|
|
|
if (!ref) goto on_error;
|
|
|
|
|
|
|
|
cd->children = eina_list_remove_list(cd->children, lookup);
|
|
|
|
cd->children = eina_list_prepend_relative_list(cd->children, obj, ref);
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eo_error_set(obj);
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-04-03 07:23:23 -07:00
|
|
|
_evas_vg_node_efl_gfx_stack_lower(Eo *obj, Evas_VG_Node_Data *pd EINA_UNUSED)
|
2015-04-03 07:12:59 -07:00
|
|
|
{
|
2015-04-03 07:13:06 -07:00
|
|
|
Evas_VG_Container_Data *cd;
|
|
|
|
Eina_List *lookup, *prev;
|
2015-04-03 07:12:59 -07:00
|
|
|
Eo *parent;
|
|
|
|
|
|
|
|
eo_do(obj, parent = eo_parent_get());
|
2015-04-03 07:13:06 -07:00
|
|
|
cd = eo_data_scope_get(parent, EVAS_VG_CONTAINER_CLASS);
|
|
|
|
if (!cd) goto on_error;
|
|
|
|
|
|
|
|
// FIXME: this could become slow with to much object
|
|
|
|
lookup = eina_list_data_find_list(cd->children, obj);
|
|
|
|
if (!lookup) goto on_error;
|
|
|
|
|
|
|
|
prev = eina_list_prev(lookup);
|
|
|
|
if (!prev) return ;
|
|
|
|
|
|
|
|
cd->children = eina_list_remove_list(cd->children, lookup);
|
|
|
|
cd->children = eina_list_prepend_relative_list(cd->children, obj, prev);
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
eo_error_set(obj);
|
2015-04-03 07:12:59 -07:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:23 -07:00
|
|
|
Efl_Gfx_Stack *
|
|
|
|
_evas_vg_node_efl_gfx_stack_below_get(Eo *obj, Evas_VG_Node_Data *pd)
|
|
|
|
{
|
|
|
|
// FIXME: need to implement bound_get
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Efl_Gfx_Stack *
|
|
|
|
_evas_vg_node_efl_gfx_stack_above_get(Eo *obj, Evas_VG_Node_Data *pd)
|
|
|
|
{
|
|
|
|
// FIXME: need to implement bound_get
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:14:55 -07:00
|
|
|
Eina_Bool
|
|
|
|
_evas_vg_node_original_bound_get(Eo *obj,
|
|
|
|
Evas_VG_Node_Data *pd,
|
|
|
|
Eina_Rectangle *r)
|
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2015-04-03 07:12:59 -07:00
|
|
|
#include "evas_vg_node.eo.c"
|