htmlButtons.dcl 2.96 KB
Newer Older
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
1
2
3
definition module htmlButtons

// Prdefined i-Data making html Buttons, forms, and lay-out 
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
4
// (c) 2005 MJP
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
5
6

import htmlHandler
Peter Achten's avatar
Peter Achten committed
7
import GenLexOrd
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
8

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
9
10
11
12
derive gForm 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gUpd  	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gPrint 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gParse 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
13
derive gerda 	(,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
14

Peter Achten's avatar
Peter Achten committed
15
16
17
18
19
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
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
20
instance == 		(DisplayMode a) | == a
Peter Achten's avatar
Peter Achten committed
21
22
23
24
25
derive   gLexOrd	HtmlDate, HtmlTime
instance <			HtmlDate, HtmlTime
instance toString	HtmlDate, HtmlTime


Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
26
27
28
29
30
31
32
33
34
35
36
// 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

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
37
38
:: HTML = HTML [BodyTag]							// to print html: NOT Parsed, CANNOT be stored NOR retrieved

Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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
				| CBNotChecked String				// checkbox 	not checked
:: RadioButton	= RBChecked String					// radiobutton 	checked
				| RBNotChecked String				// radiobutton	not checked
:: 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
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
52
:: TextArea		= TextArea Int Int String			// Input Area Box, row col initial string
53
													// Only works in Submit mode due to Html restrictions!
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
54
:: PasswordBox	= PasswordBox String
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
55
56
57
	
// special's

58
:: HtmlDate 	= 	Date Int Int Int				// Day Month Year
Rinus Plasmeijer's avatar
Rinus Plasmeijer committed
59
60
:: HtmlTime 	= 	Time Int Int Int				// Hours Minutes Seconds

61
getTimeAndDate :: !*HSt -> *(!(!HtmlTime,!HtmlDate),!*HSt)