From 81dea8dfa107b870c2f3e0f89d2f7689aa78a776 Mon Sep 17 00:00:00 2001 From: davemds Date: Tue, 9 Mar 2010 00:55:36 +0000 Subject: [PATCH] * Document mouse event callback system in LUA git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@47063 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- doc/Doxyfile | 1 + src/lib/edje_lua.c | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index c9c7dd6..2cd7cc9 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -194,6 +194,7 @@ ALIASES += edcsection{2}="\2" ALIASES += attributes="
Attributes:
" ALIASES += methods="
Methods:
" +ALIASES += events="
Events:
" ALIASES += setters="
Setters:
" ALIASES += seealso{2}="See also: \1\n" ALIASES += seealso{1}="See also: \1\n" diff --git a/src/lib/edje_lua.c b/src/lib/edje_lua.c index 5cb8ba4..652748c 100644 --- a/src/lib/edje_lua.c +++ b/src/lib/edje_lua.c @@ -1373,8 +1373,28 @@ const luaL_Reg lTransition_fn[] = { @page luaref @luaclass{Object,General Object Class} -Within the lua_script scope, Edje objects (groups, parts, etc) have the -following basic attributes and methods: +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} */ @@ -2326,6 +2346,16 @@ const luaL_Reg lObject_set[] = { {"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, -- 2.7.4