Mon Jun 3 15:21:17 PDT 2002
[netwalk.git] / hs_window.e
blob0716c1c3ff7b48bd02bad0015b1537a0ac313b17
1 class HS_WINDOW
2 inherit
3 WINDOW
4 creation make
5 feature
6 row_count : INTEGER
7 score_list : LINKED_LIST[SCORE_DISPLAY]
9 init_scores(l : LINKED_LIST[PRESET]) is
11 !!score_list.make
12 l.do_all(agent add_new_score(?))
13 end
15 add_new_score(p : PRESET) is
16 local
17 sc : SCORE
18 sd : SCORE_DISPLAY
19 x, y : INTEGER
21 sc := p.hiscore
22 !!sd.make(p.name, sc)
23 x := 10
24 y := row_count * 20 + 50
25 row_count := row_count + 1
26 add_widget(sd.level_l, x, y)
27 add_widget(sd.name_l, 70 + x, y)
28 add_widget(sd.score_l, 120 + x, y)
29 add_widget(sd.time_l, 170 + x, y)
30 score_list.add_last(sd)
31 end
33 update_score(p : PRESET) is
34 local
35 it : ITERATOR[SCORE_DISPLAY]
36 sc : SCORE
37 sd : SCORE_DISPLAY
39 it := score_list.get_new_iterator
40 from it.start
41 until it.is_off
42 loop
43 sd := it.item
44 if sd.name.is_equal(p.name) then
45 sc := p.hiscore
46 sd.name_l.put_string(sc.name)
47 sd.time_l.put_string(sc.time.to_string)
48 sd.score_l.put_string(sc.score.to_string)
49 end
50 it.next
51 end
52 end
54 make is
55 local
56 b : BUTTON
57 c : COMMAND
58 l : LABEL
59 x, y : INTEGER
61 widget_init
63 put_size(250, 200)
64 !!b.make("Ok")
65 b.put_size(60, 20)
66 !COMMAND_ACTIVATE!c.make(Current)
67 b.put_command(c, b.signal_activate)
68 add_widget(b, 100, 175)
70 x := 10
71 y := 5
73 !!l.make("Level")
74 l.put_size(70, 20)
75 add_widget(l, x, y)
77 !!l.make("Name")
78 l.put_size(50, 20)
79 add_widget(l, 70 + x, y)
81 !!l.make("Score")
82 l.put_size(50, 20)
83 add_widget(l, 120 + x, y)
85 !!l.make("Time")
86 l.put_size(50, 20)
87 add_widget(l, 170 + x, y)
88 end
89 end