PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/get_text/vision/example.e

http://github.com/tybor/Liberty
Specman e | 46 lines | 31 code | 8 blank | 7 comment | 0 complexity | e04f14df1d8a42d2cb9ccf59ece46ca2 MD5 | raw file
 1class EXAMPLE
 2
 3
 4inherit
 5	GRAPHIC
 6		-- Give access to constants (vision, colors...)
 7
 8creation {ANY}
 9	make
10
11feature {}
12	toplevel_window: TOPLEVEL_WINDOW
13
14	make is
15		local
16			label: LABEL
17		do
18			create toplevel_window.default_create
19			toplevel_window.set_title(translator.translation("Hello world!"))
20			toplevel_window.set_background_color(white_color)
21			toplevel_window.map
22			-- put the window on the screen; may be done later
23			create label.make(unicode_translator.translation("Hello world!"))
24			-- windows are containers, you add widgets into them
25			toplevel_window.child_attach(label)
26			-- register procedure to call on user requests on 'quit'
27			toplevel_window.when_close_requested(agent vision.loop_stack.break)
28			-- start the event loop. The event loop executes registred
29			-- behavior for user actions.
30			-- It will stop when break is called (vision.loop_stack.break).
31			vision.start
32			io.put_string(translator.translation("The end%N"))
33		end
34
35	translator: TRANSLATOR is
36		once
37			create Result.init
38		end
39
40	unicode_translator: UNICODE_TRANSLATOR is
41		once
42			create Result.connect_to(translator)
43			translator.bind_text_domain_code_set(Result.text_domain, once "UTF-8")
44		end
45
46end -- class EXAMPLE