18 #include "gradient2.h"
20 #include "textblock.h"
21 #include "textblock_style.h"
22 #include "elementary.h"
23 #include "transform.h"
26 luaopen_ego (lua_State
*L
)
29 luaobj_new_class (L
, "cEgo", cEgo
);
30 luaobj_new_class (L
, "cObject", cObject
);
31 luaobj_new_class (L
, "cRect", cRect
);
32 luaobj_new_class (L
, "cImage", cImage
);
33 luaobj_new_class (L
, "cAnimator", cAnimator
);
34 luaobj_new_class (L
, "cSmart", cSmart
);
35 luaobj_new_class (L
, "cEdje", cEdje
);
36 luaobj_new_class (L
, "cPart", cPart
);
37 luaobj_new_class (L
, "cLine", cLine
);
38 luaobj_new_class (L
, "cPolygon", cPolygon
);
39 luaobj_new_class (L
, "cGradient", cGradient
);
40 luaobj_new_class (L
, "cGradient2_Linear", cGradient2_Linear
);
41 luaobj_new_class (L
, "cGradient2_Radial", cGradient2_Radial
);
42 luaobj_new_class (L
, "cText", cText
);
43 luaobj_new_class (L
, "cTextblock", cTextblock
);
44 luaobj_new_class (L
, "cStyle", cStyle
);
45 luaobj_new_class (L
, "cTransform", cTransform
);
47 luaobj_new_class (L
, "cIcon", cIcon
);
48 luaobj_new_class (L
, "cBox", cBox
);
49 luaobj_new_class (L
, "cButton", cButton
);
50 luaobj_new_class (L
, "cScroller", cScroller
);
51 luaobj_new_class (L
, "cLabel", cLabel
);
52 luaobj_new_class (L
, "cToggle", cToggle
);
53 luaobj_new_class (L
, "cFrame", cFrame
);
54 luaobj_new_class (L
, "cTable", cTable
);
55 luaobj_new_class (L
, "cEntry", cEntry
);
56 luaobj_new_class (L
, "cBubble", cBubble
);
57 luaobj_new_class (L
, "cHover", cHover
);
58 luaobj_new_class (L
, "cLayout", cLayout
);
59 luaobj_new_class (L
, "cClock", cClock
);
63 ego_sandbox (lua_State
*L
, int level
)
69 *access to io and os routines
75 * no access to io and os routines
84 * no access to io and os routines
85 * no loading and execution of script files
92 lua_setglobal (L
, "loadfile");
94 lua_setglobal (L
, "dofile");
98 * no access to io and os routines
99 * no loading and execution of script files
100 * no loading and execution of script strings
107 lua_setglobal (L
, "loadfile");
109 lua_setglobal (L
, "dofile");
111 lua_setglobal (L
, "loadstring");
113 lua_setglobal (L
, "dostring");
117 * no access to io and os routines
118 * no loading and execution of script files
119 * no loading and execution of script strings
120 * no manipulation of environmental variables
127 lua_setglobal (L
, "loadfile");
129 lua_setglobal (L
, "dofile");
131 lua_setglobal (L
, "loadstring");
133 lua_setglobal (L
, "dostring");
135 lua_setglobal (L
, "getfenv");
137 lua_setglobal (L
, "setfenv");
143 * ego smart class implementatoin
145 static lua_State
*glob_L
= NULL
;
146 static Evas_Smart_Class parent_sc
= {NULL
};
147 static Evas_Smart_Class sc
= {NULL
};
150 ego_smart_class_add (Evas_Object
*obj
)
152 lua_State
*L
= glob_L
;
155 // register main class
156 luaobj_Object
*lobj
= lua_newuserdata (L
, sizeof (luaobj_Object
));
157 luaobj_set_class (L
, -1, lobj
, "cEgo");
159 evas_object_data_set (lobj
->data
, "luaobj", luaobj_new_ref (L
, -1));
160 lua_setglobal (L
, "ego");
162 // read in buffer at index -1
163 if (lua_pcall (L
, 0, LUA_MULTRET
, 0))
165 fprintf (stderr
, "ego parse error: %s\n", lua_tostring (L
, -1));
171 ego_smart_class_new (void)
175 parent_sc
.name
= "parent_ego";
176 parent_sc
.version
= EVAS_SMART_CLASS_VERSION
;
177 evas_object_smart_clipped_smart_set (&parent_sc
);
182 sc
.version
= EVAS_SMART_CLASS_VERSION
;
183 evas_object_smart_clipped_smart_set (&sc
);
184 sc
.add
= ego_smart_class_add
;
186 return evas_smart_class_new (&sc
);
190 * ego smart class creation
193 ego_object_add (Evas
*evas
, lua_State
*L
)
195 // create smart object
198 return evas_object_smart_add (evas
, ego_smart_class_new ());