1/* $Id: curses.tail,v 1.5 2001/12/30 00:01:16 tom Exp $ */ 2 3/* mouse interface */ 4#define NCURSES_MOUSE_VERSION 1 5 6/* event masks */ 7#define BUTTON1_RELEASED 000000000001L 8#define BUTTON1_PRESSED 000000000002L 9#define BUTTON1_CLICKED 000000000004L 10#define BUTTON1_DOUBLE_CLICKED 000000000010L 11#define BUTTON1_TRIPLE_CLICKED 000000000020L 12#define BUTTON1_RESERVED_EVENT 000000000040L 13#define BUTTON2_RELEASED 000000000100L 14#define BUTTON2_PRESSED 000000000200L 15#define BUTTON2_CLICKED 000000000400L 16#define BUTTON2_DOUBLE_CLICKED 000000001000L 17#define BUTTON2_TRIPLE_CLICKED 000000002000L 18#define BUTTON2_RESERVED_EVENT 000000004000L 19#define BUTTON3_RELEASED 000000010000L 20#define BUTTON3_PRESSED 000000020000L 21#define BUTTON3_CLICKED 000000040000L 22#define BUTTON3_DOUBLE_CLICKED 000000100000L 23#define BUTTON3_TRIPLE_CLICKED 000000200000L 24#define BUTTON3_RESERVED_EVENT 000000400000L 25#define BUTTON4_RELEASED 000001000000L 26#define BUTTON4_PRESSED 000002000000L 27#define BUTTON4_CLICKED 000004000000L 28#define BUTTON4_DOUBLE_CLICKED 000010000000L 29#define BUTTON4_TRIPLE_CLICKED 000020000000L 30#define BUTTON4_RESERVED_EVENT 000040000000L 31#define BUTTON_CTRL 000100000000L 32#define BUTTON_SHIFT 000200000000L 33#define BUTTON_ALT 000400000000L 34#define ALL_MOUSE_EVENTS 000777777777L 35#define REPORT_MOUSE_POSITION 001000000000L 36 37/* macros to extract single event-bits from masks */ 38#define BUTTON_RELEASE(e, x) ((e) & (001 << (6 * ((x) - 1)))) 39#define BUTTON_PRESS(e, x) ((e) & (002 << (6 * ((x) - 1)))) 40#define BUTTON_CLICK(e, x) ((e) & (004 << (6 * ((x) - 1)))) 41#define BUTTON_DOUBLE_CLICK(e, x) ((e) & (010 << (6 * ((x) - 1)))) 42#define BUTTON_TRIPLE_CLICK(e, x) ((e) & (020 << (6 * ((x) - 1)))) 43#define BUTTON_RESERVED_EVENT(e, x) ((e) & (040 << (6 * ((x) - 1)))) 44 45typedef unsigned long mmask_t; 46 47typedef struct 48{ 49 short id; /* ID to distinguish multiple devices */ 50 int x, y, z; /* event coordinates (character-cell) */ 51 mmask_t bstate; /* button state bits */ 52} 53MEVENT; 54 55extern NCURSES_EXPORT(int) getmouse (MEVENT *); 56extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); 57extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); 58extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); 59extern NCURSES_EXPORT(int) mouseinterval (int); 60extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); 61extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ 62 63#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) 64 65/* other non-XSI functions */ 66 67extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ 68extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ 69 70/* Debugging : use with libncurses_g.a */ 71 72extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); 73extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); 74extern NCURSES_EXPORT(char *) _traceattr (attr_t); 75extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); 76extern NCURSES_EXPORT(char *) _nc_tracebits (void); 77extern NCURSES_EXPORT(char *) _tracechar (int); 78extern NCURSES_EXPORT(char *) _tracechtype (chtype); 79extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); 80#ifdef _XOPEN_SOURCE_EXTENDED 81#define _tracech_t _tracecchar_t 82extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); 83#define _tracech_t2 _tracecchar_t2 84extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); 85#else 86#define _tracech_t _tracechtype 87#define _tracech_t2 _tracechtype2 88#endif 89extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); 90extern NCURSES_EXPORT(void) trace (const unsigned int); 91 92/* trace masks */ 93#define TRACE_DISABLE 0x0000 /* turn off tracing */ 94#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ 95#define TRACE_TPUTS 0x0002 /* trace tputs calls */ 96#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ 97#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ 98#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ 99#define TRACE_ORDINARY 0x001F /* trace all update actions */ 100#define TRACE_CALLS 0x0020 /* trace all curses calls */ 101#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ 102#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ 103#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ 104#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ 105#define TRACE_CCALLS 0x0400 /* trace per-character calls */ 106#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ 107#define TRACE_ATTRS 0x1000 /* trace attribute updates */ 108#define TRACE_MAXIMUM 0xffff /* maximum trace level */ 109 110#if defined(TRACE) || defined(NCURSES_TEST) 111extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ 112#ifdef _XOPEN_SOURCE_EXTENDED 113extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); 114#endif 115extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); 116#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ 117#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ 118#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ 119#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ 120#endif 121 122#ifdef __cplusplus 123 124/* these names conflict with STL */ 125#undef box 126#undef clear 127#undef erase 128#undef move 129#undef refresh 130 131} 132#endif 133 134#endif /* __NCURSES_H */ 135