Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

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.
Evas_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

References code, Etk_Type::signals, and Etk_Type::signals_count.

const char * etk_signal_name_get ( Etk_Signal *  signal  ) 

Gets the name of the signal.

Parameters:
signal a signal
Returns:
Returns the name of the signal, or NULL on failure

References name.

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.

References ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_signal_connect_full_by_name().

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.

References etk_object_object_type_get(), and etk_signal_connect_full_by_code().

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

References Etk_Signal_Callback::callback, Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_dialog_button_response_id_set(), etk_entry_image_highlight_set(), etk_tooltips_tip_set(), and etk_window_modal_for_window().

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.

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

References Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

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

References Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_signal_disconnect_all().

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

References etk_object_object_type_get(), and etk_signal_disconnect_all_by_code().

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

References Etk_Signal_Callback::callback, Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_signal_block().

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

References etk_object_object_type_get(), and etk_signal_block_by_code().

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().

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

References Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_signal_block_scb().

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.

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

References etk_object_object_type_get(), and etk_signal_block_scb_by_code().

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

References etk_object_object_type_get().

void etk_signal_unblock_scb_by_code ( int  signal_code,
Etk_Object *  object,
const Etk_Signal_Callback *  scb 
)

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

References Etk_Signal_Callback::data, ETK_WARNING, Etk_Type::name, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_signal_unblock_scb().

void etk_signal_unblock_scb ( const char *  signal_name,
Etk_Object *  object,
const Etk_Signal_Callback *  scb 
)

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

References etk_object_object_type_get(), and etk_signal_unblock_scb_by_code().

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

References etk_signal_emit_valist(), ETK_WARNING, Etk_Type::name, Etk_Type::signals, Etk_Type::signals_count, and Etk_Object::type.

Referenced by etk_bin_child_set(), etk_button_click(), etk_button_press(), etk_button_release(), etk_canvas_put(), etk_colorpicker_current_color_set(), etk_combobox_active_item_set(), etk_combobox_entry_active_item_set(), etk_entry_text_set(), etk_iconbox_append(), etk_iconbox_clear(), etk_iconbox_current_model_set(), etk_iconbox_icon_del(), etk_iconbox_icon_select(), etk_iconbox_icon_unselect(), etk_iconbox_model_geometry_set(), etk_iconbox_model_icon_geometry_set(), etk_iconbox_model_label_geometry_set(), etk_iconbox_select_all(), etk_iconbox_thaw(), etk_iconbox_unselect_all(), etk_mdi_area_put(), etk_mdi_window_delete_request(), etk_mdi_window_move(), etk_menu_item_activate(), etk_menu_item_select(), etk_menu_item_unselect(), etk_menu_shell_remove(), etk_notebook_page_child_set(), etk_notebook_page_remove(), etk_object_destroy(), etk_paned_child1_set(), etk_paned_child2_set(), etk_popup_window_popdown(), etk_popup_window_popup_at_xy(), etk_range_value_set(), etk_table_attach(), etk_table_cell_clear(), etk_tree_clear(), etk_tree_col_visible_set(), etk_tree_col_width_set(), etk_tree_row_delete(), etk_tree_row_fields_set_valist(), etk_tree_row_fold(), etk_tree_row_insert_valist(), etk_tree_row_model_fields_set_valist(), etk_tree_row_unfold(), etk_tree_row_unselect(), etk_tree_rows_height_set(), etk_tree_select_all(), etk_tree_thaw(), etk_tree_unselect_all(), etk_widget_disabled_set(), etk_widget_enter(), etk_widget_focus(), etk_widget_hide(), etk_widget_leave(), etk_widget_show(), etk_widget_size_request_full(), etk_widget_unfocus(), and etk_window_delete_request().

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

References etk_object_object_type_get(), etk_signal_emit_valist(), and ETK_WARNING.

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.

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

References code, Etk_Signal_Callback::data, etk_object_weak_pointer_add(), etk_object_weak_pointer_remove(), handler_offset, and marshaller.

Referenced by etk_signal_emit(), and etk_signal_emit_by_name().

Etk_Marshaller etk_signal_marshaller_get ( Etk_Signal *  signal  ) 

Gets the marshaller used by the signal.

Parameters:
signal a signal
Returns:
Returns the marshaller used by the signal or NULL on failure

References marshaller.

Evas_List * etk_signal_get_all (  ) 

Gets a list of all the current signals.

Returns:
Returns an Evas_List containing all the signals.