visu_actionInterface

visu_actionInterface — Interface for defining actions and events.

Synopsis

#define             TOOL_BUTTON_TYPE_PRESS
#define             TOOL_BUTTON_TYPE_RELEASE
struct              ToolSimplifiedEvents;
enum                ToolSpecialKeyStroke;

Description

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

Details

TOOL_BUTTON_TYPE_PRESS

#define TOOL_BUTTON_TYPE_PRESS   1

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


TOOL_BUTTON_TYPE_RELEASE

#define TOOL_BUTTON_TYPE_RELEASE 2

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


struct ToolSimplifiedEvents

struct ToolSimplifiedEvents {
  int x, y;
  int root_x, root_y;
  guint button;
  int buttonType;
  int shiftMod, controlMod;
  int motion;
  char letter;
  ToolSpecialKeyStroke specialKey;
};

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 ;

int root_x;

the position x (in root window) for the event ;

int root_y;

the position y (in root window) for the event ;

guint button;

the number of the button, 0 if not a button event ;

int buttonType;

TOOL_BUTTON_TYPE_PRESS or TOOL_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 '\0' if not ;

ToolSpecialKeyStroke specialKey;

the value of a special key if the event is a key stroke but not with an ascii letter.

enum ToolSpecialKeyStroke

typedef enum {
    Key_None,
    Key_Page_Up,
    Key_Page_Down,
    Key_Arrow_Left,
    Key_Arrow_Right,
    Key_Arrow_Up,
    Key_Arrow_Down,
    Key_Menu
} ToolSpecialKeyStroke;

Possible non ascii keys used in ToolSimplifiedEvents.

Key_None

no key pressed ;

Key_Page_Up

key up ;

Key_Page_Down

key down ;

Key_Arrow_Left

key left ;

Key_Arrow_Right

key right ;

Key_Arrow_Up

key up ;

Key_Arrow_Down

key down ;

Key_Menu

key menu.