iDataButtons.dcl 3.72 KB
Newer Older
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
1
2
3
4
5
6
7
8
definition module iDataButtons

// Prdefined i-Data making html Buttons, forms, and lay-out 
// (c) 2005 MJP

import iDataHandler
import GenLexOrd

9
10
11
12
13
14
15
derive gForm 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gUpd  	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gPrint 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gParse 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gerda 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive read 					  (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive write 	  				  (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
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
41
42
43
44
45
46
47

instance toBool		CheckBox, Button, RadioButton	// True if checkbox checked, button pressed
instance toInt		PullDownMenu					// Current index in pull down list
instance toString	PullDownMenu					// Corresponding element in pull down list
derive   gEq		HtmlDate, HtmlTime, PasswordBox
instance ==			HtmlDate, HtmlTime, PasswordBox
instance == 		(DisplayMode a) | == a
derive   gLexOrd	HtmlDate, HtmlTime
instance <			HtmlDate, HtmlTime
instance toString	HtmlDate, HtmlTime
instance +			HtmlTime
instance -			HtmlTime

// lay out

:: <-> a b		= (<->) infixl 5 a b				// place b to the left of a
:: <|> a b		= (<|>) infixl 4 a b				// place b below a

:: DisplayMode a 
				= DisplayMode a						// non-editable display of a
				| EditMode    a						// editable
				| HideMode    a						// hiding a
				| EmptyMode							// nothing to display or hide

:: HTML = HTML [BodyTag]							// to print html: NOT Parsed, CANNOT be stored NOR retrieved

// buttons representing classical html buttons

:: Button 		= Pressed 							// button pressed
				| LButton Int String				// label   button, size in pixels, label of button
				| PButton (Int,Int) String			// picture button, (height,width), reference to picture
:: CheckBox		= CBChecked String 					// checkbox 	checked
48
49
50
				| CBNotChecked String				// checkbox 	not checked	
				
//OBSOLETE: use RadioGroup instead whenever possible			
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
51
52
:: RadioButton	= RBChecked String					// radiobutton 	checked
				| RBNotChecked String				// radiobutton	not checked
53
54
55
56


:: RadioGroup	= RadioGroup (Int,[String])			// radiobutton group (item chosen, label list)

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
57
58
59
60
61
62
63
64
65
66
67
68
69
:: PullDownMenu	= PullDown (Int,Int) (Int,[String]) // pulldownmenu (number visible,width) (item chosen,menulist)		
:: TextInput	= TI Int Int						// Input box of size Size for Integers
				| TR Int Real						// Input box of size Size for Reals
				| TS Int String						// Input box of size Size for Strings
:: TextArea		= TextArea Int Int String			// Input Area Box, row col initial string
													// Only works in Submit mode due to Html restrictions!
:: PasswordBox	= PasswordBox String
	
// special's

:: HtmlDate 	= 	Date Int Int Int				// Day Month Year
:: HtmlTime 	= 	Time Int Int Int				// Hours Minutes Seconds

70
71
72

:: RefreshTimer	=	RefreshTimer Int				// The editor for this type refreshes it's form after n milliseconds

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
73
getTimeAndDate :: !*HSt -> *(!(!HtmlTime,!HtmlDate),!*HSt)