Edje Communication Interface: Signal

Functions that deal with signals. More...

Typedefs

typedef void(* Edje_Signal_Cb )(void *data, Evas_Object *obj, const char *emission, const char *source)
 Edje signal callback functions's prototype definition. More...
 

Functions

void * edje_object_signal_callback_extra_data_get (void)
 Get extra data passed to callbacks. More...
 
#define edje_obj_signal_callback_add(emission, source, func, data)   EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_ADD), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source), EO_TYPECHECK(Edje_Signal_Cb, func), EO_TYPECHECK(void *, data)
 Add a callback for an arriving Edje signal, emitted by a given Ejde object. More...
 
#define edje_obj_signal_callback_del(emission, source, func, data, ret)   EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_DEL), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source), EO_TYPECHECK(Edje_Signal_Cb, func), EO_TYPECHECK(void *, data), EO_TYPECHECK(void **, ret)
 Remove a signal-triggered callback from an object. More...
 
#define edje_obj_signal_emit(emission, source)   EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_EMIT), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source)
 Send/emit an Edje signal to a given Edje object. More...
 
void edje_object_signal_callback_add (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
 Add a callback for an arriving Edje signal, emitted by a given Edje object. More...
 
void * edje_object_signal_callback_del (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func)
 Remove a signal-triggered callback from an object. More...
 
void * edje_object_signal_callback_del_full (Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
 Unregister/delete a callback set for an arriving Edje signal, emitted by a given Edje object. More...
 
void edje_object_signal_emit (Evas_Object *obj, const char *emission, const char *source)
 Send/emit an Edje signal to a given Edje object. More...
 

Detailed Description

Functions that deal with signals.

Edje has two communication interfaces between code and theme. Signals and messages.

This group has functions that deal with signals. One can either emit a signal from code to a theme or create handles for the ones emitted from themes. Signals are identified by strings.

Macro Definition Documentation

#define edje_obj_signal_callback_add (   emission,
  source,
  func,
  data 
)    EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_ADD), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source), EO_TYPECHECK(Edje_Signal_Cb, func), EO_TYPECHECK(void *, data)

Add a callback for an arriving Edje signal, emitted by a given Ejde object.

Since
1.8
Parameters
[in]emission
[in]source
[in]func
[in]data
See also
edje_object_signal_callback_add
#define edje_obj_signal_callback_del (   emission,
  source,
  func,
  data,
  ret 
)    EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_CALLBACK_DEL), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source), EO_TYPECHECK(Edje_Signal_Cb, func), EO_TYPECHECK(void *, data), EO_TYPECHECK(void **, ret)

Remove a signal-triggered callback from an object.

Since
1.8
Parameters
[in]emission
[in]source
[in]func
[out]ret
See also
edje_object_signal_callback_del

Referenced by edje_object_signal_callback_del_full().

#define edje_obj_signal_emit (   emission,
  source 
)    EDJE_OBJ_ID(EDJE_OBJ_SUB_ID_SIGNAL_EMIT), EO_TYPECHECK(const char *, emission), EO_TYPECHECK(const char *, source)

Send/emit an Edje signal to a given Edje object.

Since
1.8
Parameters
[in]emission
[in]source
See also
edje_object_signal_emit

Referenced by edje_object_signal_emit().

Typedef Documentation

typedef void(* Edje_Signal_Cb)(void *data, Evas_Object *obj, const char *emission, const char *source)

Edje signal callback functions's prototype definition.

data will have the auxiliary data pointer set at the time the callback registration. obj will be a pointer the Edje object where the signal comes from. emission will identify the exact signal's emission string and source the exact signal's source one.

Examples:
edje-color-class.c.

Function Documentation

void* edje_object_signal_callback_extra_data_get ( void  )

Get extra data passed to callbacks.

Returns
the extra data for that callback.

Some callbacks pass extra information. This function gives access to that extra information. It's somehow like event_info in smart callbacks.

See also
edje_object_signal_callback_add() for more on Edje signals.
Since
1.1.0
void edje_object_signal_callback_add ( Evas_Object obj,
const char *  emission,
const char *  source,
Edje_Signal_Cb  func,
void *  data 
)

Add a callback for an arriving Edje signal, emitted by a given Edje object.

Parameters
objA handle to an Edje object
emissionThe signal's "emission" string
sourceThe signal's "source" string
funcThe callback function to be executed when the signal is emitted.
dataA pointer to data to pass in to func.

Edje signals are one of the communication interfaces between code and a given Edje object's theme. With signals, one can communicate two string values at a time, which are:

  • "emission" value: the name of the signal, in general
  • "source" value: a name for the signal's context, in general

Though there are those common uses for the two strings, one is free to use them however they like.

This function adds a callback function to a signal emitted by obj, to be issued every time an EDC program like the following

program {
name: "emit_example";
action: SIGNAL_EMIT "a_signal" "a_source";
}

is run, if emission and source are given those same values, here.

Signal callback registration is powerful, in the way that blobs may be used to match multiple signals at once. All the "*?[\" set of fnmatch() operators can be used, both for emission and source.

Edje has internal signals it will emit, automatically, on various actions taking place on group parts. For example, the mouse cursor being moved, pressed, released, etc., over a given part's area, all generate individual signals.

By using something like

edje_object_signal_callback_add(obj, "mouse,down,*", "button.*",
signal_cb, NULL);

being "button.*" the pattern for the names of parts implementing buttons on an interface, you'd be registering for notifications on events of mouse buttons being pressed down on either of those parts (those events all have the "mouse,down," common prefix on their names, with a suffix giving the button number). The actual emission and source strings of an event will be passed in as the emission and source parameters of the callback function (e.g. "mouse,down,2" and "button.close"), for each of those events.

Note
See the syntax for EDC files
See also
edje_object_signal_emit() on how to emits Edje signals from code to a an object
edje_object_signal_callback_del_full()
Examples:
edje-color-class.c, edje-drag.c, edje-perspective.c, and edje-signals-messages.c.
void* edje_object_signal_callback_del ( Evas_Object obj,
const char *  emission,
const char *  source,
Edje_Signal_Cb  func 
)

Remove a signal-triggered callback from an object.

Parameters
objA valid Evas_Object handle.
emissionThe emission string.
sourceThe source string.
funcThe callback function.
Returns
The data pointer

This function removes a callback, previously attached to the emittion of a signal, from the object obj. The parameters emission, source and func must match exactly those passed to a previous call to edje_object_signal_callback_add(). The data pointer that was passed to this call will be returned.

See also
edje_object_signal_callback_add().
edje_object_signal_callback_del_full().
void* edje_object_signal_callback_del_full ( Evas_Object obj,
const char *  emission,
const char *  source,
Edje_Signal_Cb  func,
void *  data 
)

Unregister/delete a callback set for an arriving Edje signal, emitted by a given Edje object.

Parameters
objA handle to an Edje object
emissionThe signal's "emission" string
sourceThe signal's "source" string
funcThe callback function passed on the callback's registration
dataThe pointer given to be passed as data to func
Returns
data, on success or NULL, on errors (or if data had this value)

This function removes a callback, previously attached to the emittion of a signal, from the object obj. The parameters emission, source, func and data must match exactly those passed to a previous call to edje_object_signal_callback_add(). The data pointer that was passed to this call will be returned.

See also
edje_object_signal_callback_add().
edje_object_signal_callback_del().

References edje_obj_signal_callback_del.

void edje_object_signal_emit ( Evas_Object obj,
const char *  emission,
const char *  source 
)

Send/emit an Edje signal to a given Edje object.

Parameters
objA handle to an Edje object
emissionThe signal's "emission" string
sourceThe signal's "source" string

This function sends a signal to the object obj. An Edje program, at obj's EDC specification level, can respond to a signal by having declared matching 'signal' and 'source' fields on its block (see the syntax for EDC files).

As an example,

edje_object_signal_emit(obj, "a_signal", "");

would trigger a program which had an EDC declaration block like

program {
name: "a_program";
signal: "a_signal";
source: "";
action: ...
}
See also
edje_object_signal_callback_add() for more on Edje signals.
Examples:
edje-perspective.c, and edje-signals-messages.c.

References edje_obj_signal_emit.