ExtNotice.dcl 724 Bytes
Newer Older
Diederik van Arkel's avatar
Diederik van Arkel committed
1 2
definition module ExtNotice

3
// notices inspired by Object IO Tutorial
Diederik van Arkel's avatar
Diederik van Arkel committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

import StdWindow, StdTimerDef

:: Notice ls ps
	= Notice [String] (NoticeButton *(ls,ps)) [NoticeButton *(ls,ps)]

:: NoticeButton ps
	= NoticeButton String (IdFun ps)

instance Dialogs Notice

openNotice :: !(Notice .ls *(PSt .l)) !*(PSt .l) -> *PSt .l

okNotice text ps
	:== openNotice (Notice text (NoticeButton "OK" (\x->x)) []) ps

:: TimedNotice ls ps
	= TimedNotice [String] TimerInterval (NoticeButton *(ls,ps)) [NoticeButton *(ls,ps)]

instance Dialogs TimedNotice

openTimedNotice :: !(TimedNotice .ls *(PSt .l)) !*(PSt .l) -> *PSt .l

okTimedNotice text time ps
	:== openTimedNotice (TimedNotice text time (NoticeButton "OK" (\x->x)) []) ps