ossystem.icl 1.15 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
34
35
36
37
38
39
40
implementation module ossystem			// for Windows

//	Clean Object I/O library, version 1.2

import	StdInt, StdReal, StdString
import	clCCall_12
from	ostypes	import Rect

OSdirseparator	:==	'\\'				// OS separator between folder- and filenames in a pathname

OShomepath :: !String -> String
OShomepath fname = theApplicationPath +++ fname

OSapplicationpath :: !String -> String
OSapplicationpath fname = theApplicationPath +++ fname

theApplicationPath =: path
where
	ptr		= WinGetAppPath 
	(path,_)= WinGetCStringAndFree ptr 99

OStickspersecond :== 1000				// OS max resolution of ticks per second

OSmmToHPixels :: !Real -> Int
OSmmToHPixels mm = toInt ( (mm/25.4) * toReal WinGetHorzResolution )

OSmmToVPixels :: !Real -> Int
OSmmToVPixels mm = toInt ( (mm/25.4) * toReal WinGetVertResolution )

OSmaxScrollWindowSize :: (!Int,!Int)
OSmaxScrollWindowSize = WinMaxScrollWindowSize

OSmaxFixedWindowSize :: (!Int,!Int)
OSmaxFixedWindowSize = WinMaxFixedWindowSize

OSscreenrect :: !*OSToolbox -> (!Rect,!*OSToolbox)
OSscreenrect tb
	# (screenWidth, tb)	= WinScreenXSize tb
	# (screenHeight,tb)	= WinScreenYSize tb
	= ({rleft=0,rtop=0,rright=screenWidth,rbottom=screenHeight},tb)