root/lib/widget/mouse.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 /** \file mouse.h
   2  *  \brief Header: Hight-level mouse API.
   3  *
   4  * This is a thin layer over the low-level mouse protocol in lib/tty/mouse.h.
   5  * The latter is oblivious to the regions on the screen and is therefore a
   6  * bit hard to use in widgets. This layer translates the low level Gpm_Event
   7  * into something that's easy to work with in widgets.
   8  */
   9 
  10 #ifndef MC__WIDGET_MOUSE_H
  11 #define MC__WIDGET_MOUSE_H
  12 
  13 #include "lib/tty/mouse.h"      /* Gpm_Event */
  14 
  15 /*** enums ***************************************************************************************/
  16 
  17 /* Mouse messages */
  18 typedef enum
  19 {
  20     /*
  21      * Notes:
  22      * (1) "anywhere" means "inside or outside the widget".
  23      * (2) the mouse wheel is not considered "mouse button".
  24      */
  25     MSG_MOUSE_NONE = 0,
  26     MSG_MOUSE_DOWN = 1,         /* When mouse button is pressed down inside the widget. */
  27     MSG_MOUSE_UP,               /* When mouse button, previously pressed inside the widget, is released anywhere. */
  28     MSG_MOUSE_CLICK,            /* When mouse button, previously pressed inside the widget, is released inside the widget. */
  29     MSG_MOUSE_DRAG,             /* When a drag, initiated by button press inside the widget, occurs anywhere. */
  30     MSG_MOUSE_MOVE,             /* (Not currently implemented in MC.) */
  31     MSG_MOUSE_SCROLL_UP,        /* When mouse wheel is rotated away from the user. */
  32     MSG_MOUSE_SCROLL_DOWN       /* When mouse wheel is rotated towards the user. */
  33 } mouse_msg_t;
  34 
  35 /*** structures declarations (and typedefs of structures)*****************************************/
  36 
  37 /* Mouse event structure. */
  38 typedef struct
  39 {
  40     mouse_msg_t msg;
  41 
  42     int x, y;                   /* Local to the widget. */
  43     int buttons;                /* Bitwise-or of: GPM_B_LEFT, GPM_B_MIDDLE, GPM_B_RIGHT */
  44     int count;                  /* One of: GPM_SINGLE, GPM_DOUBLE, GPM_TRIPLE */
  45 
  46     /* A mechanism for the callback to report back: */
  47     struct
  48     {
  49         gboolean abort;
  50         gboolean repeat;
  51     } result;
  52 } mouse_event_t;
  53 
  54 /*** typedefs(not structures) and defined constants **********************************************/
  55 
  56 /*** global variables defined in .c file *********************************************************/
  57 
  58 /*** declarations of public functions ************************************************************/
  59 
  60 /* Translate GPM event to high-level event */
  61 mouse_event_t mouse_translate_event (Widget * w, Gpm_Event * event);
  62 /* Process high-level mouse event */
  63 int mouse_process_event (Widget * w, mouse_event_t * event);
  64 
  65 /*** inline functions ****************************************************************************/
  66 
  67 #endif /* MC__WIDGET_MOUSE_H */

/* [previous][next][first][last][top][bottom][index][help]  */