home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
dev
/
e
/
amiga_e
/
src
/
pd
/
blockinput.e
< prev
next >
Wrap
Text File
|
1992-09-02
|
3KB
|
149 lines
/* blockinput.e (from p 207 of Libraries handbook, modified for E by
* Trey Van Riper [jvanriper@uncavx.unca.edu])
*/
/* blockinput.e -- program to demonstrate how to block the input from a
* window using a minimal requester, and how to put up a busy pointer.
*/
OPT OSVERSION=37
MODULE 'exec/types','intuition/intuition','exec/ports','exec/memory',
'utility/tagitem'
/*
* As far as I know, E doesn't let you put data directly in the
* chip RAM, so you have to CopyMem it from Fastram. So....
*/
DEF chippointer
/*
* beginWait()
*
* Clear the requester with InitRequester. This makes a requester of
* width =0, height = 0, left = 0, top = 0; in fact, everything is zero.
* This requester will simply block input to the window until
* EndRequest is called.
*
* The pointer is set to a reasonable 4-color busy pointer, with proper offsets.
*/
PROC beginWait(win, waitRequest)
InitRequester(waitRequest)
IF Request(waitRequest, win)
SetPointer(win,chippointer, 16, 16, -6, 0)
SetWindowTitles(win,'Busy - Input Blocked', Not(0))
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDPROC
/*
* endWait()
*
* Routine to reset the pointer to the system default, and remove the
* requester installed with beginWait().
*/
PROC endWait(win, waitRequest)
ClearPointer(win)
EndRequest(waitRequest, win)
SetWindowTitles(win,'Not Busy', Not(0))
ENDPROC
/*
* processIDCMP()
*
* Wait for the user to close the window.
*/
PROC processIDCMP (wintmp)
DEF done, msg:PTR TO intuimessage, class, myreq:requester, tick_count,
temp:PTR TO mp,win:PTR TO window
done:=FALSE
win:=wintmp
IF beginWait(win, myreq)
/*
* Insert code here for a window to act as the requester.
*/
/* We'll count down INTUITICKS, which come about ten times
* a second. We'll keep the busy state for about three seconds.
*/
tick_count := 30
ENDIF
temp := win.userport
WHILE Not(done)
Wait(Shl(1,temp.sigbit))
WHILE NIL <> (msg := GetMsg(win.userport))
class := msg.class
ReplyMsg(msg)
SELECT class
CASE IDCMP_CLOSEWINDOW
done := TRUE
CASE IDCMP_INTUITICKS
IF tick_count>0
DEC tick_count
IF tick_count = 0 THEN endWait(win,myreq)
ENDIF
ENDSELECT
ENDWHILE
ENDWHILE
ENDPROC
PROC main()
DEF win:PTR TO window,waitpointer
waitpointer:=[$0000, $0000,
$0400, $07C0,
$0000, $07C0,
$0100, $0380,
$0000, $07E0,
$07C0, $1FF8,
$1FF0, $3FEC,
$3FF8, $7FDE,
$3FF8, $7FBE,
$7FFC, $FF7F,
$7EFC, $FFFF,
$7FFC, $FFFF,
$3FF8, $7FFE,
$3FF8, $7FFE,
$1FF0, $3FFC,
$07C0, $1FF8,
$0000, $07E0,
$0000, $0000]:INT
IF chippointer:=AllocVec(72,MEMF_CHIP)
CopyMemQuick(waitpointer,chippointer,72)
ENDIF
IF win:=OpenWindowTagList(NIL,
[WA_IDCMP,IDCMP_CLOSEWINDOW OR IDCMP_INTUITICKS,
WA_ACTIVATE, TRUE,
WA_WIDTH, 320,
WA_HEIGHT, 100,
WA_CLOSEGADGET, TRUE,
WA_DRAGBAR, TRUE,
WA_DEPTHGADGET, TRUE,
WA_SIZEGADGET, TRUE,
WA_MAXWIDTH, Not(0),
WA_MAXHEIGHT, Not(0)])
processIDCMP(win)
CloseWindow(win)
ENDIF
IF chippointer THEN FreeVec(chippointer)
ENDPROC