* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-/**
-@page luaref Edje LUA scripting
-
-
-@section intro Introduction
-
-Lua scripts are declared in edc files with the @a lua_script keyword. Like this:
-@code
-group {
- name: "mygroup";
- lua_script {
- print("LUA: on-load script");
- }
- parts {
- ...
- }
- programs {
- program {
- signal: "a_signal";
- source: "a_part";
- lua_script {
- print("LUA: 'mouse,down,1' on 'button'");
- }
- }
- }
-}
-@endcode
-
-Inside a lua_script code block, there's a reference to your edje @ref Group named
-@a ed, which you may use for accessing your parts (e.g. a part named "label"
-is accessed through @a ed.label). This is the main object that is used to
-access every parts and is also used to create @ref Timer, @ref poller and
-@ref animator; to emit signal, send messagges, run/stop programs and more.
-Look at the @ref Group class to see all the methods and properties.
-
-Some object attributes return a table of values, the @ref Object attribute
-@a geometry for example return a table of 4 values (x,y,w,h). This tables don't
-have named index thus you can access the fields only using: geometry[1] for the
-x value. NOTE that you can NOT use gemetry.x or .geometry["x"]. But
-you can use the lua unpack function in this way:
-@code
-x, y, w, h = unpack(ed.part_name.geometry)
-print("geometry: ", x, y, w, h)
-// the same for state names:
-state, val = unpack(ed.part_name.state)
-print("state: ", state, val)
-// and for setting tables attributes:
-custom.color = { 255, 255, 255, 255 }
-ed.part_name.state = { 'custom', 0.0 }
-@endcode
-
-Classes hierarchy:
-- @ref Timer
-- @ref Animator
-- @ref Poller
-- @ref Object
- - @ref Group
- - @ref Part
- - @ref Image
- - @ref Line
- - @ref Polygon
- - @ref Table
- - @ref Description
-
-References:
-@li For general LUA documentations look at the official LUA manual
-(http://www.lua.org/manual/5.1/)
-@li The lua-users wiki is also full of lua info (http://lua-users.org/wiki/)
-@li Examples of edc files that use LUA can be found in the doc/examples folder
-in the edje sources.
-
-
-Lua snippets:
-@code
-// print one or more values in console in a tabbed way or using printf style
-print("something to say", val1, val2)
-s = string.format("%d %d", 3, 4)
-print(s)
-
-// string concat
-print("string1" .. "string2" .. val1)
-
-// var to string
-tostring(var)
-
-// Print the type of a variable
-print(type(var))
-
-@endcode
-
-*/
-
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Timer,Timer Class}
-
-The timer class is a wrapper around ecore_timer. You can create a timer using
-the @a timer(secs,callback) method of the @ref Group class.
-The callback function will be called every @a secs seconds until it will
-return CALLBACK_RENEW. If CALLBACK_CANCEL is returned the timer will stop.
-
-Example:
-@code
-lua_script {
- function timer_cb()
- print("timer_cb")
- return CALLBACK_RENEW
- end
-
- timer = ed:timer(0.5, timer_cb)
-}
-@endcode
-
-A more detailed example can be found in doc/examples/lua_timer.edc
-
-@seealso{Ecore Timer Docs,http://docs.enlightenment.org/auto/ecore/group__Ecore__Timer__Group.html}
-*/
const luaL_Reg lTimer_get[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Timer.pending
-@li Timer.precision
-@li Timer.interval
-*/
const luaL_Reg lTimer_get[] = {
{"pending", _edje_lua_timer_get_pending},
{"precision", _edje_lua_timer_get_precision},
return 0;
}
-/**
-@page luaref
-@setters
-@li Timer.interval
-*/
-
const luaL_Reg lTimer_set[] = {
{"interval", _edje_lua_timer_set_interval},
{NULL, NULL} // sentinel
return 0;
}
-/**
-@page luaref
-@methods
-@li Timer:del()
-@li Timer:freeze()
-@li Timer:thaw()
-@li Timer:delay(secs)
-*/
const luaL_Reg lTimer_fn[] = {
{"del", _edje_lua_timer_fn_del},
{"freeze", _edje_lua_timer_fn_freeze},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Animator,Animator Class}
-
-The animator class is a wrapper around ecore_animator. Animator are used the
-same way as @ref Timer.
-*/
const luaL_Reg lAnimator_get[];
const luaL_Reg lAnimator_fn[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Animator.frametime
-*/
const luaL_Reg lAnimator_get[] = {
{"frametime", _edje_lua_animator_get_frametime},
{NULL, NULL}
return 0;
}
-/**
-@page luaref
-@methods
-@li Animator:del()
-*/
const luaL_Reg lAnimator_fn[] = {
{"del", _edje_lua_animator_fn_del},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Poller,Poller Class}
-
-The poller class is a wrapper around ecore_poller.
-
-*/
const luaL_Reg lPoller_get[];
const luaL_Reg lPoller_fn[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Poller.interval
-*/
const luaL_Reg lPoller_get[] = {
{"interval", _edje_lua_poller_get_interval},
{NULL, NULL}
return 0;
}
-/**
-@page luaref
-@methods
-@li Poller:del()
-*/
const luaL_Reg lPoller_fn[] = {
{"del", _edje_lua_poller_fn_del},
{NULL, NULL}
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Object,General Object Class}
-
-This is the base class, many other classes are children of this.
-
-You can attach event callbacks to this class using a classic c approach:
-@code
-function mouse_move_cb(self, ...)
- print("mouse_move", ...)
-end
-
-rect = ed:rectangle()
-rect.mouse_events = true
-rect.mouse_move = mouse_move_cb
-@endcode
-or you can also do the same in a more lua-fashion style
-@code
-rect = ed:rectangle {
- mouse_events = true,
- mouse_move = function (self, ...)
- print ('mouse_move', ...)
- end
-}
-@endcode
-
-
-@seealso{Evas Object Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Group.html}
-*/
-
const luaL_Reg lObject_get[];
const luaL_Reg lObject_set[];
return 0;
}
-/**
-@page luaref
-@methods
-@li Object:del()
-@li Object:show()
-@li Object:hide()
-@li Object:move(x, y)
-@li Object:resize(w, h)
-@li Object:raise()
-@li Object:lower()
-@li Object:stack_above()
-@li Object:stack_below()
-@li Object:clip_unset()
-*/
const luaL_Reg lObject_fn[] = {
{"del", _edje_lua_object_fn_del},
{"show", _edje_lua_object_fn_show},
return 1;
}
-/**
-@page luaref
-@attributes
-@li Object.name
-@li Object.geometry: (x, y, width, height)
-@li Object.type: object type (RECT=1, TEXT, IMAGE, SWALLOW, TEXTBLOCK, GRADIENT, GROUP, BOX, TABLE, EXTERNAL)
-@li Object.layer
-@li Object.above
-@li Object.below
-@li Object.size_hint_min: (w,h)
-@li Object.size_hint_max: (w,h)
-@li Object.size_hint_request: (w,h)
-@li Object.size_hint_aspect: (aspect, w, h)
-@li Object.size_hint_align: (w,h)
-@li Object.size_hint_weight: (w,h)
-@li Object.size_hint_padding: (l,r,t,b)
-@li Object.visible
-@li Object.render_op
-@li Object.anti_alias
-@li Object.scale
-@li Object.color: (r, g, b, alpha)
-@li Object.color_interpolation
-@li Object.clip
-@li Object.clipees
-@li Object.evas (not implemeted, always return nil)
-@li Object.pass_events
-@li Object.repeat_events
-@li Object.propagate_events
-@li Object.focus
-@li Object.pointer_mode
-@li Object.precise_is_inside
-@li Object.mouse_events
-*/
const luaL_Reg lObject_get[] = {
{"name", _edje_lua_object_get_name},
{"geometry", _edje_lua_object_get_geometry},
return 0;
}
-/**
-@page luaref
-@setters
-@li Object.name
-@li Object.layer
-@li Object.size_hint_min: (w,h)
-@li Object.size_hint_max: (w,h)
-@li Object.size_hint_request: (w,h)
-@li Object.size_hint_aspect: (w,h)
-@li Object.size_hint_align: (w,h)
-@li Object.size_hint_weight: (w,h)
-@li Object.size_hint_padding: (l,r,t,b)
-@li Object.render_op
-@li Object.anti_alias
-@li Object.scale
-@li Object.color: (r, g, b, alpha)
-@li Object.color_interpolation
-@li Object.clip
-@li Object.pass_events
-@li Object.repeat_events
-@li Object.propagate_events
-@li Object.focus
-@li Object.pointer_mode
-@li Object.precise_is_inside
-@li Object.mouse_events
-*/
const luaL_Reg lObject_set[] = {
{"name", _edje_lua_object_set_name},
{"layer", _edje_lua_object_set_layer},
{"mouse_events", _edje_lua_object_set_mouse_events},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@events
-@li Object.mouse_in: func(self,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_out: func(self,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_down: func(self,button,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_up: func(self,button,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_move: func(self,buttons,output_x,output_y,canvas_x,canvas_y)
-@li Object.mouse_wheel: func(self,z,output_x,output_y,canvas_x,canvas_y)
-*/
const Edje_Lua_Reg *cRectangle[] = {
&mClass,
NULL // sentinel
};
-/**
-@page luaref
-@luaclass{Image,Image Class}
-@seealso{Evas Object Image Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Image.html}
-*/
const luaL_Reg lImage_get[];
const luaL_Reg lImage_set[];
return 1;
};
-/**
-@page luaref
-@attributes
-@li Image.size: (w,h)
-*/
const luaL_Reg lImage_get[] = {
{"size", _edje_lua_image_get_size},
{NULL, NULL} // sentinel
return 0;
}
-/**
-@page luaref
-@setters
-@li Image.file
-@li Image.fill: (x,y,w,h)
-@li Image.fill_transform
-@li Image.alpha
-*/
const luaL_Reg lImage_set[] = {
{"file", _edje_lua_image_set_file},
{"fill", _edje_lua_image_set_fill},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Line,Line Class}
-@seealso{Evas Object Line Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Line__Group.html}
-*/
const luaL_Reg lLine_get[];
const luaL_Reg lLine_set[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Line.xy: (x1,y1,x2,y2)
-*/
const luaL_Reg lLine_get[] = {
{"xy", _edje_lua_line_get_xy},
{NULL, NULL} // sentinel
return 0;
}
-/**
-@page luaref
-@setters
-@li Line.xy: (x1,y1,x2,y2)
-*/
const luaL_Reg lLine_set[] = {
{"xy", _edje_lua_line_set_xy},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Polygon,Polygon Class}
-@seealso{Evas Object Polygon Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Polygon.html}
-*/
const luaL_Reg lPolygon_fn[];
const Edje_Lua_Reg mPolygon = {
return 0;
}
-/**
-@page luaref
-@methods
-@li Polygon:point_add(x,y)
-@li Polygon:points_clear()
-*/
const luaL_Reg lPolygon_fn[] = {
{"point_add", _edje_lua_polygon_fn_point_add},
{"points_clear", _edje_lua_polygon_fn_points_clear},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Table,Table Class}
-@seealso{Evas Object Table Docs,http://docs.enlightenment.org/auto/evas/group__Evas__Object__Table.html}
-*/
const luaL_Reg lTable_get[];
const luaL_Reg lTable_set[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Table.homogeneous
-@li Table.padding: (horiz,vert)
-@li Table.align: (horiz,vert)
-@li Table.col_row_size: (cols,rows)
-@li Table.children
-*/
const luaL_Reg lTable_get[] = {
{"homogeneous", _edje_lua_table_get_homogeneous},
{"padding", _edje_lua_table_get_padding},
return 0;
}
-/**
-@page luaref
-@setters
-@li Table.homogeneous
-@li Table.padding: (horiz,vert)
-@li Table.align: (horiz,vert)
-*/
const luaL_Reg lTable_set[] = {
{"homogeneous", _edje_lua_table_set_homogeneous},
{"padding", _edje_lua_table_set_padding},
return 0;
}
-/**
-@page luaref
-@methods
-@li Table.pack(child,col,row,colspan,rowspan)
-@li Table.unpack(child)
-@li Table.clear(clear)
-*/
const luaL_Reg lTable_fn[] = {
{"pack", _edje_lua_table_fn_pack},
{"unpack", _edje_lua_table_fn_unpack},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Description,Description Class}
-*/
-
const luaL_Reg lDescription_get[];
const luaL_Reg lDescription_set[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Description.alignment: (x,y)
-@li Description.min: (w,h)
-@li Description.max: (w,h)
-@li Description.step: (w,h)
-@li Description.aspect: (x,y)
-@li Description.aspect_pref
-@li Description.color: (r,g,b,a)
-@li Description.color2: (r,g,b,a)
-@li Description.color3: (r,g,b,a)
-@li Description.color_class
-@li Description.rel1: (x,y)
-@li Description.rel1_to: (to_x,to_y)
-@li Description.rel1_offset: (x,y)
-@li Description.rel2: (x,y)
-@li Description.rel2_to: (to_x,to_y)
-@li Description.rel2_offset: (x,y)
-@li Description.image (not yet implemented)
-@li Description.border: (l,r,t,b)
-@li Description.fill_smooth
-@li Description.fill_pos: (rel_x,rel_y,offset_x,offset_y)
-@li Description.fill_size: (rel_x,rel_y,offset_x,offset_y)
-@li Description.text
-@li Description.text_class
-@li Description.text_font
-@li Description.text_style
-@li Description.text_size
-@li Description.text_fit: (x,y)
-@li Description.text_min: (x,y)
-@li Description.text_max: (x,y)
-@li Description.text_align: (x,y)
-@li Description.visible
-*/
const luaL_Reg lDescription_get[] = {
{"alignment", _edje_lua_description_get_alignment},
{"min", _edje_lua_description_get_min},
return 0;
}
-/**
-@page luaref
-@setters
-@li Description.alignment: (x,y)
-@li Description.min: (w,h)
-@li Description.max: (w,h)
-@li Description.step: (w,h)
-@li Description.aspect: (x,y)
-@li Description.aspect_pref
-@li Description.color: (r,g,b,a)
-@li Description.color2: (r,g,b,a)
-@li Description.color3: (r,g,b,a)
-@li Description.color_class
-@li Description.rel1: (x,y)
-@li Description.rel1_to: (to_x,to_y)
-@li Description.rel1_offset: (x,y)
-@li Description.rel2: (x,y)
-@li Description.rel2_to: (to_x,to_y)
-@li Description.rel2_offset: (x,y)
-@li Description.image
-@li Description.border: (l,r,t,b)
-@li Description.fill_smooth
-@li Description.fill_pos: (rel_x,rel_y,offset_x,offset_y)
-@li Description.fill_size: (rel_x,rel_y,offset_x,offset_y)
-@li Description.text
-@li Description.text_class
-@li Description.text_font
-@li Description.text_style
-@li Description.text_size
-@li Description.text_fit: (x,y)
-@li Description.text_min: (x,y)
-@li Description.text_max: (x,y)
-@li Description.text_align: (x,y)
-@li Description.visible
-*/
const luaL_Reg lDescription_set[] = {
{"alignment", _edje_lua_description_set_alignment},
{"min", _edje_lua_description_set_min},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Part,Part Class}
-
-Parts are objects, that is, they inherit the methods from the @ref Object class.
-They also contain the following methods and attributes:
-
-*/
const luaL_Reg lPart_get[];
const luaL_Reg lPart_set[];
static int _edje_lua_part_fn_custom_state(lua_State *L);
-/**
-@page luaref
-@attributes
-@li @ref Object Part.swallow
-@li Part.drag_dir
-@li Part.drag_value: (dx,dy)
-@li Part.drag_size: (dx,dy)
-@li Part.drag_step: (dx,dy)
-@li Part.drag_page: (dx,dy)
-@li Part.type
-@li Part.effect
-@li Part.mouse_events
-@li Part.states_list
-@li Part.state: (state,value)
-@li Part.text
-@li Part.text_selection
-@li Part.text_cursor_geometry: (x,y,w,h)
-@li Part.geometry: (x,y,w,h)
-@li Part.part_col_row_size: (cols,rows)
-*/
const luaL_Reg lPart_get[] = {
{"custom_state", _edje_lua_part_fn_custom_state},
{"Swallow", _edje_lua_part_get_swallow}, //TODO it the capital S correct?
return 0;
}
-/**
-@page luaref
-@setters
-@li Part.drag_value: (dx,dy)
-@li Part.drag_size: (dx,dy)
-@li Part.drag_step: (dx,dy)
-@li Part.drag_page: (dx,dy)
-@li Part.effect
-@li Part.mouse_events
-@li Part.repeat_events
-@li Part.state: (state,value)
-@li Part.tween_state
-@li Part.text
-*/
const luaL_Reg lPart_set[] = {
{"drag_value", _edje_lua_part_set_drag_value},
{"drag_size", _edje_lua_part_set_drag_size},
return 1;
}
-/**
-@page luaref
-@methods
-@li Part:swallow(obj)
-@li Part:unswallow()
-@li @ref PartDescription Part:custom_state(state_name, state_val)
-@li Part:text_select_none
-@li Part:text_select_all
-@li Part:text_insert(text)
-@li Part:table_pack(child, row, colspan, rowspan)
-@li Part:table_unpack(child)
-@li Part:table_clear(clear)
-@li Part:box_append(item)
-@li Part:box_prepend(item)
-@li Part:box_insert_before(item, before)
-@li Part:box_insert_at(item, index)
-@li Part:box_remove(item)
-@li Part:box_remove_at(item, index)
-@li Part:box_remove_all(clear)
-*/
const luaL_Reg lPart_fn[] = {
{"swallow", _edje_lua_part_fn_swallow},
{"unswallow", _edje_lua_part_fn_unswallow},
{NULL, NULL} // sentinel
};
-/**
-@page luaref
-@luaclass{Group,Group Class}
-
-Groups are objects, that is, they inherit the methods from the general
-@ref Object Class.
-They also contain the following methods and attributes:
-*/
const luaL_Reg lGroup_mt[];
const luaL_Reg lGroup_get[];
return 1;
}
-/**
-@page luaref
-@attributes
-@li Group.group
-@li Group.mouse: (x,y)
-@li Group.mouse_buttons
-@li Group.size_min: (w,h)
-@li Group.size_max: (w,h)
-@li Group.scale
-@li Group.load_error
-@li Group.load_error_str
-@li Group.play
-@li Group.animation
-@li Group.frametime
-*/
const luaL_Reg lGroup_get[] = {
{"group", _edje_lua_group_get_group},
{"mouse", _edje_lua_group_get_mouse},
edje_frametime_set(luaL_checknumber(L, 2));
return 0;
}
-/**
-@page luaref
-@setters
-@li Group.group
-@li Group.size_min: (w,h)
-@li Group.size_max: (w,h)
-@li Group.scale
-@li Group.play
-@li Group.animation
-@li Group.text_change_cb
-@li Group.frametime
-*/
const luaL_Reg lGroup_set[] = {
{"group", _edje_lua_group_set_group},
{"size_min", _edje_lua_group_set_size_min},
return 0;
}
-/**
-@page luaref
-@methods
-@li @ref Timer Group:timer(secs, callback)
-@li @ref Animator Group:animator(func)
-@li @ref Poller Group:poller(interval, callback)
-@li @ref Transform Group:transform()
-@li Group:signal_emit(emission, source)
-@li Group:message_send(message_type, id, msg)
-@li Group:program_run(name)
-@li Group:program_stop(name)
-@li Group:signal_callback_add(emission, source, callback)
-@li Group:signal_callback_del(emission, source)
-@li Group:freeze()
-@li Group:thaw()
-*/
const luaL_Reg lGroup_fn[] = {
{"timer", _edje_lua_group_fn_timer},
{"animator", _edje_lua_group_fn_animator},
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+/**
+ * @page luaref Edje LUA scripting
+ *
+ * @section intro Introduction
+ *
+ * LUA is intended for script-only objects at this point (with embryo left
+ * for augmenting standard programs). Since script-only objects effectively
+ * define objects entirely via LUA script (resize handling, event handling
+ * etc. etc.) this places many more demands on them, and thus a more powerful
+ * language is in order. LUA is that language.
+ *
+ * To get you started, here's an example:
+ * @code
+ * collections {
+ * group { name: "example";
+ * lua_script_only: 1;
+ * lua_script {
+ * --// stick object private/local vars here
+ * local D;
+ * local count = 0;
+ * local fndata = 99;
+ *
+ * local function mycb3 (v)
+ * print("lua::callback transition " .. D.val .. " v: " .. v);
+ * d = {};
+ * edje.size(d);
+ * print("lua::objsize= " .. d.w .. " , " .. d.h);
+ * sz = {w=v * 80, h=v * 40};
+ * D.rect:geom(((d.w / 2) * math.sin(v * 2 * math.pi)) + ((d.w - sz.w) / 2),
+ * ((d.h / 2) * math.cos(v * 2 * math.pi)) + ((d.h - sz.h) / 2),
+ * sz.w, sz.h);
+ * D.rect:color(255, 128, v * 255, 255);
+ * D.rect:move(d);
+ * print("lua::pos= " .. d.x .. " , " .. d.y);
+ *
+ * r = D.rect:above();
+ * if (r ~= nil) then
+ * print("lua::rcol");
+ * r:color(20, v * 255, 60, 255);
+ * else
+ * print("lua::r none!!!!!!!!!!!!!!1");
+ * end
+ * d = edje.size();
+ * D.clip:geom(10, 10, d.w - 20, d.h - 20);
+ * c = D.clip:clipees();
+ * for i=1,table.getn(c),1 do
+ * d = c[i]:geom();
+ * print("lua::" .. i .. " geom = " .. d.x .. "," .. d.y .. " " .. d.w .. "x" .. d.h);
+ * end
+ * return true;
+ * end
+ *
+ * local function mycb2 ()
+ * print("lua::callback animator " .. count);
+ * print("lua:: seconds: " .. edje.seconds());
+ * print("lua:: looptime: " .. edje.looptime());
+ * local date = edje.date();
+ * print("lua:: date: " ..
+ * date.year .. "|" ..
+ * date.month .. "|" ..
+ * date.day .. "|" ..
+ * date.yearday .. "|" ..
+ * date.weekday .. "|" ..
+ * date.hour .. "|" ..
+ * date.min .. "|" ..
+ * date.sec
+ * );
+ * return true;
+ * end
+ *
+ * local function mycb ()
+ * print("lua::callback " .. count .. " fndata = " .. fndata);
+ * count = count + 1; --// keep count of calls - object data
+ * fndata = fndata + 3; --// play with object vars to see if they persist
+ * D.tim = edje.timer(0.25, mycb); --// inside cb add new timer
+ * D.ani = edje.animator(mycb2);
+ * return false; --// cease repeating the timer
+ * end
+ *
+ * --// init object here
+ * D = {}; --// data is empty table to start
+ * D.val = math.random(); --// start with soem random value so
+ * fndata = fndata + D.val; --// func data start point
+ * print("lua::init ... " .. D.val);
+ * edje.echo("lua::echo('hello world')");
+ * --// actually add the timer to call mycb in 1.23 sec
+ * D.tim = edje.timer(1.23, mycb);
+ * D.tra = edje.transition(5.0, mycb3);
+ *
+ * if (edje.spanky) then edje.spanky(); end
+ *
+ * edje.messagesend(7, "none" );
+ * edje.messagesend(7, "sig", "signal", "source");
+ * edje.messagesend(7, "str", "hello world");
+ * edje.messagesend(7, "int", 987);
+ * edje.messagesend(7, "float", 987.321);
+ * edje.messagesend(7, "strset", {"hello", "there", "world"});
+ * edje.messagesend(7, "intset", {1, 2, 3});
+ * edje.messagesend(7, "floatset", {1.1, 2.2, 3.3});
+ * edje.messagesend(7, "strint", "hello world", 7);
+ * edje.messagesend(7, "strfloat", "hello world", 7.654);
+ * edje.messagesend(7, "strintset","hello world", {1, 2, 3});
+ *
+ * D.rect = edje.rect();
+ * D.rect:geom (5, 10, 50, 30);
+ * D.rect:color (255, 128, 60, 255);
+ * D.rect:show ();
+ *
+ * D.rect2 = edje.rect();
+ * D.rect2:geom (50, 50, 50, 50);
+ * D.rect2:color (20, 30, 60, 120);
+ * D.rect2:show ();
+ *
+ * D.clip = edje.rect();
+ * D.clip:geom (10, 10, 150, 150);
+ * D.clip:color (200, 200, 50, 200);
+ * D.clip:show ();
+ *
+ * D.rect2:clip(D.clip);
+ * D.rect:clip(D.clip);
+ *
+ * --// example of deleting something
+ * --// D.tim:del();
+ *
+ * --// shutdown func - generally empty or not there. everything gcd for you
+ * function shutdown ()
+ * print("lua::shutdown ... " .. D.val);
+ * end
+ * function show ()
+ * print("lua::show ... " .. D.val);
+ * end
+ * function hide ()
+ * print("lua::hide ... " .. D.val);
+ * end
+ * function move (x, y)
+ * print("lua::move ... " .. D.val);
+ * print(" x=" .. x .. " x=" .. y);
+ * end
+ * function resize (w, h)
+ * print("lua::resize ... " .. D.val);
+ * print(" w=" .. w .. " h=" .. h);
+ * end
+ * function message (id, type, v1, v2)
+ * print("lua::message ... " .. D.val);
+ * print(" id=" .. id .. " type=" .. type);
+ * --// handle youre message type here. chekc id + type then use v1
+ * --// and/or v2 (or neither) appropriately. they are the same as
+ * --// the 2nd and 3rd param passed to edje.messagesend() (if any
+ * --// are passed at all)
+ * end
+ * function signal (sig, src)
+ * print("lua::signal ... " .. D.val);
+ * print(" sig=" .. sig .. " src=" .. src);
+ * end
+ * }
+ * }
+ * }
+ * @endcode
+ *
+ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
static int _elua_type(lua_State *L);
static int _elua_pass(lua_State *L);
static int _elua_repeat(lua_State *L);
+static int _elua_precise(lua_State *L);
static int _elua_rect(lua_State *L);
// // key up
// // get dragable pos
// // set dragable pos
+// // set drag size, step, page
+// // get drag size, step, page
+// // dragable step
+// // dragable page
// // get part text
// // set part text
// // get swallow part
// // set swallow part
+// // unswallow part
// // textclass change
// // colorclass change
+// // min size get <- ?? maybe set fn
+// // max size get <- ?? maybe set fn
+// // min size caclc (min/max restriction)
+// // preload
+// // preload cancel
+// // play set
+// // animation set
+// // parts extends calc
+// // part object get
+// // part geometry get
+//
+// // LATER: all the entry calls
+// // LATER: box and table calls
+// // LATER: perspective stuff change
//
static const struct luaL_reg _elua_edje_api [] =
{
{"timer", _elua_timer}, // add timer
{"animator", _elua_animator}, // add animator
{"transition", _elua_transition}, // add transition
+ // FIXME: need poller
// system information (time, date blah blah)
{"seconds", _elua_seconds}, // get seconds
{"type", _elua_type}, // get object type
{"pass", _elua_pass}, // set pass events, get pass events
{"repeat", _elua_repeat}, // set repeat events, get repeat events
+ {"precise", _elua_precise}, // set precise inside flag, get precise
+ // FIXME: set callbacks (mouse down, up, blah blah blah)
+ //
// FIXME: set scale (explicit value)
// FIXME: need to set auto-scale (same as scale: 1)
- // FIXME: set precise inside
- // FIXME: set callbacks (mouse down, up, blah blah blah)
+
+ // FIXME: later - set render op, anti-alias, pointer mode (autograb, nograb)
+ // FIXME: later -
// FIXME: map api here
void
_edje_lua2_script_func_move(Edje *ed)
{
+ Eina_List *l;
int err;
-
+
+ // FIXME: move all objects created by script
lua_getglobal(ed->L, "move");
if (!lua_isnil(ed->L, -1))
{
return 1;
}
+static int
+_elua_precise(lua_State *L)
+{
+ Edje_Lua_Obj *obj = (Edje_Lua_Obj *)lua_touserdata(L, 1);
+ Edje_Lua_Evas_Object *elo = (Edje_Lua_Evas_Object *)obj;
+ int n;
+ if (!obj) return 0;
+ if (!obj->is_evas_obj) return 0;
+ n = lua_gettop(L);
+ if (n == 2)
+ {
+ evas_object_precise_is_inside_set(elo->evas_obj, lua_toboolean(L, 2));
+ }
+ lua_pushboolean(L, evas_object_precise_is_inside_get(elo->evas_obj));
+ return 1;
+}
+
//-------------
static void
_elua_evas_obj_free(void *obj)