home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
DESQVIEW
/
DVGLU101.ZIP
/
UISIGNAL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-08-11
|
2KB
|
58 lines
/*======================================================*/
/* UISIGNAL.C */
/* */
/* (c) Copyright 1988 Ralf Brown. All Rights Reserved. */
/*======================================================*/
#include <stdio.h>
#include "tvapi.h"
#include "tvstream.h"
#include "tvui.h"
/*======================================================*/
static void (*signal_handlers[TV_MENU_END-TV_HMOVE+1])(NOTIFY_MSG *) ;
/*======================================================*/
/*======================================================*/
static void far UIsignal_handler(void)
{
NOTIFY_MSG msg ;
PARMLIST2 p ;
while (TVmbx_size(NIL) > 0)
{
(void) TVreadmail(NIL,(char *)&msg,sizeof(msg)) ;
msg.event -= MS_NOTIFY ;
if (msg.event >= TV_HMOVE && msg.event <= TV_MENU_END && signal_handlers[msg.event] != NULL)
(*signal_handlers[msg.event])(&msg) ;
}
}
/*======================================================*/
/* UIsignal set up handlers for specified notify msgs */
/* Ralf Brown 8/1/88 */
/*======================================================*/
void (* pascal UIsignal(int signal,OBJECT window,void (*handler)(NOTIFY_MSG *),int stacksize))(NOTIFY_MSG *)
{
void (*old_handler)(NOTIFY_MSG *) ;
old_handler = signal_handlers[signal] ;
signal_handlers[signal] = handler ;
if (handler != NULL)
{
/* we may not have installed the handler on this window yet */
if (TVwin_async(window,UIsignal_handler,stacksize) == EOF)
return SIGNAL_ERROR ;
TVwin_notify(window,signal) ;
TVwin_allow(window,signal) ;
}
else
TVwin_cancel(window,signal,TRUE) ; /* remove handler if last signal cancelled */
return old_handler ;
}
/* End of UISIGNAL.C */