PageRenderTime 20ms CodeModel.GetById 18ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/gtk/examples/multiple-hello/hello.e

http://github.com/tybor/Liberty
Specman e | 60 lines | 48 code | 10 blank | 2 comment | 0 complexity | 3af6e999000f43ad7c7c11b94362a0d8 MD5 | raw file
 1indexing
 2	copyright: "(C) 2005 Paolo Redaelli "
 3	license: "LGPL v2 or later"
 4	date: "$Date:$"
 5	revision "$REvision:$"
 6
 7class HELLO
 8
 9insert 
10	GTK
11	EXCEPTIONS
12
13creation	make
14	
15feature {} -- creation
16	make is
17		local i: INTEGER; window: MY_WINDOW
18		do
19			gtk.initialize
20			from i:=eiffel_windows_count until i=0 loop
21				create window.make
22				window.set_title ("Window n."+i.out)
23				window.show
24				i := i - 1
25			end
26			from i:=c_windows_count until i=0 loop
27				c_window
28				i:=i-1
29			end
30			gtk.toplevels.do_all(agent print_window_label)
31			gtk.run_main_loop
32		end
33
34	print_window_label (a_window: GTK_WINDOW) is
35		require a_window/=Void
36		do
37			print(a_window.title)
38		end
39feature
40	eiffel_windows_count: INTEGER is 3
41	c_windows_count: INTEGER is 2
42	
43	-- windows: COLLECTION[GTK_WINDOW]
44	
45	c_window is
46			-- Create and show a GtkWindow from the C language
47		external "C inline use <gtk/gtk.h>"
48		alias "[
49				 /* create a GtkWindow at C level */
50				 GtkWindow *win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
51				 gtk_window_set_title(win, "This windows is C created." );
52				 gtk_widget_show(GTK_WIDGET(win));
53				 printf("Creating a GtkWindow from C at %p\n",win);
54				]"
55		ensure gtk.toplevels.count > old gtk.toplevels.count
56		end
57end
58	
59	
60