Enlightenment CVS committal Author : pfritz Project : e17 Module : docs
Dir : e17/docs/cookbook/xml/evas Modified Files: evas_key_bindings.xml evas_smart_intro.xml Log Message: make examples compile again =================================================================== RCS file: /cvs/e/e17/docs/cookbook/xml/evas/evas_key_bindings.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- evas_key_bindings.xml 27 Jul 2004 10:29:59 -0000 1.5 +++ evas_key_bindings.xml 4 Jun 2007 22:58:38 -0000 1.6 @@ -31,41 +31,46 @@ <programlisting> #include <Ecore_Evas.h> #include <Ecore.h> +#include <stdio.h> #define WIDTH 100 #define HEIGHT 100 - Ecore_Evas * ee; - Evas * evas; - Evas_Object * base_rect; +Ecore_Evas * ee; +Evas * evas; +Evas_Object * base_rect; static int main_signal_exit(void *data, int ev_type, void *ev) { - ecore_main_loop_quit(); - return 1; + ecore_main_loop_quit(); + return 1; } -void key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { +void key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ Evas_Event_Key_Down *ev; ev = (Evas_Event_Key_Down *)event_info; printf("You hit key: %s\n", ev->keyname); } -int main(){ +int main() +{ ecore_init(); + ecore_evas_init(); + ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, main_signal_exit, NULL); - ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT); + ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT); ecore_evas_title_set(ee, "EVAS KeyBind Example"); ecore_evas_borderless_set(ee, 0); ecore_evas_show(ee); - evas = ecore_evas_get(ee); + evas = ecore_evas_get(ee); - base_rect = evas_object_rectangle_add(evas); - evas_object_resize(base_rect, (double)WIDTH, (double)HEIGHT); + base_rect = evas_object_rectangle_add(evas); + evas_object_resize(base_rect, WIDTH, HEIGHT); evas_object_color_set(base_rect, 0, 0, 0, 255); evas_object_focus_set(base_rect, 1); evas_object_show(base_rect); @@ -90,7 +95,7 @@ <example> <title>EVAS Keybind Compile</title> <programlisting> -gcc `evas-config --libs --cflags` `ecore-config --libs --cflags` \ +gcc `pkg-config --libs --cflags evas ecore ecore-evas` \ > key_test.c -o key_test </programlisting> </example> @@ -120,7 +125,8 @@ </para> <programlisting> -void key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { +void key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ Evas_Event_Key_Down *ev; ev = (Evas_Event_Key_Down *)event_info; =================================================================== RCS file: /cvs/e/e17/docs/cookbook/xml/evas/evas_smart_intro.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evas_smart_intro.xml 29 Jul 2004 22:30:26 -0000 1.2 +++ evas_smart_intro.xml 4 Jun 2007 22:58:38 -0000 1.3 @@ -100,11 +100,6 @@ static Evas_Object *foo_object_new(Evas *evas); static void _foo_object_add(Evas_Object *o); static void _foo_object_del(Evas_Object *o); -static void _foo_object_layer_set(Evas_Object *o, int l); -static void _foo_object_raise(Evas_Object *o); -static void _foo_object_lower(Evas_Object *o); -static void _foo_object_stack_above(Evas_Object *o, Evas_Object *above); -static void _foo_object_stack_below(Evas_Object *o, Evas_Object *below); static void _foo_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y); static void _foo_object_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h); static void _foo_object_show(Evas_Object *o); @@ -171,11 +166,11 @@ smart = evas_smart_new("foo_object", _foo_object_add, _foo_object_del, - _foo_object_layer_set, - _foo_object_raise, - _foo_object_lower, - _foo_object_stack_above, - _foo_object_stack_below, + NULL, + NULL, + NULL, + NULL, + NULL, _foo_object_move, _foo_object_resize, _foo_object_show, @@ -202,6 +197,8 @@ <function>evas_smart_new()</function>. To this function we pass in the name of the smart object, all of the callback routines for the smart object, and any user data. In this case we don't have user data so we set it to NULL. +Futher you see some NULLs between the callbacks. There used to more callbacks +to define, but they are historical and no longer used by evas. </para> <para> @@ -273,72 +270,12 @@ </programlisting> The <function>_foo_object_del()</function> callback will be executed if the user calls <function>evas_object_del()</function> on our object. For this -object its as simple as <function>evas_object_del</function>ing our three +object it's as simple as <function>evas_object_del</function>ing our three rectangles and freeing our <literal>Foo_Object</literal> data structure. </para> <para> <programlisting> -static void _foo_object_layer_set(Evas_Object *o, int l) { - Foo_Object *data; - - if ((data = evas_object_smart_data_get(o))) { - evas_object_layer_set(data->clip, l); - } -} - -static void _foo_object_raise(Evas_Object *o) { - Foo_Object *data; - - if ((data = evas_object_smart_data_get(o))) { - evas_object_raise(data->clip); - } -} - -static void _foo_object_lower(Evas_Object *o) { - Foo_Object *data; - - if ((data = evas_object_smart_data_get(o))) { - evas_object_lower(data->clip); - } -} - -static void _foo_object_stack_above(Evas_Object *o, Evas_Object *above) { - Foo_Object *data; - - if ((data = evas_object_smart_data_get(o))) { - evas_object_stack_above(data->clip, above); - } -} - -static void _foo_object_stack_below(Evas_Object *o, Evas_Object *below) { - Foo_Object *data; - - if ((data = evas_object_smart_data_get(o))) { - evas_object_stack_below(data->clip, below); - } -} -</programlisting> -This group of functions: <function>_foo_object_layer_set()</function>, -<function>_foo_object_raise()</function>, -<function>_foo_object_lower()</function>, -<function>_foo_object_stack_above()</function>, and -<function>_foo_object_stack_below()</function> all work in the same fashion, -applying the required <function>evas_object_*</function> function on the -<literal>data->clip</literal> object. -</para> - -<para> -These functions are triggered through the use of: -<function>evas_object_layer_set()</function>, -<function>evas_object_raise()</function>, -<function>evas_object_lower()</function>, -<function>evas_object_stack_above()</function>, and -<function>evas_object_stack_below()</function> respectively. -</para> - -<para> -<programlisting> static void _foo_object_move(Evas_Object *o, Evas_Coord x, Evas_Coord y) { Foo_Object *data; @@ -386,7 +323,7 @@ } } </programlisting> -The <function>_foo_object_resize()</function> calback will be triggered when +The <function>_foo_object_resize()</function> callback will be triggered when the user calls <function>evas_object_resize()</function> on our object. So, for our object, we need to resize <literal>data->clip</literal> and <literal>data->outer</literal> to the full size available for our object. @@ -499,6 +436,7 @@ Evas_Object *o; ecore_init(); + ecore_evas_init(); ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, WIDTH, HEIGHT); ecore_evas_title_set(ee, "Smart Object Example"); @@ -515,7 +453,7 @@ o = foo_new(evas); evas_object_move(o, 0, 0); - evas_object_resize(o, (double)WIDTH, (double)HEIGHT); + evas_object_resize(o, WIDTH, HEIGHT); evas_object_layer_set(o, 0); evas_object_show(o); @@ -550,7 +488,7 @@ <programlisting> o = foo_new(evas); evas_object_move(o, 0, 0); - evas_object_resize(o, (double)WIDTH, (double)HEIGHT); + evas_object_resize(o, WIDTH, HEIGHT); evas_object_layer_set(o, 0); evas_object_show(o); </programlisting> @@ -573,7 +511,7 @@ <title>Compilation</title> <screen> [EMAIL PROTECTED] [evas_smart] -> gcc -o foo foo.c main.c \ - `ecore-config --cflags --libs` `evas-config --cflags --libs` + `pkg-config --cflags --libs evas ecore ecore-evas` </screen> </example> </para> ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs