PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/drawing/free_drawing2.e

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