PageRenderTime 12ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/examples/progress_bar/progress_bar.e

http://github.com/tybor/Liberty
Specman e | 58 lines | 44 code | 13 blank | 1 comment | 0 complexity | b36df72177903b4a64432c26545acb5b MD5 | raw file
 1class PROGRESS_BAR
 2
 3inherit 
 4	GTK
 5
 6creation 
 7	make
 8
 9feature
10	
11	bar: GTK_PROGRESS_BAR
12
13	pulse: GTK_BUTTON
14	
15	hbox: GTK_HBOX
16	
17	window: GTK_WINDOW
18	
19	make is
20			-- Make
21		local i: ITERATOR[G_PARAM_SPEC]
22		do
23			gtk.initialize							
24			create window.make
25			window.set_title ("Progress Bar")
26			window.midscreen
27
28			create bar.make
29			bar.set_text ("A simple example of a progress bar")
30			bar.set_fraction (0.35)
31
32			create hbox.make (False, 2)
33			hbox.pack_start_defaults (bar)
34
35			create pulse.with_label("Pulse!")
36			pulse.connect_agent_to_clicked_signal(agent clicked)
37			hbox.pack_end_defaults (pulse)
38			
39			window.add (hbox)
40			print ("Window has "+window.properties.count.out+" properties: ")
41			from
42				i:=window.properties.get_new_iterator;
43				i.start
44			until i.is_off loop
45				std_output.put_string(i.item.name) std_output.put_string(once " - ")
46				std_output.put_string(i.item.nick) std_output.put_string(once ":* ")
47				print (i.item.blurb) std_output.put_new_line
48				i.next
49			end
50			window.show_all
51			gtk.run_main_loop
52		end
53
54	clicked (a_button: GTK_BUTTON) is
55		do
56			bar.pulse
57		end
58end