home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
INCLUDE
/
MEVDECL.H
< prev
next >
Wrap
Text File
|
1990-09-23
|
4KB
|
103 lines
/*
mevdecl.h
% Mouse event declarations
11/18/88 by Ted.
OWL 1.2
Copyright (c) 1988, by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
12/20/88 jmd Changed values of MOU codes
1/10/89 jdc Fixed mev_IsButton macros
3/10/89 ted Moved MOU codes into scancode.h for portability
3/30/89 ted Renamed mouevent_struct to mev_struct
5/11/89 ted Added MEV_STARTCUR and MEV_STOPCUR messages.
9/23/90 ted Added 'outside' flag mev element for efficiency in trapped - mouse situations.
*/
/* -------------------------------------------------------------------------- */
typedef struct _moupos {
opcoord x; /* Absolute screen coordinates of mouse */
opcoord y;
unsigned event; /* Mouse event as defined below */
} moupos_struct;
/* -------------------------------------------------------------------------- */
/* Mouse event structure - it is (and should stay) like a moupos_struct with */
/* a window tacked on. Most of the mev_ macros will therefore work on both */
/* structures. */
typedef struct _mev {
opcoord x; /* Window coordinates of mouse */
opcoord y;
unsigned event; /* Mouse event as defined below */
obj_type win; /* Window mouse is in */
unsigned inborder:1;
unsigned incurrent:1;
unsigned outside:1; /* If trapping is on, win can get an external event */
} mev_struct;
/* -------------------------------------------------------------------------- */
#define MEV_MOVE 0x0001
#define MEV_BUT1MOVE 0x0002
#define MEV_BUT1 0x0004
#define MEV_BUT2MOVE 0x0008
#define MEV_BUT2 0x0010
#define MEV_BUT3MOVE 0x0020
#define MEV_BUT3 0x0040
/* -------------------------------------------------------------------------- */
#define mev_GetWin(mev) ((mev)->win)
#define mev_GetRow(mev) \
opcoord_GetYRow(mev_GetY(mev),win_GetFont(mev_GetWin(mev)))
#define mev_GetCol(mev) \
opcoord_GetXCol(mev_GetX(mev),win_GetFont(mev_GetWin(mev)))
/* The following macros will work on mouevent_struc's or moupos_struc's */
#define mev_GetX(mev) ((mev)->x)
#define mev_GetY(mev) ((mev)->y)
#define mev_GetEvent(mev) ((mev)->event)
#define mevbmask(ev) \
(((ev) | ((ev) << 1)) & (MEV_BUT1 | MEV_BUT2 | MEV_BUT3))
#define mev_IsButtonDown(mev) (mevbmask(mev_GetEvent(mev)) != 0)
#define mev_IsButton1Down(mev) ((mev_GetEvent(mev) & (MEV_BUT1 | MEV_BUT1MOVE)) != 0)
#define mev_IsButton2Down(mev) ((mev_GetEvent(mev) & (MEV_BUT2 | MEV_BUT2MOVE)) != 0)
#define mev_IsButton3Down(mev) ((mev_GetEvent(mev) & (MEV_BUT3 | MEV_BUT3MOVE)) != 0)
#define mev_ClearEvent(mev) ((mev)->event = 0xF000)
#define mev_IsEventClear(mev) ((mev)->event == 0xF000)
#define mev_ButtonGoneUp(oev, nev) \
(mevbmask((nev)|(oev)) > mevbmask(nev))
#define mev_ButtonGoneDown(oev, nev) \
(mevbmask((nev)|(oev)) > mevbmask(oev))
#define mev_MovedOut(fmev, cmev, dist) \
(oabs((cmev)->x - (fmev)->x) > (dist) || oabs((cmev)->y - (fmev)->y) > (dist))
/* -------------------------------------------------------------------------- */
/* Messages a mouse handler receives when its window is not current */
#define MEV_STARTOFFER 1
#define MEV_OFFER 2
#define MEV_ENDOFFER 3
/* Messages a mouse handler receives when its window is current */
#define MEV_REQUEST 4
#define MEV_STARTEVENT 5
#define MEV_EVENT 6
#define MEV_ENDEVENT 7
/* Messages a mouse handler receives when its window becomes current */
#define MEV_STARTCUR 8
#define MEV_STOPCUR 9
/* -------------------------------------------------------------------------- */