background.anubis
1.38 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
The Anubis Project.
A Widget System (4th version).
The 'background' widget.
Copyright (c) Alain Proute' 2005.
Authors: Alain Proute'
read widget.anubis
public define Widget
background
(
Word32 margin,
RGB color,
Widget content
).
--- That's all for the public part ! --------------------------------------------------
public define Widget
background
(
Word32 margin,
RGB color,
Widget content
) =
with margin2 = margin*2,
create_widget
(
/* getting the stretching capabilities */
(One u) |-> if size(content) is (w,h) then stretch_cap(w,h,w,h),
/* stretching the background widget */
(Word32 w, Word32 h) |-> unique,
/* getting the size */
(One u) |-> if size(content) is (cw,ch) then (cw+margin2,ch+margin2),
(WidgetDrawToolBox dtb) |->
if size(content) is (cw,ch) then
draw(dtb)(rect(0,0,cw+margin2,ch+margin2),color);
draw(dtb)(content,margin,margin),
(WidgetEventToolBox etb, WidgetEvent e) |->
transmit(etb)(content,margin,margin,e),
(One u) |-> registrations(content)(unique)
).