PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/src/wrappers/gtk/examples/toolbar/tool_bar_demo.e

http://github.com/tybor/Liberty
Specman e | 72 lines | 60 code | 12 blank | 0 comment | 0 complexity | 5e5c13888820dddb0b8edc3050bc7b00 MD5 | raw file
 1class TOOL_BAR_DEMO
 2
 3insert 
 4	GTK
 5	GTK_STOCK_ITEMS
 6creation make
 7
 8feature -- GUI elements
 9	window: GTK_WINDOW
10	new_button, open_button,close_button,quit_button: GTK_TOOL_BUTTON
11	separator: GTK_SEPARATOR_TOOL_ITEM
12	menu_item: GTK_MENU_TOOL_BUTTON
13	menu: GTK_MENU
14	find_foo, find_bar: GTK_MENU_ITEM
15	radio1, radio2: GTK_RADIO_TOOL_BUTTON
16	toolbar: GTK_TOOLBAR
17
18feature -- Initialisation
19	make is
20		do
21			gtk.initialize
22			create window.make
23			window.set_title (window_title)
24			window.connect_agent_to_destroy_signal (agent on_destroy)
25
26			create new_button.from_stock(gtk_stock_new) 
27			create open_button.from_stock(gtk_stock_open)
28			create close_button.from_stock(gtk_stock_close)
29			create quit_button.from_stock(gtk_stock_quit)
30			create separator.make
31			create menu_item.from_stock(gtk_stock_find)
32			
33			create menu.make
34			create find_foo.with_label("Find foo")
35			create find_bar.with_label("Find bar")
36			
37			create radio1.from_group(Void) 
38			create radio2.from_widget(radio1)
39			radio1.set_label("SmartEiffel")
40			radio2.set_label("ISE (ECMA?) Eiffel")
41						
42			menu_item.set_menu(menu)
43			menu.append(find_foo)
44			menu.append(find_bar)
45
46			quit_button.connect_agent_to_clicked_signal(agent on_destroy)
47
48			create toolbar.make
49			toolbar.append (new_button)
50			toolbar.append (open_button)
51			toolbar.append (close_button)
52			toolbar.append (quit_button) 
53			toolbar.append (separator)
54			toolbar.append (menu_item)
55			toolbar.append (radio1)
56			toolbar.append (radio2)
57			window.add(toolbar)
58			window.show_all
59
60			gtk.run_main_loop
61		end
62
63feature -- Agents
64	on_destroy (a_gtk_object: GTK_OBJECT) is
65		do
66			print ("on destroy has been called%N")
67			gtk.quit
68		end
69
70feature -- Constants
71	window_title: STRING is "Eiffel GTK Toolbar demo"
72end