|
|
1.1 root 1: /* $Id: mouse.h,v 1.12 2005/10/13 06:51:50 deuce Exp $ */
2:
3: /****************************************************************************
4: * @format.tab-size 4 (Plain Text/Source Code File Header) *
5: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
6: * *
7: * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html *
8: * *
9: * This library is free software; you can redistribute it and/or *
10: * modify it under the terms of the GNU Lesser General Public License *
11: * as published by the Free Software Foundation; either version 2 *
12: * of the License, or (at your option) any later version. *
13: * See the GNU Lesser General Public License for more details: lgpl.txt or *
14: * http://www.fsf.org/copyleft/lesser.html *
15: * *
16: * Anonymous FTP access to the most recent released source is available at *
17: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
18: * *
19: * Anonymous CVS access to the development source and modification history *
20: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
21: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
22: * (just hit return, no password is necessary) *
23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
24: * *
25: * For Synchronet coding style and modification guidelines, see *
26: * http://www.synchro.net/source.html *
27: * *
28: * You are encouraged to submit any modifications (preferably in Unix diff *
29: * format) via e-mail to [email protected] *
30: * *
31: * Note: If this box doesn't appear square, then you need to fix your tabs. *
32: ****************************************************************************/
33:
34: #ifndef _CIOLIB_MOUSE_H_
35: #define _CIOLIB_MOUSE_H_
36:
37: struct mouse_event {
38: int event;
39: int bstate;
40: int kbsm;
41: int startx;
42: int starty;
43: int endx;
44: int endy;
45: };
46:
47: #define CIOLIB_BUTTON_1 1
48: #define CIOLIB_BUTTON_2 2
49: #define CIOLIB_BUTTON_3 4
50:
51: #define CIOLIB_BUTTON(x) (1<<(x-1))
52:
53: enum {
54: CIOLIB_MOUSE_MOVE /* 0 */
55: ,CIOLIB_BUTTON_1_PRESS
56: ,CIOLIB_BUTTON_1_RELEASE
57: ,CIOLIB_BUTTON_1_CLICK
58: ,CIOLIB_BUTTON_1_DBL_CLICK
59: ,CIOLIB_BUTTON_1_TRPL_CLICK
60: ,CIOLIB_BUTTON_1_QUAD_CLICK
61: ,CIOLIB_BUTTON_1_DRAG_START
62: ,CIOLIB_BUTTON_1_DRAG_MOVE
63: ,CIOLIB_BUTTON_1_DRAG_END
64: ,CIOLIB_BUTTON_2_PRESS /* 10 */
65: ,CIOLIB_BUTTON_2_RELEASE
66: ,CIOLIB_BUTTON_2_CLICK
67: ,CIOLIB_BUTTON_2_DBL_CLICK
68: ,CIOLIB_BUTTON_2_TRPL_CLICK
69: ,CIOLIB_BUTTON_2_QUAD_CLICK
70: ,CIOLIB_BUTTON_2_DRAG_START
71: ,CIOLIB_BUTTON_2_DRAG_MOVE
72: ,CIOLIB_BUTTON_2_DRAG_END
73: ,CIOLIB_BUTTON_3_PRESS
74: ,CIOLIB_BUTTON_3_RELEASE /* 20 */
75: ,CIOLIB_BUTTON_3_CLICK
76: ,CIOLIB_BUTTON_3_DBL_CLICK
77: ,CIOLIB_BUTTON_3_TRPL_CLICK
78: ,CIOLIB_BUTTON_3_QUAD_CLICK
79: ,CIOLIB_BUTTON_3_DRAG_START
80: ,CIOLIB_BUTTON_3_DRAG_MOVE
81: ,CIOLIB_BUTTON_3_DRAG_END /* 27 */
82: };
83:
84: #define CIOLIB_BUTTON_PRESS(x) ((x-1)*9+1)
85: #define CIOLIB_BUTTON_RELEASE(x) ((x-1)*9+2)
86: #define CIOLIB_BUTTON_CLICK(x) ((x-1)*9+3)
87: #define CIOLIB_BUTTON_DBL_CLICK(x) ((x-1)*9+4)
88: #define CIOLIB_BUTTON_TRPL_CLICK(x) ((x-1)*9+5)
89: #define CIOLIB_BUTTON_QUAD_CLICK(x) ((x-1)*9+6)
90: #define CIOLIB_BUTTON_DRAG_START(x) ((x-1)*9+7)
91: #define CIOLIB_BUTTON_DRAG_MOVE(x) ((x-1)*9+8)
92: #define CIOLIB_BUTTON_DRAG_END(x) ((x-1)*9+9)
93:
94: #define CIOLIB_BUTTON_NUMBER(x) ((x+8)/9)
95:
96: #define CIOLIB_BUTTON_BASE(x) (x!=CIOLIB_MOUSE_MOVE?x-9*(CIOLIB_BUTTON_NUMBER(x)-1):CIOLIB_MOUSE_MOVE)
97:
98: extern int ciolib_mouse_initialized;
99:
100: #ifdef __cplusplus
101: extern "C" {
102: #endif
103: void ciomouse_gotevent(int event, int x, int y);
104: int mouse_trywait(void);
105: int mouse_wait(void);
106: int mouse_pending(void);
107: int ciolib_getmouse(struct mouse_event *mevent);
108: int ciolib_ungetmouse(struct mouse_event *mevent);
109: void ciolib_mouse_thread(void *data);
110: int ciomouse_setevents(int events);
111: int ciomouse_addevents(int events);
112: int ciomouse_delevents(int events);
113: int ciomouse_addevent(int event);
114: int ciomouse_delevent(int event);
115: #ifdef __cplusplus
116: }
117: #endif
118:
119: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.