Ecore: ecore evas callbacks documentation.
authorgastal <gastal@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 2 Aug 2011 13:52:26 +0000 (13:52 +0000)
committergastal <gastal@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 2 Aug 2011 13:52:26 +0000 (13:52 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61998 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

doc/examples.dox
src/examples/Makefile.am
src/examples/ecore_evas_callbacks.c [new file with mode: 0644]
src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c

index 3c441da..fe609a7 100644 (file)
@@ -14,6 +14,7 @@
  * @li @ref ecore_con_url_download_example_c
  * @li @ref ecore_con_server_simple_example_c
  * @li @ref ecore_con_client_simple_example_c
+ * @li @ref ecore_evas_callbacks_example_c
  *
  */
 
  *
  * @example ecore_thread_example.c
  */
+
+/**
+ * @page ecore_evas_callbacks_example_c Ecore Evas Callbacks
+ * @dontinclude ecore_evas_callbacks.c
+ *
+ * Our example is remarkably simple, all it does is create an Ecore_Evas and
+ * register a callback for a bunch of events. What's interesting here is
+ * knowing when each of these callbacks will be called, however since that
+ * depends on the underlying windowing system there are no guarantees that all
+ * of the callbacks will be called for your windowing system. To know which
+ * callbacks will be called for your windowing system run the example and
+ * redirect the output to a file, and take a look at it.
+ *
+ * @note Make sure you minimize, resize, give and remove focus to see more
+ * callbacks called.
+ *
+ * Here you have the full-source of the code:
+ * @include ecore_evas_callbacks.c
+ * @example ecore_evas_callbacks.c
+ */
\ No newline at end of file
index 26c72b1..f21b41d 100644 (file)
@@ -42,7 +42,8 @@ SRCS = \
        ecore_file_download_example.c \
        ecore_pipe_simple_example.c \
        ecore_pipe_gstreamer_example.c \
-       ecore_thread_example.c
+       ecore_thread_example.c \
+       ecore_evas_callbacks.c
 
 EXTRA_DIST = $(SRCS)
 
@@ -71,7 +72,8 @@ pkglib_PROGRAMS += \
        ecore_con_server_simple_example \
        ecore_con_server_http_example \
        ecore_con_client_simple_example \
-       ecore_thread_example
+       ecore_thread_example \
+       ecore_evas_callbacks
 
 ecore_animator_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la
 ecore_con_lookup_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la
diff --git a/src/examples/ecore_evas_callbacks.c b/src/examples/ecore_evas_callbacks.c
new file mode 100644 (file)
index 0000000..31b724d
--- /dev/null
@@ -0,0 +1,127 @@
+/**
+ * Ecore example illustrating ecore evas callbacks.
+ *
+ * You'll need at least one Evas engine built for it (excluding the
+ * buffer one). See stdout/stderr for output.
+ *
+ * @verbatim
+ * gcc -o ecore_evas_callbacks ecore_evas_callbacks.c `pkg-config --libs --cflags ecore-evas`
+ * @endverbatim
+ */
+
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+
+static void
+_destroy(Ecore_Evas *ee)
+{
+   printf("destroy\n");
+   ecore_main_loop_quit();
+}
+
+static void
+_delete(Ecore_Evas *ee)
+{
+   printf("delete\n");
+   ecore_main_loop_quit();
+}
+
+static void
+_focus_in(Ecore_Evas *ee)
+{
+   printf("focus_in\n");
+}
+
+static void
+_focus_out(Ecore_Evas *ee)
+{
+   printf("focus_out\n");
+}
+
+static void
+_hide(Ecore_Evas *ee)
+{
+   printf("hide\n");
+}
+
+static void
+_mouse_in(Ecore_Evas *ee)
+{
+   printf("mouse_in\n");
+}
+
+static void
+_show(Ecore_Evas *ee)
+{
+   printf("show\n");
+}
+
+static void
+_mouse_out(Ecore_Evas *ee)
+{
+   printf("mouse_out\n");
+}
+
+static void
+_move(Ecore_Evas *ee)
+{
+   printf("move\n");
+}
+
+static void
+_post_render(Ecore_Evas *ee)
+{
+   printf("post_render\n");
+}
+
+static void
+_pre_free(Ecore_Evas *ee)
+{
+   printf("pre_free\n");
+}
+
+static void
+_pre_render(Ecore_Evas *ee)
+{
+   printf("pre_render\n");
+}
+
+static void
+_resize(Ecore_Evas *ee)
+{
+   printf("resize\n");
+}
+
+int
+main(void)
+{
+   Ecore_Evas *ee;
+
+   ecore_evas_init();
+
+   ee = ecore_evas_new(NULL, 0, 0, 200, 100, NULL);
+   ecore_evas_title_set(ee, "Ecore Evas Callbacks Example");
+   ecore_evas_show(ee);
+
+   //callbacks
+   ecore_evas_callback_delete_request_set(ee, _delete);
+   ecore_evas_callback_destroy_set(ee, _destroy);
+   ecore_evas_callback_focus_in_set(ee, _focus_in);
+   ecore_evas_callback_focus_out_set(ee, _focus_out);
+   ecore_evas_callback_hide_set(ee, _hide);
+   ecore_evas_callback_mouse_in_set(ee, _mouse_in);
+   ecore_evas_callback_mouse_out_set(ee, _mouse_out);
+   ecore_evas_callback_move_set(ee, _move);
+   ecore_evas_callback_post_render_set(ee, _post_render);
+   ecore_evas_callback_pre_free_set(ee, _pre_free);
+   ecore_evas_callback_pre_render_set(ee, _pre_render);
+   ecore_evas_callback_resize_set(ee, _resize);
+   ecore_evas_callback_show_set (ee, _show);
+
+   ecore_main_loop_begin();
+
+   ecore_evas_free(ee);
+   ecore_evas_shutdown();
+
+   return 0;
+}
index abcca78..1dda9da 100644 (file)
@@ -34,6 +34,9 @@
 /**
  * @file Ecore_Evas.h
  * @brief Evas wrapper functions
+ *
+ * The following is a list of example that partially exemplify Ecore_Evas's API:
+ * @li @ref ecore_evas_callbacks_example_c
  */
 
 /* FIXME:
@@ -269,20 +272,185 @@ EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e);
 EAPI void        ecore_evas_free(Ecore_Evas *ee);
 EAPI void       *ecore_evas_data_get(const Ecore_Evas *ee, const char *key);
 EAPI void        ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data);
+/**
+ * Set a callback for Ecore_Evas resize events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee is resized.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas move events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee is moved.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas show events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee is shown.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas hide events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee is hidden.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas delete request events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee gets a delete request.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas destroy events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee is destroyed.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas focus in events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee gets focus.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas focus out events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee loses focus.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas sticky events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee becomes sticky.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas un-sticky events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever @p ee becomes un-sticky.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas mouse in events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever the mouse enters @p ee.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas mouse out events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever the mouse leaves @p ee.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas pre render events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called just before the evas in @p ee is rendered.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas mouse post render events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called just after the evas in @p ee is rendered.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
+/**
+ * Set a callback for Ecore_Evas pre-free event.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+ *
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called just before the instance @p ee is freed.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ */
 EAPI void        ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee));
 EAPI Evas       *ecore_evas_get(const Ecore_Evas *ee);
 EAPI void        ecore_evas_move(Ecore_Evas *ee, int x, int y);
index 46f88f1..ae78e08 100644 (file)
@@ -909,14 +909,6 @@ ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data)
 #define IFC(_ee, _fn)  if (_ee->engine.func->_fn) {_ee->engine.func->_fn
 #define IFE            return;}
 
-/**
- * Set a callback for Ecore_Evas resize events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee is resized.
- */
 EAPI void
 ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -931,14 +923,6 @@ ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_resize = func;
 }
 
-/**
- * Set a callback for Ecore_Evas move events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee is moved.
- */
 EAPI void
 ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -953,14 +937,6 @@ ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_move = func;
 }
 
-/**
- * Set a callback for Ecore_Evas show events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee is shown.
- */
 EAPI void
 ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -975,14 +951,6 @@ ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_show = func;
 }
 
-/**
- * Set a callback for Ecore_Evas hide events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee is hidden.
- */
 EAPI void
 ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -997,14 +965,6 @@ ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_hide = func;
 }
 
-/**
- * Set a callback for Ecore_Evas delete request events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee gets a delete request.
- */
 EAPI void
 ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1019,14 +979,6 @@ ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas
    ee->func.fn_delete_request = func;
 }
 
-/**
- * Set a callback for Ecore_Evas destroy events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee is destroyed.
- */
 EAPI void
 ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1041,14 +993,6 @@ ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_destroy = func;
 }
 
-/**
- * Set a callback for Ecore_Evas focus in events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee gets focus.
- */
 EAPI void
 ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1063,14 +1007,6 @@ ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_focus_in = func;
 }
 
-/**
- * Set a callback for Ecore_Evas focus out events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee loses focus.
- */
 EAPI void
 ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1085,14 +1021,6 @@ ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_focus_out = func;
 }
 
-/**
- * Set a callback for Ecore_Evas sticky events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee becomes sticky.
- */
 EAPI void
 ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1107,14 +1035,6 @@ ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_sticky = func;
 }
 
-/**
- * Set a callback for Ecore_Evas un-sticky events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever @p ee becomes un-sticky.
- */
 EAPI void
 ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1129,14 +1049,6 @@ ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_unsticky = func;
 }
 
-/**
- * Set a callback for Ecore_Evas mouse in events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever the mouse enters @p ee.
- */
 EAPI void
 ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1151,14 +1063,6 @@ ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_mouse_in = func;
 }
 
-/**
- * Set a callback for Ecore_Evas mouse out events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called whenever the mouse leaves @p ee.
- */
 EAPI void
 ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1173,14 +1077,6 @@ ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
    ee->func.fn_mouse_out = func;
 }
 
-/**
- * Set a callback for Ecore_Evas mouse pre render events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called just before the evas in @p ee is rendered.
- */
 EAPI void
 ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1195,14 +1091,6 @@ ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)
    ee->func.fn_pre_render = func;
 }
 
-/**
- * Set a callback for Ecore_Evas mouse post render events.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
-
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called just after the evas in @p ee is rendered.
- */
 EAPI void
 ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {
@@ -1217,14 +1105,6 @@ ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee
    ee->func.fn_post_render = func;
 }
 
-/**
- * Set a callback for Ecore_Evas pre-free event.
- * @param ee The Ecore_Evas to set callbacks on
- * @param func The function to call
- *
- * A call to this function will set a callback on an Ecore_Evas, causing
- * @p func to be called just before the instance @p ee is freed.
- */
 EAPI void
 ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee))
 {