Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

The event system of Etk


Detailed Description

The event system of Etk.

There are two kinds of events in Etk:

  • The widget-events that are received by every widget: for example, when a button is clicked, when the mouse wheel is used over a widget...
    You can connect a callback to one of these events by calling etk_signal_connect() on the widget with the given signal. For example:
     //_image_clicked_cb() will be called when the image is clicked
     etk_signal_connect(ETK_OBJECT(image), "mouse-clicked", _image_clicked_cb, NULL);
    
  • The global-events that are emitted each time an input event occurs, even if the event was not for a widget: for example, when the user clicks somewhere on the screen, when he moves the mouse... You will rarely have to use these events.
    You can connect a callback to this kind of events with the function etk_event_global_callback_add(). For example:
     //_mouse_down_cb() will be called each time the user presses the mouse
     etk_event_global_callback_add(ETK_EVENT_MOUSE_DOWN, _mouse_down_cb, NULL);
    


Data Structures

union  Etk_Event_Global
 The event structure sent to "global" callback (see etk_event_global_callback_add()). More...
struct  Etk_Event_Mouse_In
 The event structure sent when the mouse enters a widget. More...
struct  Etk_Event_Mouse_Out
 The event structure sent when the mouse leaves a widget. More...
struct  Etk_Event_Mouse_Move
 The event structure sent when the mouse moves over a widget. More...
struct  Etk_Event_Mouse_Down
 The event structure sent when the user presses a widget with the mouse. More...
struct  Etk_Event_Mouse_Up
 The event structure sent when the user releases a widget with the mouse. More...
struct  Etk_Event_Mouse_Wheel
 The event structure sent when the mouse wheel is used over a widget. More...
struct  Etk_Event_Key_Down
 The event structure sent to the focused widget when a key is pressed. More...
struct  Etk_Event_Key_Up
 The event structure sent to the focused widget when a key is released. More...

Enumerations

enum  Etk_Event_Type {
  ETK_EVENT_MOUSE_MOVE,
  ETK_EVENT_MOUSE_DOWN,
  ETK_EVENT_MOUSE_UP,
  ETK_EVENT_MOUSE_WHEEL,
  ETK_EVENT_KEY_DOWN,
  ETK_EVENT_KEY_UP
}
 The different types of input events. More...
enum  Etk_Modifiers {
  ETK_MODIFIER_NONE = 0,
  ETK_MODIFIER_CTRL = 1 << 0,
  ETK_MODIFIER_ALT = 1 << 1,
  ETK_MODIFIER_SHIFT = 1 << 2,
  ETK_MODIFIER_WIN = 1 << 3
}
 The keyboard modifiers active when the event has been emitted. More...
enum  Etk_Locks {
  ETK_LOCK_NONE = 0,
  ETK_LOCK_NUM = 1 << 0,
  ETK_LOCK_CAPS = 1 << 1,
  ETK_LOCK_SCROLL = 1 << 2
}
 The keyboard locks active when the event has been emitted. More...
enum  Etk_Mouse_Flags {
  ETK_MOUSE_NONE = 0,
  ETK_MOUSE_DOUBLE_CLICK = 1 << 0,
  ETK_MOUSE_TRIPLE_CLICK = 1 << 1
}
 A flag describing whether the click was a single, double or triple click. More...
enum  Etk_Wheel_Direction {
  ETK_WHEEL_VERTICAL,
  ETK_WHEEL_HORIZONTAL
}
 The scroll direction corresponding to the wheel event. More...

Functions

void etk_event_mouse_in_wrap (Etk_Widget *widget, Evas_Event_Mouse_In *evas_event, Etk_Event_Mouse_In *etk_event)
 Converts a "mouse_in" event from Evas to the corresponding event of Etk.
void etk_event_mouse_out_wrap (Etk_Widget *widget, Evas_Event_Mouse_Out *evas_event, Etk_Event_Mouse_Out *etk_event)
 Converts a "mouse_out" event from Evas to the corresponding event of Etk.
void etk_event_mouse_move_wrap (Etk_Widget *widget, Evas_Event_Mouse_Move *evas_event, Etk_Event_Mouse_Move *etk_event)
 Converts a "mouse_move" event from Evas to the corresponding event of Etk.
void etk_event_mouse_down_wrap (Etk_Widget *widget, Evas_Event_Mouse_Down *evas_event, Etk_Event_Mouse_Down *etk_event)
 Converts a "mouse_down" event from Evas to the corresponding event of Etk.
void etk_event_mouse_up_wrap (Etk_Widget *widget, Evas_Event_Mouse_Up *evas_event, Etk_Event_Mouse_Up *etk_event)
 Converts a "mouse_up" event from Evas to the corresponding event of Etk.
void etk_event_mouse_wheel_wrap (Etk_Widget *widget, Evas_Event_Mouse_Wheel *evas_event, Etk_Event_Mouse_Wheel *etk_event)
 Converts a "mouse_wheel" event from Evas to the corresponding event of Etk.
void etk_event_key_down_wrap (Etk_Widget *widget, Evas_Event_Key_Down *evas_event, Etk_Event_Key_Down *etk_event)
 Converts a "key_down" event from Evas to the corresponding event of Etk.
void etk_event_key_up_wrap (Etk_Widget *widget, Evas_Event_Key_Up *evas_event, Etk_Event_Key_Up *etk_event)
 Converts a "key_up" event from Evas to the corresponding event of Etk.
void etk_event_global_callback_add (Etk_Event_Type event, void(*callback)(Etk_Event_Global event, void *data), void *data)
 Adds a function to call when the given input event is emitted. It receives all the events, even those that are not sent to an Etk window.
void etk_event_global_callback_del (Etk_Event_Type event, void(*callback)(Etk_Event_Global event, void *data))
 Removes a callback connected to the given given input event.
void etk_event_mouse_position_get (int *x, int *y)
 Gets the position of the mouse pointer, relative to the screen.


Enumeration Type Documentation

enum Etk_Event_Type

The different types of input events.

Enumerator:
ETK_EVENT_MOUSE_MOVE  Emitted when the mouse is moved
ETK_EVENT_MOUSE_DOWN  Emitted when a mouse button is pressed
ETK_EVENT_MOUSE_UP  Emitted when a mouse button is released
ETK_EVENT_MOUSE_WHEEL  Emitted when the mouse wheel used
ETK_EVENT_KEY_DOWN  Emitted when a key of the keyboard is pressed
ETK_EVENT_KEY_UP  Emitted when a key of the keyboard is released

enum Etk_Modifiers

The keyboard modifiers active when the event has been emitted.

Enumerator:
ETK_MODIFIER_NONE  No active modifiers
ETK_MODIFIER_CTRL  "Control" is pressed
ETK_MODIFIER_ALT  "Alt" is pressed
ETK_MODIFIER_SHIFT  "Shift" is pressed
ETK_MODIFIER_WIN  "Win" (between "Ctrl" and "Alt") is pressed

enum Etk_Locks

The keyboard locks active when the event has been emitted.

Enumerator:
ETK_LOCK_NONE  No locks are active
ETK_LOCK_NUM  "Num" lock is active
ETK_LOCK_CAPS  "Caps" lock is active
ETK_LOCK_SCROLL  "Scroll" lock is active

enum Etk_Mouse_Flags

A flag describing whether the click was a single, double or triple click.

Enumerator:
ETK_MOUSE_NONE  A single click
ETK_MOUSE_DOUBLE_CLICK  A double click
ETK_MOUSE_TRIPLE_CLICK  A triple click

enum Etk_Wheel_Direction

The scroll direction corresponding to the wheel event.

Enumerator:
ETK_WHEEL_VERTICAL  Vertical scrolling
ETK_WHEEL_HORIZONTAL  Horizontal scrolling


Function Documentation

void etk_event_mouse_in_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_In *  evas_event,
Etk_Event_Mouse_In *  etk_event 
)

Converts a "mouse_in" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_mouse_out_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_Out *  evas_event,
Etk_Event_Mouse_Out *  etk_event 
)

Converts a "mouse_out" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_mouse_move_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_Move *  evas_event,
Etk_Event_Mouse_Move *  etk_event 
)

Converts a "mouse_move" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_mouse_down_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_Down *  evas_event,
Etk_Event_Mouse_Down *  etk_event 
)

Converts a "mouse_down" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_mouse_up_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_Up *  evas_event,
Etk_Event_Mouse_Up *  etk_event 
)

Converts a "mouse_up" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_mouse_wheel_wrap ( Etk_Widget *  widget,
Evas_Event_Mouse_Wheel *  evas_event,
Etk_Event_Mouse_Wheel *  etk_event 
)

Converts a "mouse_wheel" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_key_down_wrap ( Etk_Widget *  widget,
Evas_Event_Key_Down *  evas_event,
Etk_Event_Key_Down *  etk_event 
)

Converts a "key_down" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_key_up_wrap ( Etk_Widget *  widget,
Evas_Event_Key_Up *  evas_event,
Etk_Event_Key_Up *  etk_event 
)

Converts a "key_up" event from Evas to the corresponding event of Etk.

Parameters:
widget the widget which has received the Evas event
evas_event the received Evas event
etk_event the location where to store the converted Etk event

void etk_event_global_callback_add ( Etk_Event_Type  event,
void(*)(Etk_Event_Global event, void *data)  callback,
void *  data 
)

Adds a function to call when the given input event is emitted. It receives all the events, even those that are not sent to an Etk window.

Parameters:
event the type of event to monitor
callback the callback to call when a corresponding event is emitted
data the data to pass to the callback

void etk_event_global_callback_del ( Etk_Event_Type  event,
void(*)(Etk_Event_Global event, void *data)  callback 
)

Removes a callback connected to the given given input event.

Parameters:
event the type of event to remove
callback the callback to remove

void etk_event_mouse_position_get ( int *  x,
int *  y 
)

Gets the position of the mouse pointer, relative to the screen.

Parameters:
x the location where to store the x position of the mouse
y the location where to store the y position of the mouse