Edje *ed;
void (*free_func) (void *obj);
- Eina_Bool is_evas_obj : 1;
+ const char *meta;
};
struct _Edje_Lua_Timer
// // LATER: box and table calls
// // LATER: perspective stuff change
//
+static const char *_elua_meta_edje = "meta_edje";
static const struct luaL_reg _elua_edje_api [] =
{
// add an echo too to make it more shelly
{NULL, NULL} // end
};
+static const char *_elua_meta_evas = "meta_evas";
static const struct luaL_reg _elua_edje_evas_obj [] =
{
// generic object methods
{NULL, NULL} // end
};
+static const char *_elua_meta_map = "meta_map";
static const struct luaL_reg _elua_evas_map_obj [] =
{
{"alpha", _elua_map_alpha},
}
luaL_register(L, "edje", _elua_edje_api);
- luaL_newmetatable(L, "edje");
+ luaL_newmetatable(L, _elua_meta_edje);
luaL_register(L, 0, _elua_edje_meta);
luaL_register(L, "edje_evas_obj", _elua_edje_evas_obj);
- luaL_newmetatable(L, "edje_evas_obj");
+ luaL_newmetatable(L, _elua_meta_evas);
luaL_register(L, 0, _elua_edje_meta);
lua_pushliteral(L, "__index");
luaL_getmetatable(L, metatable);
lua_setmetatable(L, -2);
obj->ed = ed;
+ obj->meta = metatable;
_elua_ref_set(L, obj);
return obj;
static Edje_Lua_Obj *
_elua_obj_new(lua_State *L, Edje *ed, int size)
{
- return _elua_obj_new_common(L, ed, size, "edje_evas_obj");
+ return _elua_obj_new_common(L, ed, size, _elua_meta_evas);
}
static Edje_Lua_Obj *
_elua_map_new(lua_State *L, Edje *ed, int size)
{
- return _elua_obj_new_common(L, ed, size, "evas_map_obj");
+ return _elua_obj_new_common(L, ed, size, _elua_meta_map);
}
static void
// FIXME: Should have separate functions for each lua type, instead of these multi argument style ones.
// Better idea - scanf()) style _elua_scan_params("%i#f$str", &i, &f, &str);
-// int %
-// num #
-// str $
+// int %
+// num #
+// str $
+// bool
+// table
+// func
+// thread
+// userdata
+// lightuserdata
+// nil
// Can also have a matching _elua_ret("%i#f$str", i, f, str));
static int
_elua_str_int_get(lua_State *L, int i, Eina_Bool tr,
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_show(elo->evas_obj);
lua_pushboolean(L, evas_object_visible_get(elo->evas_obj));
return 1;
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_hide(elo->evas_obj);
lua_pushboolean(L, evas_object_visible_get(elo->evas_obj));
return 1;
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
int x, y;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_2_int_get(L, 2, EINA_TRUE, "x", &x, "y", &y) > 0)
{
if ((x != elo->x) || (y != elo->y))
int w, h;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh);
if (_elua_2_int_get(L, 2, EINA_TRUE, "w", &w, "h", &h) > 0)
{
int x, y, w, h;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_geometry_get(elo->evas_obj, NULL, NULL, &ow, &oh);
if (_elua_4_int_get(L, 2, EINA_TRUE, "x", &x, "y", &y, "w", &w, "h", &h) > 0)
{
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_raise(elo->evas_obj);
return 0;
}
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_lower(elo->evas_obj);
return 0;
}
Edje_Lua_Evas_Object *elo2;
Evas_Object *o;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (!(o = evas_object_above_get(elo->evas_obj))) return 0;
if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
_elua_ref_get(L, elo2);
Edje_Lua_Evas_Object *elo2;
Evas_Object *o;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (!(o = evas_object_below_get(elo->evas_obj))) return 0;
if (!(elo2 = evas_object_data_get(o, ELO))) return 0;
_elua_ref_get(L, elo2);
Evas_Object *o;
Eina_List *list, *l;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
if (!list) return 0;
for (l = eina_list_last(list); l; l = l->prev)
Evas_Object *o;
Eina_List *list, *l;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (!(list = (Eina_List *)evas_object_smart_members_get(obj->ed->obj))) return 0;
for (l = list; l; l = l->next)
{
int r, g, b, a;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_4_int_get(L, 2, EINA_TRUE, "r", &r, "g", &g, "b", &b, "a", &a) > 0)
{
_elua_color_fix(&r, &g, &b, &a);
Evas_Object *o;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2);
elo2 = (Edje_Lua_Evas_Object *)obj2;
+ if (obj2->meta != _elua_meta_evas) return 0;
evas_object_clip_set(elo->evas_obj, elo2->evas_obj);
}
o = evas_object_clip_get(elo->evas_obj);
Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_clip_unset(elo->evas_obj);
return 0;
}
Evas_Object *o;
int n = 0;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
list = (Eina_List *)evas_object_clipees_get(elo->evas_obj);
lua_newtable(L);
EINA_LIST_FOREACH(list, l, o)
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
const char *t;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
t = evas_object_type_get(elo->evas_obj);
if (!t) return 0;
lua_pushstring(L, t);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2);
Edje_Lua_Map *elm = (Edje_Lua_Map *)obj2;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (!obj2) return 0;
+ if (obj2->meta != _elua_meta_map) return 0;
evas_object_map_set(elo->evas_obj, elm->map);
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
if (!obj2) return 0;
- if (!obj2->is_evas_obj) return 0;
+ if (obj2->meta != _elua_meta_evas) return 0;
evas_object_map_source_set(elo->evas_obj, source->evas_obj);
}
int inlined_font = 0;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_str_int_get(L, 2, EINA_TRUE, "font", &font, "size", &size) > 0)
{
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
{
char *file = NULL, *key = NULL;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_2_str_get(L, 2, EINA_TRUE, "file", &file, "key", &key) > 0)
{
Evas_Coord x, y, w, h;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_4_int_get(L, 2, EINA_TRUE, "x", &x, "y", &y, "w", &w, "h", &h) > 0)
{
int n;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
n = lua_gettop(L);
if (n == 2)
char *file = NULL, *group = NULL;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
// FIXME: Only allow groups from the same file this edje came from.
if (_elua_2_str_get(L, 2, EINA_TRUE, "file", &file, "group", &group) > 0)
Evas_Coord x1, y1, x2, y2;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_4_int_get(L, 2, EINA_TRUE, "x1", &x1, "y1", &y1, "x2", &x2, "y2", &y2) > 0)
{
Evas_Coord x, y;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
if (_elua_2_int_get(L, 2, EINA_FALSE, "x", &x, "y", &y) > 0)
{
Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
if (!obj) return 0;
- if (!obj->is_evas_obj) return 0;
+ if (obj->meta != _elua_meta_evas) return 0;
evas_object_polygon_points_clear(elo->evas_obj);
return 1;
}
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
if (n == 2)
Edje_Lua_Map *elm = (Edje_Lua_Map *)obj;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
lua_pushboolean(L, evas_map_util_clockwise_get(elm->map));
return 1;
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
switch (n)
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
if (2 > n) return 0;
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
if (n = (_elua_3_int_get(L, 2, EINA_FALSE, "x", &x, "y", &y, "z", &z)) > 0)
if (n += _elua_3_int_get(L, 2 + n, EINA_FALSE, "r", &r, "g", &g, "b", &b) > 0)
Evas_Coord x, y, z, f;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
if (_elua_4_int_get(L, 2, EINA_FALSE, "x", &x, "y", &y, "z", &z, "f", &f) > 0)
{
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
switch (n)
{
Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2);
const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
+ if (obj2->meta != _elua_meta_evas) return 0;
evas_map_util_points_populate_from_object(elm->map, source->evas_obj);
break;
{
Edje_Lua_Obj *obj2 = (Edje_Lua_Obj *)lua_touserdata(L, 2);
const Edje_Lua_Evas_Object *source = (Edje_Lua_Evas_Object *)obj2;
+ if (obj2->meta != _elua_meta_evas) return 0;
Evas_Coord z = lua_tointeger(L, 3);
evas_map_util_points_populate_from_object_full(elm->map, source->evas_obj, z);
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
if (4 != n) return 0;
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
if (n = (_elua_3_num_get(L, 2, EINA_FALSE, "x", &zx, "y", &zy, "z", &zz)) > 0)
if (_elua_3_int_get(L, 2 + n, EINA_FALSE, "x", &x, "y", &y, "z", &z) > 0)
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
if (n == 2)
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
n = lua_gettop(L);
if (2 > n) return 0;
int n;
if (!obj) return 0;
+ if (obj->meta != _elua_meta_map) return 0;
if (n = (_elua_2_num_get(L, 2, EINA_FALSE, "x", &zx, "y", &zy)) > 0)
if (_elua_2_int_get(L, 2 + n, EINA_FALSE, "x", &x, "y", &y) > 0)
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_rectangle_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_image_filled_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_text_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_textblock_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = edje_object_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_line_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
elo = (Edje_Lua_Evas_Object *)_elua_obj_new(L, ed, sizeof(Edje_Lua_Evas_Object));
elo->obj.free_func = _elua_evas_obj_free;
- elo->obj.is_evas_obj = 1;
elo->evas_obj = evas_object_polygon_add(evas_object_evas_get(ed->obj));
evas_object_smart_member_add(elo->evas_obj, ed->obj);
evas_object_clip_set(elo->evas_obj, ed->base.clipper);
luaL_register(L, "edje", _elua_edje_api);
- luaL_newmetatable(L, "edje");
+ luaL_newmetatable(L, _elua_meta_edje);
luaL_register(L, 0, _elua_edje_meta);
luaL_register(L, "edje_evas_obj", _elua_edje_evas_obj);
- luaL_newmetatable(L, "edje_evas_obj");
+ luaL_newmetatable(L, _elua_meta_evas);
luaL_register(L, 0, _elua_edje_meta);
lua_pushliteral(L, "__index");
lua_pop(L, 2);
luaL_register(L, "evas_map_obj", _elua_evas_map_obj);
- luaL_newmetatable(L, "evas_map_obj");
+ luaL_newmetatable(L, _elua_meta_map);
luaL_register(L, 0, _elua_edje_meta);
lua_pushliteral(L, "__index");