## visu_actionInterface

visu_actionInterface — Interface for defining actions and events.

## Synopsis

    #define     BUTTON_TYPE_PRESS
    #define     BUTTON_TYPE_RELEASE
    struct      SimplifiedEvents_struct;
    typedef     SimplifiedEvents;
    gboolean    (*ActionFunc)                   (SimplifiedEvents *event,
                                                 VisuData *data);
    struct      CallbackFunctions_struct;
    typedef     CallbackFunctions;

## Description

These definitions are used to give a library and plateform independent simplified event handlers.

## Details

### BUTTON_TYPE_PRESS

    #define BUTTON_TYPE_PRESS   1

Value that can be put into field buttonType of structure SimplifiedEvents_struct.

### BUTTON_TYPE_RELEASE

    #define BUTTON_TYPE_RELEASE 2

Value that can be put into field buttonType of structure SimplifiedEvents_struct.

### struct SimplifiedEvents_struct

    struct SimplifiedEvents_struct {
      int x, y;
      unsigned int button;
      int buttonType;
      int shiftMod, controlMod;
      int motion;
      char letter;
    };

This structure is a common interface for events (inspired from X). We don't use the one introduced by GDK because we don't want this dependency be a limitation.

int `x`; | the position x (on parent) for the event ;
int `y`; | the position y (on parent) for the event ;
unsigned int `button`; | the number of the button, 0 if not a button event ;
int `buttonType`; | BUTTON_TYPE_PRESS or BUTTON_TYPE_RELEASE ;
int `shiftMod`; | TRUE if Shift key is pressed during the event ;
int `controlMod`; | TRUE if Control key is pressed during the event ;
int `motion`; | TRUE if the event is a motion ;
char `letter`; | The value of the letter if the event is a key stroke.

### SimplifiedEvents

    typedef struct SimplifiedEvents_struct SimplifiedEvents;

A short way to address SimplifiedEvents_struct objects.

### ActionFunc ()

    gboolean    (*ActionFunc)                   (SimplifiedEvents *event,
                                                 VisuData *data);

An interface to methods that can be called whenever an action occurs.

`event` : | the event that triggered the action ;
`data` : | the VisuData object on which the action occured.
Returns : | TRUE if action should be stopped after this call.

### struct CallbackFunctions_struct

    struct CallbackFunctions_struct {
      ActionFunc action;
      GDestroyNotify stop;
      VisuData *data;
    };

This structure gather some routines and objects that are relevent when an event occures and some actions need to be launched.

ActionFunc `action`; | the method to be called ;
GDestroyNotify `stop`; | the method to be called if the action should be stopped ;
VisuData *`data`; | the VisuData object on which the action occured.

### CallbackFunctions

    typedef struct CallbackFunctions_struct CallbackFunctions;

A short way to address CallbackFunctions_struct objects.