PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/modal/modal.e

http://github.com/tybor/Liberty
Specman e | 48 lines | 42 code | 5 blank | 1 comment | 1 complexity | 95ed9788e70b853d908f2de30fbf424c MD5 | raw file
 1class MODAL
 2	-- This example show how to make modal windows.
 3
 4inherit
 5	GRAPHIC
 6
 7creation {ANY}
 8	make
 9
10feature {}
11	make is
12		do
13			new_window(0)
14			io.put_string("The end%N")
15		end
16
17	new_window (level: INTEGER) is
18		local
19			message: LABEL; line: HORIZONTAL_LINE; new, quit: BUTTON; win: TOPLEVEL_WINDOW
20			layout: COLUMN_LAYOUT; txt: UNICODE_STRING
21		do
22			if level > 0 then
23				vision.new_loop
24			end
25			create layout
26			create win.make(layout)
27			layout.set_border(5)
28			layout.set_spacing(5)
29			win.set_title("Hello World - " + level.to_string)
30			win.set_background_color(white_color)
31			win.map
32			txt := U"Hello World ! level = "
33			level.append_in_unicode(txt)
34			create message.make(txt)
35			win.child_attach(message)
36			create line
37			win.child_attach(line)
38			create new.with_label(win, U"New window")
39			new.when_left_clicked(agent new_window(level + 1))
40			create quit.with_label(win, U"Exit")
41			quit.when_left_clicked(agent win.unmap)
42			quit.when_left_clicked(agent vision.loop_stack.break)
43			quit.when_right_down(agent win.set_background_color(black_color))
44			quit.when_right_up(agent win.set_background_color(white_color))
45			vision.start
46		end
47
48end -- class MODAL