home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QBasic & Borland Pascal & C
/
Delphi5.iso
/
C
/
Samples
/
CSAPE32.ARJ
/
SOURCE
/
CSSRC
/
SDMOUGCK.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-12
|
3KB
|
91 lines
/*
sdmougck.c 10/27/89
% sedmou_GreedyClick
A click, keep control mousehandler
C-scape 3.2
Copyright (c) 1986, 1987, 1988 by Oakland Group, Inc.
ALL RIGHTS RESERVED.
Revision History:
-----------------
1/24/90 ted Revamped for new nested MEV_START/STOPCUR msg scheme.
3/28/90 jmd ansi-fied
5/12/90 jmd mouse handlers now return ints
*/
#include <stdio.h>
#include "cscape.h"
#include "scancode.h" /* for MOU codes */
/* -------------------------------------------------------------------------- */
int sedmou_GreedyClick(sed_type sed, int msg, mev_struct *mev)
/*
A mouse handler for pop-ups.
This mouse handler prevents all other windows from getting
mouse events while it is active.
It is used for creating popup windows that require attention.
(uses sedmou_Click for most of its work)
*/
{
int ret;
switch (msg) {
case MEV_STARTCUR:
/* Trap all mouse events while we're current */
disp_TrapMouse(sed);
break;
case MEV_STOPCUR:
break;
case MEV_STARTOFFER:
case MEV_OFFER:
case MEV_ENDOFFER:
/* Only respond to offers if trapping is on */
if (disp_IsTrappedMouse()) {
/* If the event is inside our window or border do the normal thing;
otherwise bail out of the sed */
if ((ret = sedmev_greedyclip(sed, mev)) == MOU_HERE) {
return(sedmou_Click(sed, msg, mev));
}
else {
/* Event is not in our win, but trapping is on, so one of our
children must be current; the standard response for a click
outside is to exit the child and ourselves */
/* Mouse was outside the window; don't accept the offer, but
if the mouse was clicked return MOU_THERE so that
the popup will be removed */
mev_ClearEvent(mev);
return(ret);
}
}
mev_ClearEvent(mev);
break;
case MEV_REQUEST: /* we're the current window so trapping must be on */
return(sedmou_Click(sed, msg, mev));
case MEV_STARTEVENT:
win_SetDebounced(sed, mev_IsButtonDown(mev));
/* no break, fall through */
case MEV_EVENT: /* we're the current window so trapping must be on */
case MEV_ENDEVENT:
/* If the event is inside our window or border do the normal thing;
otherwise bail out of the sed */
if ((ret = sedmev_greedyclip(sed, mev)) == MOU_HERE) {
return(sedmou_Click(sed, msg, mev));
}
else { /* Otherwise exit if button is clicked */
return(ret);
}
}
return(MOU_IGNORE); /* Ignore this mouse event */
}
/* -------------------------------------------------------------------------- */