Gdome2 Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GdomeEventListener

## Name

GdomeEventListener -- Interface EventListener implementation.

## Synopsis

    struct      GdomeEventListener;
    GdomeEventListener* gdome_evntl_mkref       (void (*callback) (GdomeEventListener *self,GdomeEvent *event,GdomeException *exc),
                                                 gpointer priv);
    GdomeEventListener* gdome_evntl_aux_mkref   (void (*callback) (GdomeEventListener *self,GdomeEvent *event,GdomeException *exc),
                                                 gpointer priv);
    void        gdome_evntl_ref                 (GdomeEventListener *self,
                                                 GdomeException *exc);
    void        gdome_evntl_unref               (GdomeEventListener *self,
                                                 GdomeException *exc);
    gpointer    gdome_evntl_query_interface     (GdomeEventListener *self,
                                                 const char *interface,
                                                 GdomeException *exc);
    void        gdome_evntl_handleEvent         (GdomeEventListener *self,
                                                 GdomeEvent *evt,
                                                 GdomeException *exc);
    gpointer    gdome_evntl_get_priv            (GdomeEventListener *self);

## Description

The GdomeEventListener interface is the primary method for handling events. Users implement the GdomeEventListener interface and register their listener on an GdomeEventTarget using the gdome_n_AddEventListener() method. The users should also remove their GdomeEventListener from its GdomeEventTarget after they have completed using the listener.

When a GdomeNode is copied using the gdome_n_cloneNode() method the GdomeEventListeners attached to the source GdomeNode are not attached to the copied GdomeNode. If the user wishes the same GdomeEventListeners to be added to the newly created copy the user must add them manually.

## Details

### struct GdomeEventListener

    struct GdomeEventListener {
    	gpointer user_data;
    };

### gdome_evntl_mkref ()

    GdomeEventListener* gdome_evntl_mkref       (void (*callback) (GdomeEventListener *self,GdomeEvent *event,GdomeException *exc),
                                                 gpointer priv);

`callback` : | the callback function that is to be called when gdome_evntl_handleEvent() is called.
`priv` : | private data
Returns : | a new allocated GdomeEventListener.

### gdome_evntl_aux_mkref ()

    GdomeEventListener* gdome_evntl_aux_mkref   (void (*callback) (GdomeEventListener *self,GdomeEvent *event,GdomeException *exc),
                                                 gpointer priv);

`callback` : | the callback function that is to be called when gdome_evntl_handleEvent() is called.
`priv` : | private data
Returns : | a new allocated GdomeEventListener.

### gdome_evntl_ref ()

    void        gdome_evntl_ref                 (GdomeEventListener *self,
                                                 GdomeException *exc);

Increase the reference count of the specified EventListener.

`self` : | EventListener Object ref
`exc` : | Exception Object ref

### gdome_evntl_unref ()

    void        gdome_evntl_unref               (GdomeEventListener *self,
                                                 GdomeException *exc);

Decrease the reference count of the specified EventListener. Free the EventListener structure if the EventListener will have zero reference.

`self` : | EventListener Object ref
`exc` : | Exception Object ref

### gdome_evntl_query_interface ()

    gpointer    gdome_evntl_query_interface     (GdomeEventListener *self,
                                                 const char *interface,
                                                 GdomeException *exc);

`self` : | EventListener Object ref
`interface` : | name of the Interface needed.
`exc` : | Exception Object ref
Returns : | a reference to the object that implements the interface needed or `NULL` if this object doesn't implement the interface specified.

### gdome_evntl_handleEvent ()

    void        gdome_evntl_handleEvent         (GdomeEventListener *self,
                                                 GdomeEvent *evt,
                                                 GdomeException *exc);

This method is called whenever an event occurs of the type for which the EventListener interface was registered.

`self` : | EventListener Object ref
`evt` : | the Event Object ref that contains contextual information about the event.
`exc` : | Exception Object ref

### gdome_evntl_get_priv ()

    gpointer    gdome_evntl_get_priv            (GdomeEventListener *self);

DEPRECATED

`self` : | EventListener Object Ref
Returns : | the priv data field associated with this object

<<< Previous Page | Home | Up | Next Page >>>
Events Basic Types and Enumerations | GdomeEvent