Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

Callback: The Callback Mechanisms

Defines methods for creating and modifying callbacks on widgets. More...

Defines

#define EWL_CALLBACK(callback)   ((Ewl_Callback *) callback)
 Typecasts a pointer to an Ewl_Callback pointer.

#define EWL_CALLBACK_FUNCTION(cb_func)   ((Ewl_Callback_Function) cb_func)
 Typecasts a pointer to an Ewl_Callback_Function pointer.

#define EWL_CALLBACK_NOTIFY_MASK   (0x3)
 The value to binary AND with the callback pointer to check the notifiers.

#define EWL_CALLBACK_LIST_POINTER(w, t)
 Retrives the callback list from a widget for a certain event type.

#define EWL_CALLBACK_FLAGS(w, t)
 Retrives the callback flags from a widget for a certain event type.

#define EWL_CALLBACK_FLAG_INTERCEPT(w, t)
 Sets the callback intercept flag from a widget for a certain event type.

#define EWL_CALLBACK_FLAG_NOINTERCEPT(w, t)
 Clears the callback intercept flag from a widget for a certain event type.

#define EWL_CALLBACK_FLAG_NOTIFY(w, t)
 Sets the callback notify flag from a widget for a certain event type.

#define EWL_CALLBACK_LIST_ASSIGN(w, t, l)
 Sets the callback list for a widget for a certain event type.


Typedefs

typedef Ewl_Callback Ewl_Callback
 The callbacks used internally for tracking event actions.

typedef void(* Ewl_Callback_Function )(Ewl_Widget *widget, void *ev_data, void *user_data)
 A shortcut for declaring functions that take a callback funciton pointer.


Functions

void ewl_callbacks_init (void)
 Setup internal registration variables for callbacks.

void ewl_callbacks_shutdown (void)
 Destroy internal registration variables for callbacks.

int ewl_callback_append (Ewl_Widget *widget, Ewl_Callback_Type type, Ewl_Callback_Function func, void *user_data)
 Append a callback of the specified type.

int ewl_callback_prepend (Ewl_Widget *widget, Ewl_Callback_Type type, Ewl_Callback_Function func, void *user_data)
 prepend a callback of the specified type

int ewl_callback_insert_after (Ewl_Widget *w, Ewl_Callback_Type t, Ewl_Callback_Function f, void *user_data, Ewl_Callback_Function after, void *after_data)
 Add a callback after a previous callback in list.

void ewl_callback_clear (Ewl_Widget *widget)
 Remove all callbacks from the specified widget.

void ewl_callback_call (Ewl_Widget *widget, Ewl_Callback_Type type)
 Execute callbacks of specified types for the widget.

void ewl_callback_call_with_event_data (Ewl_Widget *widget, Ewl_Callback_Type type, void *event_data)
 Execute callbacks with event data.

void ewl_callback_del_type (Ewl_Widget *w, Ewl_Callback_Type t)
 Delete all callbacks of the specified type.

void ewl_callback_del (Ewl_Widget *w, Ewl_Callback_Type t, Ewl_Callback_Function f)
 Delete the specified callback function from the widget.

void ewl_callback_del_with_data (Ewl_Widget *w, Ewl_Callback_Type t, Ewl_Callback_Function f, void *data)
 Delete the specified callback function from the widget.


Detailed Description

Defines methods for creating and modifying callbacks on widgets.


Function Documentation

int ewl_callback_append Ewl_Widget w,
Ewl_Callback_Type  t,
Ewl_Callback_Function  f,
void *  user_data
 

Append a callback of the specified type.

Parameters:
w: the widget to attach the callback
t: the type of the callback that is being attached
f: the function to attach as a callback
user_data: the data to be passed to the callback function
Returns:
Returns 0 on failure, the id of the new callback on success.
Allocates a new callback for the specified widget that calls f with user_data as the data parameter when event ta occurs. This event is placed at the end of the callback chain.

void ewl_callback_call Ewl_Widget w,
Ewl_Callback_Type  t
 

Execute callbacks of specified types for the widget.

Parameters:
w: the widget to execute the callbacks
t: the type of the callbacks to be executed
Returns:
Returns no value.
Executes the callback chain for the specified widget w, with event t.

void ewl_callback_call_with_event_data Ewl_Widget w,
Ewl_Callback_Type  t,
void *  ev_data
 

Execute callbacks with event data.

Parameters:
w: the widget to execute the callbacks
t: the type of the callbacks to be executed
ev_data: the event data to pass to the callbacks
Returns:
Returns no value.
Similar to ewl_callback_call, but the event data is substituted by ev_data.

void ewl_callback_clear Ewl_Widget w  ) 
 

Remove all callbacks from the specified widget.

Parameters:
w: the widget to remove the callbacks
Returns:
Returns no value.
Removes and frees all callbacks associated with widget w.

void ewl_callback_del Ewl_Widget w,
Ewl_Callback_Type  t,
Ewl_Callback_Function  f
 

Delete the specified callback function from the widget.

Parameters:
w: the widget to delete the callback
t: the type of event associated with the callback
f: the function called by the callback
Returns:
Returns no value. Delete and frees the callback that calls function f when event t occurs to widget w.

void ewl_callback_del_type Ewl_Widget w,
Ewl_Callback_Type  t
 

Delete all callbacks of the specified type.

Parameters:
w: the widget to delete the callbacks
t: the type of the callbacks to be deleted
Returns:
Returns no value.
Delete all callbacks of type t from widget w.

void ewl_callback_del_with_data Ewl_Widget w,
Ewl_Callback_Type  t,
Ewl_Callback_Function  f,
void *  d
 

Delete the specified callback function from the widget.

Parameters:
w: the widget to delete the callback
t: the type of event associated with the callback
f: the function called by the callback
d: the data passed to the callback
Returns:
Returns no value. Delete and frees the callback that calls function f when event t occurs to widget w.

int ewl_callback_insert_after Ewl_Widget w,
Ewl_Callback_Type  t,
Ewl_Callback_Function  f,
void *  user_data,
Ewl_Callback_Function  after,
void *  after_data
 

Add a callback after a previous callback in list.

Parameters:
w: the widget to insert the callback
t: the type of the callback that is being attached
f: the function to attach as a callback
user_data: the data to be passed to the callback function
after: the function of the callback to append after
after_data: the user data of the callback to append after
Returns:
Returns 0 on failure, the id of the new callback on success.
Same functionality as ewl_callback_append, but the callback is placed after the specified callback on the callback chain.

int ewl_callback_prepend Ewl_Widget w,
Ewl_Callback_Type  t,
Ewl_Callback_Function  f,
void *  user_data
 

prepend a callback of the specified type

Parameters:
w: the widget to attach the callback
t: the type of the callback that is being attached
f: the function to attach as a callback
user_data: the data to be passed to the callback function
Returns:
Returns 0 on failure, the id of the new callback on success.
Same functionality as ewl_callback_append, but the callback is placed at the beginning of the callback chain.

void ewl_callbacks_init void   ) 
 

Setup internal registration variables for callbacks.

Returns:
Returns no value.
Sets up some important variables for tracking callbacks that allow shared callbacks.

W/o shared callbacks ewl_test with all windows open has a top line of: 21279 ningerso 19 0 22972 22M 9412 R 6.0 8.0 0:40 ewl_test With shared callbacks ewl_test with all windows open has a top line of: 15901 ningerso 10 0 20120 19M 9148 S 0.0 7.0 0:34 ewl_test

So using shared callbacks saves us over 2 MB of memory in this case.

void ewl_callbacks_shutdown void   ) 
 

Destroy internal registration variables for callbacks.

Returns:
Returns no value.
Destroys some important variables for tracking callbacks that allow shared callbacks.