|
Etk_Signal
Detailed Description
The signal system is a flexible system to create, connect and emit signals.
TODO: write doc for Etk_Signal!!
|
Data Structures |
struct | Etk_Signal |
| The structure of a signal. More...
|
Defines |
#define | ETK_MEMBER_OFFSET(type, member) ((long)((long *)&((type *)0)->member)) |
Functions |
int | etk_signal_new (const char *signal_name, Etk_Type *type, long handler_offset, Etk_Marshaller marshaller) |
| Creates a new signal called signal_name, for the object type type.
|
const char * | etk_signal_name_get (Etk_Signal *signal) |
| Gets the name of the signal.
|
const Etk_Signal_Callback * | etk_signal_connect_full_by_code (int signal_code, Etk_Object *object, Etk_Callback callback, void *data, Etk_Bool swapped, Etk_Bool after) |
| Connects a callback to a signal of the object object.
|
const Etk_Signal_Callback * | etk_signal_connect_full_by_name (const char *signal_name, Etk_Object *object, Etk_Callback callback, void *data, Etk_Bool swapped, Etk_Bool after) |
| Connects a callback to a signal of the object object.
|
void | etk_signal_disconnect_by_code (int signal_code, Etk_Object *object, Etk_Callback callback, void *data) |
| Disconnects a callback from a signal, the callback won't be called anymore when the signal is emitted.
|
void | etk_signal_disconnect_scb_by_code (int signal_code, Etk_Object *object, const Etk_Signal_Callback *scb) |
| Disconnects a callback from a signal, the callback won't be called anymore when the signal is emitted. Removes one specific occurence of a callback function for a signal, identified by the value returned in connect() calls.
|
void | etk_signal_disconnect_all_by_code (int signal_code, Etk_Object *object) |
| Disconnects all callbacks from a signal.
|
void | etk_signal_disconnect_all (const char *signal_name, Etk_Object *object) |
| Disconnects all callbacks from a signal.
|
void | etk_signal_block_by_code (int signal_code, Etk_Object *object, Etk_Callback callback, void *data) |
| Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
|
void | etk_signal_block (const char *signal_name, Etk_Object *object, Etk_Callback callback, void *data) |
| Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
|
void | etk_signal_block_scb_by_code (int signal_code, Etk_Object *object, const Etk_Signal_Callback *scb) |
| Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
|
void | etk_signal_block_scb (const char *signal_name, Etk_Object *object, const Etk_Signal_Callback *scb) |
| Blocks a callback from being called when the corresponding signal is emitted.
|
void | etk_signal_unblock (const char *signal_name, Etk_Object *object, Etk_Callback callback, void *data) |
| Unblocks a blocked callback.
|
void | etk_signal_unblock_scb_by_code (int signal_code, Etk_Object *object, const Etk_Signal_Callback *scb) |
| Unblocks a blocked callback.
|
void | etk_signal_unblock_scb (const char *signal_name, Etk_Object *object, const Etk_Signal_Callback *scb) |
| Unblocks a blocked callback.
|
Etk_Bool | etk_signal_emit (int signal_code, Etk_Object *object,...) |
| Emits the signal: it will call the callbacks connected to the signal signal.
|
Etk_Bool | etk_signal_emit_by_name (const char *signal_name, Etk_Object *object,...) |
| Emits the signal: it will call the callbacks connected to the signal signal.
|
Etk_Bool | etk_signal_emit_valist (Etk_Signal *signal, Etk_Object *object, va_list args) |
| Emits the signal: it will call the callbacks connected to the signal signal.
|
Etk_Marshaller | etk_signal_marshaller_get (Etk_Signal *signal) |
| Gets the marshaller used by the signal.
|
Eina_List * | etk_signal_get_all () |
| Gets a list of all the current signals.
|
Define Documentation
#define ETK_MEMBER_OFFSET |
( |
type, |
|
|
member |
|
) |
((long)((long *)&((type *)0)->member)) |
Gets the offset of a member of a struct (used when you create a new signal with a default handler, with etk_signal_new())
Function Documentation
int etk_signal_new |
( |
const char * |
signal_name, |
|
|
Etk_Type * |
type, |
|
|
long |
handler_offset, |
|
|
Etk_Marshaller |
marshaller | |
|
) |
| | |
Creates a new signal called signal_name, for the object type type.
- Parameters:
-
| signal_name | the name of the new signal. |
| type | the object type of the new signal. |
| handler_offset | the offset of the default handler in the object's struct (use ETK_MEMBER_OFFSET() to get it). -1 if there is no default handler. |
| marshaller | the marshaller of the signal: it will treat and pass the arguments to the callbacks. |
- Returns:
- Returns the new signal code, or -1 in case of failure
const char * etk_signal_name_get |
( |
Etk_Signal * |
signal |
) |
|
Gets the name of the signal.
- Parameters:
-
- Returns:
- Returns the name of the signal, or NULL on failure
const Etk_Signal_Callback * etk_signal_connect_full_by_code |
( |
int |
signal_code, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data, |
|
|
Etk_Bool |
swapped, |
|
|
Etk_Bool |
after | |
|
) |
| | |
Connects a callback to a signal of the object object.
When the signal of the object will be emitted, this callback will be automatically called.
- Parameters:
-
| signal_code | the signal code to connect to the callback |
| object | the object to connect to the callback |
| callback | the callback to call when the signal is emitted. This callback should return Etk_Bool with ETK_TRUE to continue and ETK_FALSE to stop signal propagation to next callbacks during the current emission. |
| data | the data to pass to the callback |
| swapped | if swapped == ETK_TRUE, the callback will be called with data as the only argument. It can be useful to set it to ETK_TRUE if you just want to call one function on an object when the signal is emitted. |
| after | if after == ETK_TRUE, the callback will be called after all the callbacks already connected to this signal. Otherwise, it will be called before all of them (default behavior) |
- Returns:
- Returns a pointer identifying the connected callback, which can be used later for disconnecting only this specific signal.
const Etk_Signal_Callback * etk_signal_connect_full_by_name |
( |
const char * |
signal_name, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data, |
|
|
Etk_Bool |
swapped, |
|
|
Etk_Bool |
after | |
|
) |
| | |
Connects a callback to a signal of the object object.
When the signal of the object will be emitted, this callback will be automatically called.
- Parameters:
-
| signal_name | the signal name to connect to the callback |
| object | the object to connect to the callback |
| callback | the callback to call when the signal is emitted |
| data | the data to pass to the callback |
| swapped | if swapped == ETK_TRUE, the callback will be called with data as the only argument. It can be useful to set it to ETK_TRUE if you just want to call one function on an object when the signal is emitted. |
| after | if after == ETK_TRUE, the callback will be called after all the callbacks already connected to this signal. Otherwise, it will be called before all of them (default behavior) |
- Returns:
- Returns a pointer identifying the connected callback, which can be used later for disconnecting only this specific signal.
void etk_signal_disconnect_by_code |
( |
int |
signal_code, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data | |
|
) |
| | |
Disconnects a callback from a signal, the callback won't be called anymore when the signal is emitted.
- Parameters:
-
| signal_name | the name of the signal connected to the callback to disconnect |
| object | the object connected to the callback to disconnect |
| callback | the callback to disconnect |
| data | passed to the callback when connected |
Disconnects a callback from a signal, the callback won't be called anymore when the signal is emitted. Removes one specific occurence of a callback function for a signal, identified by the value returned in connect() calls.
- Parameters:
-
| signal_code | code of the signal to disconnect |
| object | the object connected to the callback to disconnect |
| scb | the unique signal callback to disconnect |
void etk_signal_disconnect_all_by_code |
( |
int |
signal_code, |
|
|
Etk_Object * |
object | |
|
) |
| | |
Disconnects all callbacks from a signal.
- Parameters:
-
| signal_code | the code of the signal for which all callbacks will be disconnected |
| object | the object for which all callbacks will be disconnected |
void etk_signal_disconnect_all |
( |
const char * |
signal_name, |
|
|
Etk_Object * |
object | |
|
) |
| | |
Disconnects all callbacks from a signal.
- Parameters:
-
| signal_name | the name of the signal for which all callbacks will be disconnected |
| object | the object for which all callbacks will be disconnected |
void etk_signal_block_by_code |
( |
int |
signal_code, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data | |
|
) |
| | |
Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
- Parameters:
-
| signal_code | the code of the signal connected to the callback to block |
| object | the object connected to the callback to block |
| callback | the callback function to block |
| data | passed to the callback when connected |
void etk_signal_block |
( |
const char * |
signal_name, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data | |
|
) |
| | |
Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
- Parameters:
-
| signal_name | the name of the signal connected to the callback to block |
| object | the object connected to the callback to block |
| callback | the callback function to block |
| data | passed to the callback when connected |
Blocks a callback from being called when the corresponding signal is emitted. Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
- Parameters:
-
| signal_code | code of the signal connected to the callback to block |
| object | the object connected to the callback to block |
| scb | the unique signal callback to block |
Blocks a callback from being called when the corresponding signal is emitted.
Unlike etk_signal_disconnect(), the callback is not removed, and can be easily unblock with etk_signal_unblock().
- Parameters:
-
| signal_name | the name of the signal connected to the callback to block |
| object | the object connected to the callback to block |
| scb | the unique signal callback to block |
void etk_signal_unblock |
( |
const char * |
signal_name, |
|
|
Etk_Object * |
object, |
|
|
Etk_Callback |
callback, |
|
|
void * |
data | |
|
) |
| | |
Unblocks a blocked callback.
The callback will no longer be prevented from being called when the corresponding signal is emitted.
- Parameters:
-
| signal_name | name of the signal connected to the callback to unblock |
| object | the object connected to the callback to unblock |
| callback | the callback function to unblock |
| data | passed to the callback when connected |
Unblocks a blocked callback.
See etk_signal_unblock().
- Parameters:
-
| signal_code | code of the signal connected to the callback to unblock |
| object | the object connected to the callback to unblock |
| scb | the unique signal callback to unblock |
Unblocks a blocked callback.
See etk_signal_unblock().
- Parameters:
-
| signal_name | name of the signal connected to the callback to unblock |
| object | the object connected to the callback to unblock |
| scb | the unique signal callback to unblock |
Etk_Bool etk_signal_emit |
( |
int |
signal_code, |
|
|
Etk_Object * |
object, |
|
|
|
... | |
|
) |
| | |
Emits the signal: it will call the callbacks connected to the signal signal.
- Parameters:
-
| signal_code | code of the signal to emit |
| object | the object which will emit the signal |
| ... | the arguments to pass to the callback function |
- Returns:
- Returns ETK_FALSE if the signal has been stopped and ETK_TRUE otherwise
Etk_Bool etk_signal_emit_by_name |
( |
const char * |
signal_name, |
|
|
Etk_Object * |
object, |
|
|
|
... | |
|
) |
| | |
Emits the signal: it will call the callbacks connected to the signal signal.
- Parameters:
-
| signal | the name of the signal to emit |
| object | the object which will emit the signal |
| ... | the arguments to pass to the callback function |
- Returns:
- Returns ETK_FALSE if the signal has been stopped and ETK_TRUE otherwise
Emits the signal: it will call the callbacks connected to the signal signal.
- Parameters:
-
| signal | the signal to emit |
| object | the object which will emit the signal |
| args | the arguments to pass to the callback function |
- Returns:
- Returns object, or NULL if object has been destroyed by one of the callbacks
Returns ETK_FALSE if the signal has been stopped and ETK_TRUE otherwise
Etk_Marshaller etk_signal_marshaller_get |
( |
Etk_Signal * |
signal |
) |
|
Gets the marshaller used by the signal.
- Parameters:
-
- Returns:
- Returns the marshaller used by the signal or NULL on failure
Eina_List * etk_signal_get_all |
( |
|
) |
|
Gets a list of all the current signals.
- Returns:
- Returns an Eina_List containing all the signals.
|
|