StdClipboard.dcl 1.43 KB
Newer Older
Peter Achten's avatar
Peter Achten committed
1
2
3
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
29
30
31
32
33
definition module StdClipboard


//	********************************************************************************
//	Clean Standard Object I/O library, version 1.2
//	
//	StdClipboard specifies all functions on the clipboard.
//	********************************************************************************


import	StdMaybe
from	iostate	import	PSt, IOSt


//	Clipboard data items:

::	ClipboardItem

class Clipboard item where
	toClipboard		:: !item			-> ClipboardItem
	fromClipboard	:: !ClipboardItem	-> Maybe item
/*	toClipboard
		makes an item transferable to the clipboard.
	fromClipboard
		attempts to retrieve an item of the instance type from the clipboard item.
		If this fails, the result is Nothing, otherwise it is (Just item).
*/
	
instance Clipboard {#Char}


//	Access to the current content of the clipboard:

34
35
setClipboard :: ![ClipboardItem] !(PSt .l) -> PSt .l
getClipboard :: !(PSt .l) -> (![ClipboardItem],!PSt .l)
Peter Achten's avatar
Peter Achten committed
36
37
38
39
40
41
42
43
44
45
/*	setClipboard
		replaces the current content of the clipboard with the argument list. 
		Of the list only the first occurence of a ClipboardItem of the same type
		will be stored in the clipboard. 
		Note that setClipboard [] erases the clipboard.
	getClipboard
		gets the current content of the clipboard without changing the content.
*/


46
clipboardHasChanged	:: !(PSt .l) -> (!Bool,!PSt .l)
Peter Achten's avatar
Peter Achten committed
47
48
49
/*	clipboardHasChanged holds if the current content of the clipboard is different
	from the last access to the clipboard.
*/