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

/src/wrappers/gtk/examples/menu/menu_demo.e

http://github.com/tybor/Liberty
Specman e | 84 lines | 64 code | 20 blank | 0 comment | 0 complexity | 056355cfbb4b378b5dfc50b025370f15 MD5 | raw file
 1class MENU_DEMO
 2insert GTK 
 3creation make
 4feature
 5	make is
 6		local label: STRING
 7		do
 8			gtk.initialize 
 9			create window.make
10			window.set_title (window_title)
11			create menu_bar.make
12			create file_menu.with_label (file_label)
13			create edit_menu.with_label (edit_label)
14			create view_menu.with_label (view_label)
15			
16			create file_submenu.make
17			create edit_submenu.make
18			create view_submenu.make
19
20			create open_menu.with_label (open_label)
21			create save_menu.with_label (save_label)
22			create file_menu_separator.make
23			create quit_menu.with_label (quit_label)
24
25			create view_all_menu.with_label (view_all_label)
26			create view_some_menu.with_label (view_some_label)
27			
28			window.add (menu_bar)
29			menu_bar.append (file_menu)
30			menu_bar.append (edit_menu)
31			menu_bar.append (view_menu)
32
33			file_menu.set_submenu (file_submenu)
34			edit_menu.set_submenu (edit_submenu)
35			view_menu.set_submenu (view_submenu)
36
37			file_submenu.append (open_menu)
38			file_submenu.append (save_menu)
39			file_submenu.append (file_menu_separator)
40			file_submenu.append (quit_menu)
41
42			edit_submenu.append (view_all_menu)
43			edit_submenu.append (view_some_menu)
44			window.show_all
45			
46			print ("Testing CONST_STRING using GTK_MENU.label feature%N")
47			edit_submenu.set_title("Edit submenu")
48			label := edit_submenu.title
49			label.prepend ("edit_submenu.label='")
50			label.append  ("'.%N")
51			print (label)
52			
53			
54			gtk.run_main_loop 
55		end
56
57feature -- Widgets
58	window: GTK_WINDOW
59	menu_bar: GTK_MENU_BAR
60	
61	file_menu, edit_menu, view_menu: GTK_MENU_ITEM
62
63	file_submenu, edit_submenu, view_submenu: GTK_MENU
64
65	open_menu,save_menu,quit_menu: GTK_MENU_ITEM
66	file_menu_separator: GTK_SEPARATOR_MENU_ITEM
67
68	view_all_menu, view_some_menu: GTK_MENU_ITEM
69feature -- Labels
70	window_title: STRING is "Menu demo"
71	
72	file_label: STRING is "File"
73	edit_label: STRING is "Edit"
74	view_label: STRING is "View"
75
76	open_label: STRING is "Open"
77	save_label: STRING is "Save"
78	quit_label: STRING is "Quit"
79
80	view_all_label: STRING is "View all"
81	view_some_label: STRING is "View some"
82end
83
84