PageRenderTime 19ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/multi_tasking/example1.e

http://github.com/tybor/Liberty
Specman e | 47 lines | 36 code | 7 blank | 4 comment | 0 complexity | b203d752c09bbbfcacebd8533fd217c5 MD5 | raw file
 1class EXAMPLE1
 2--
 3-- This example show how to use background periodic job
 4--
 5	
 6inherit
 7	GRAPHIC
 8	
 9creation {ANY}
10	make
11	
12feature {}
13	make is
14		local
15			toplevel_window: TOPLEVEL_WINDOW; clock_window: SUB_WINDOW
16		do
17			create toplevel_window
18			-- The default layout is column.
19			create clock_window.make_layout(toplevel_window, create {KITCHEN_CLOCK})
20			clock_window.set_x_expand(True)
21			clock_window.set_y_expand(True)
22			clock_window.map
23			
24			toplevel_window.child_attach(create {HORIZONTAL_LINE})
25			
26			add_controls(toplevel_window)
27			toplevel_window.set_title("Background example")
28			toplevel_window.set_background_color(white_color)
29			toplevel_window.map
30			vision.start
31		end
32
33	add_controls (window: WINDOW) is
34		local
35			container: CONTAINER; layout: ROW_LAYOUT; exit_button: BUTTON
36		do
37			create layout
38			create container.make_layout(window, layout)
39			container.set_x_expand(True)
40			layout.set_border(5)
41			layout.set_spacing(5)
42			layout.insert_button_space
43			create exit_button.with_label(container, U"Exit")
44			exit_button.when_left_clicked(agent vision.loop_stack.break)
45		end
46
47end -- class EXAMPLE1