bubble_manager_test.anubis
1.66 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
58
59
60
61
A simple test for the bubble manager.
read widget.anubis
read host_window.anubis
read bubble_manager.anubis
read ticket_keeper.anubis
read mouse_tracker.anubis
read space.anubis
read tools/basis.anubis
read background.anubis
read text.anubis
The next monitor is attached (see below) to the variable 'mouse_position'. Hence it is
called each time the position of the mouse changes.
define One -> One
monitor
(
Var((Word32,Word32)) mouse_position,
Var(BMCommand) command_v,
Widget the_bubble
) =
(One _) |->
if *mouse_position is (mx,my) then
command_v <- show(abs_area([rect(mx,my,mx+1,my+1)]),the_bubble).
global define One
bubble_manager_test
(
List(String) args
) =
if load_system_font("helvetica_medium_r_10") is
{
failure then print("Cannot load system font.\n"),
success(font) then
with mouse_pos = var(((Word32,Word32))(0,0)),
command_v = var((BMCommand)clear),
the_bubble = background(4,rgb(200,255,200),
text("The bubble",font,rgb(0,0,0),0)),
ticket = register_monitor(mouse_pos,
monitor(mouse_pos,command_v,the_bubble)),
root = ticket_keeper((One _) |-> forget(ticket),
mouse_tracker(mouse_pos,
bubble_manager(command_v,
space(500,400,rgb(255,255,255))))),
forget(open_host_window(root,"Bubble Manager Test"))
}.