Mon Jun 3 15:21:17 PDT 2002
[netwalk.git] / button.e
blob14ae364ea9350751435df3ff6b946209684263c9
1 class BUTTON
2 inherit
3 WIDGET
4 creation make
5 feature
6 string : STRING
8 make(s : STRING) is
9 do
10 widget_init
11 !!string.copy(s)
12 !!img.make
13 update_image
14 end
16 process_event(e : EVENT) is
18 if e.type = sdl_mousebuttondown then
19 raise_signal(signal_activate)
20 end
21 end
23 update is
25 fill_rect(0, 0, width, height, darkgreen)
26 fill_rect(1, 1, width - 2, height - 2, black)
27 if img.is_connected then
28 blit(img, 2, 2)
29 end
30 end
32 img : IMAGE
34 update_image is
36 if img.is_connected then
37 img.free
38 end
39 if string.count > 0 then
40 img.render_string(string, font, white)
41 end
42 end
43 end