Enlightenment CVS committal Author : dresb Project : e17 Module : docs
Dir : e17/docs/devwithedje/xml Modified Files: interacting_with_the_objects.xml intro_to_gui.xml Log Message: this is the definitive version of the introductory chapters. =================================================================== RCS file: /cvs/e/e17/docs/devwithedje/xml/interacting_with_the_objects.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- interacting_with_the_objects.xml 15 Jan 2008 02:33:41 -0000 1.1 +++ interacting_with_the_objects.xml 17 Jan 2008 00:07:49 -0000 1.2 @@ -4,7 +4,7 @@ <para>To understand how to interact with Edje or any other Evas object we need to review the basics of how the main loop manager handles events. Ecore maintains a list of pointers to functions to be called - when a signal from a given type is recieved. These functions + when a signal from a given type is received. These functions are known as signal "handlers".</para> <para>By default, Ecore awareness is limited to system singals like HUP or @@ -49,10 +49,12 @@ its a pointer to any kind of data you want to pass to the handler function, in this case is just a string containing "data".</para> - <para>Interaction with the interface is pretty much the same, the handler - function for signals comming from Edje interfaces is defined by the - Edje library. Our own handler function is called by the real handler - after it filters the signal's properties name and source: + <para>Interaction with the interface works in a similar way. The Edje + library registers its own handler function in the Ecore loop. This + handler will be called for every signal coming from the interface. + Therefore, in order to react to interface events we need to register + our functions as "callbacks" in this handler's list: + <programlisting role="C"> ... void @@ -73,17 +75,26 @@ ... </programlisting> - There are quite a few things going on in this example, "colorize" - calls functions from both the Evas API <code>evas_pointer_canvas_xy_get</code> - and the Edje API <code>edje_color_class_set</code>. The first call - gets the coordinates of the mouse pointer position. The second call - uses those values to alter the color class "main color". </para> - - <para>Inside of main we use a wrapper function to include our handler, this - wrapper will call our handler when the signal "mouse,move" is emitted - by any object in the interface, hence the wilcard. If you use the - EDC theme included in the assembled example the result will be a - small rectangle in the middle of the canvas that changes of color as - we move our mouse.</para> + The resulting application changes the color of every part using the + "main color" color class every time the mouse moves inside the + interface. If you use the EDC theme included in the assembled example + the result will be a small rectangle in the middle of the canvas that + changes of color as we move our mouse around.</para> + + <para>The function that produces this effect is our handler, or callback, + <code>colorize</code>. We call functions from the Evas API + <code>evas_pointer_canvas_xy_get</code> and the Edje API + <code>edje_color_class_set</code>. The first call gets the current + coordinates of the mouse pointer position. The second call uses + those values to alter the color class "main color".</para> + + <para>Before the main loop begins we use <code>edje_object_signal_callback_add</code> + to register our callback. The real handler keeps its own list of + functions to call. This list's index is a combination of the signal + identification and the name of the source that emitted it. In this + particular case, the function <code>colorize</code> will be called + when the signal "mouse,move" is emitted by any object in the + interface. Edje string matching supports wildcards for both the + name and source of the signal.</para> </section> =================================================================== RCS file: /cvs/e/e17/docs/devwithedje/xml/intro_to_gui.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- intro_to_gui.xml 15 Jan 2008 02:33:41 -0000 1.1 +++ intro_to_gui.xml 17 Jan 2008 00:07:49 -0000 1.2 @@ -40,9 +40,9 @@ <para>Between the backend and the frontend is where the Event loop lives, its mission is to connect both ends of the application. Not only between them but also with their environment. The Event loop mantains - a table using a signal type as the index and a pointer to a function - as the value. When a signal is received, the Event loop looks through - the table and executes the corresponding function.</para> + a list of signals to look out for and functions related to them. When + a signal is received, the Event loop looks through the list and + executes the corresponding function or functions.</para> <para>For the application to work, the Event loop needs to be aware of events in the interface thus it is usually provided by the same ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs