Evas_Canvas_Events

Langue: en

Version: 383725 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Canvas Events -

Canvas generates some events.

Functions


EAPI void evas_event_callback_add (Evas *e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Add a callback function to the canvas.
EAPI void * evas_event_callback_del (Evas *e, Evas_Callback_Type type, Evas_Event_Cb func)
Delete a callback function from the canvas.
EAPI void * evas_event_callback_del_full (Evas *e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
Delete a callback function from the canvas.
EAPI void evas_post_event_callback_push (Evas *e, Evas_Object_Event_Post_Cb func, const void *data)
Push a callback on the post-event callback stack.
EAPI void evas_post_event_callback_remove (Evas *e, Evas_Object_Event_Post_Cb func)
Remove a callback from the post-event callback stack.
EAPI void evas_post_event_callback_remove_full (Evas *e, Evas_Object_Event_Post_Cb func, const void *data)
Remove a callback from the post-event callback stack.

Detailed Description

Canvas generates some events.

Function Documentation

EAPI void evas_event_callback_add (Evas * e, Evas_Callback_Type type, Evas_Event_Cb func, const void * data)

Add a callback function to the canvas. Parameters:

e Canvas to attach a callback to
type The type of event that will trigger the callback
func The function to be called when the event is triggered
data The data pointer to be passed to func

This function adds a function callback to the canvas when the event of type type occurs on canvas e. The function is func.

In the event of a memory allocation error during addition of the callback to the canvas, evas_alloc_error() should be used to determine the nature of the error, if any, and the program should sensibly try and recover.

The function will be passed the pointer data when it is called. A callback function must look like this:

  void callback (void *data, Evas *e, void *event_info);
 

The first parameter data in this function will be the same value passed to evas_event_callback_add() as the data parameter. The second parameter e is the canvas handle on which the event occured. The third parameter event_info is a pointer to a data structure that may or may not be passed to the callback, depending on the event type that triggered the callback.

The event type type to trigger the function may be one of EVAS_CALLBACK_RENDER_FLUSH_PRE, EVAS_CALLBACK_RENDER_FLUSH_POST, EVAS_CALLBACK_CANVAS_FOCUS_IN, EVAS_CALLBACK_CANVAS_FOCUS_OUT. This determines the kind of event that will trigger the callback to be called. So far none of the event types provide useful data, so in all of them event_info pointer is NULL.

Example:

  extern Evas *e;
  extern void *my_data;
  void focus_in_callback(void *data, Evas *e, void *event_info);
  void focus_out_callback(void *data, Evas *e, void *event_info);
 
  evas_event_callback_add(e, EVAS_CALLBACK_CANVAS_FOCUS_IN, focus_in_callback, my_data);
  if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE)
    {
      fprintf(stderr, 'ERROR: Callback registering failed! Abort!);
      exit(-1);
    }
  evas_event_callback_add(e, EVAS_CALLBACK_CANVAS_FOCUS_OUT, focus_out_callback, my_data);
  if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE)
    {
      fprintf(stderr, 'ERROR: Callback registering failed! Abort!);
      exit(-1);
    }
 
 


 

EAPI void* evas_event_callback_del (Evas * e, Evas_Callback_Type type, Evas_Event_Cb func)

Delete a callback function from the canvas. Parameters:

e Canvas to remove a callback from
type The type of event that was triggering the callback
func The function that was to be called when the event was triggered

Returns:

The data pointer that was to be passed to the callback

This function removes the most recently added callback from the canvas e which was triggered by the event type type and was calling the function func when triggered. If the removal is successful it will also return the data pointer that was passed to evas_event_callback_add() when the callback was added to the canvas. If not successful NULL will be returned.

Example:

  extern Evas *e;
  void *my_data;
  void focus_in_callback(void *data, Evas *e, void *event_info);
 
  my_data = evas_event_callback_del(ebject, EVAS_CALLBACK_CANVAS_FOCUS_IN, focus_in_callback);
 
 


 

EAPI void* evas_event_callback_del_full (Evas * e, Evas_Callback_Type type, Evas_Event_Cb func, const void * data)

Delete a callback function from the canvas. Parameters:

e Canvas to remove a callback from
type The type of event that was triggering the callback
func The function that was to be called when the event was triggered
data The data pointer that was to be passed to the callback

Returns:

The data pointer that was to be passed to the callback

This function removes the most recently added callback from the canvas e which was triggered by the event type type and was calling the function func with data data when triggered. If the removal is successful it will also return the data pointer that was passed to evas_event_callback_add() (that will be the same as the parameter) when the callback was added to the canvas. If not successful NULL will be returned.

Example:

  extern Evas *e;
  void *my_data;
  void focus_in_callback(void *data, Evas *e, void *event_info);
 
  my_data = evas_event_callback_del_full(ebject, EVAS_CALLBACK_CANVAS_FOCUS_IN, focus_in_callback, my_data);
 
 


 

EAPI void evas_post_event_callback_push (Evas * e, Evas_Object_Event_Post_Cb func, const void * data)

Push a callback on the post-event callback stack. Parameters:

e Canvas to push the callback on
func The function that to be called when the stack is unwound
data The data pointer to be passed to the callback

Evas has a stack of callbacks that get called after all the callbacks for an event have triggered (all the objects it triggers on and al the callbacks in each object triggered). When all these have been called, the stack is unwond from most recently to least recently pushed item and removed from the stack calling the callback set for it.

This is intended for doing reverse logic-like processing, example - when a child object that happens to get the event later is meant to be able to 'steal' functions from a parent and thus on unwind of this stack hav its function called first, thus being able to set flags, or return 0 from the post-callback that stops all other post-callbacks in the current stack from being called (thus basically allowing a child to take control, if the event callback prepares information ready for taking action, but the post callback actually does the action).

EAPI void evas_post_event_callback_remove (Evas * e, Evas_Object_Event_Post_Cb func)

Remove a callback from the post-event callback stack. Parameters:

e Canvas to push the callback on
func The function that to be called when the stack is unwound

This removes a callback from the stack added with evas_post_event_callback_push(). The first instance of the function in the callback stack is removed from being executed when the stack is unwound. Further instances may still be run on unwind.

EAPI void evas_post_event_callback_remove_full (Evas * e, Evas_Object_Event_Post_Cb func, const void * data)

Remove a callback from the post-event callback stack. Parameters:

e Canvas to push the callback on
func The function that to be called when the stack is unwound
data The data pointer to be passed to the callback

This removes a callback from the stack added with evas_post_event_callback_push(). The first instance of the function and data in the callback stack is removed from being executed when the stack is unwound. Further instances may still be run on unwind.

Author

Generated automatically by Doxygen for Evas from the source code.