PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/wrappers/gtk/examples/buttons/buttons_window.e

http://github.com/tybor/Liberty
Specman e | 72 lines | 58 code | 13 blank | 1 comment | 3 complexity | 14165649a8a40d692ad99fb649d0ccfd MD5 | raw file
 1class BUTTONS_WINDOW
 2inherit
 3	GTK_WINDOW redefine make, on_destroy end
 4	GTK
 5creation make
 6feature make is
 7		do
 8			Precursor
 9			set_title (once "Buttons demo")
10			midscreen
11			
12			create vbox.make (True, 5)
13			add (vbox)
14
15			create main_label.with_markup_label (main_label_string)
16			vbox.pack_start_defaults (main_label)
17			
18			create hbox.make (False, 2)
19			create flag.with_label ("I use one compiler")
20			create toggle.with_mnemonic ("I prefer _Free Software")
21			hbox.pack_start (flag, False , False , 5)
22			hbox.pack_start (toggle, True , False , 20)
23			vbox.pack_start_defaults (hbox)
24			create radio1.with_label (Void, "SmartEiffel")
25			create radio2.with_label_from_widget (radio1, "VisualEiffel")
26			create radio3.with_label_from_widget (radio1, "ISE Eiffel")
27			vbox.pack_start_defaults (radio1)
28			vbox.pack_start_defaults (radio2)
29			vbox.pack_start_defaults (radio3)
30
31			create smarteiffel_choosen.make 
32			smarteiffel_choosen.connect (radio1, agent on_gnu_compiler_toggled (?))
33			enable_on_destroy -- connect (Current, "destroy", $on_destroy)
34			-- radio1.set_active	radio2.set_inactive	radio3.set_inactive
35		end
36
37feature -- Widgets
38	main_label: GTK_LABEL
39	hbox: GTK_HBOX
40	vbox: GTK_VBOX
41	radio1,radio2,radio3: EIFFEL_COMPILER_BUTTON
42	buttons: G_SLIST[GTK_RADIO_BUTTON]
43	flag: GTK_CHECK_BUTTON
44	toggle: GTK_TOGGLE_BUTTON
45
46feature -- Strings
47	main_label_string: STRING is "[
48											<b><big>Eiffel wrappers for GTK</big> are a work in progress</b>.
49											We need volunteers. Would help us?
50											]"
51											
52feature  -- Callbacks
53	smarteiffel_choosen: TOGGLED_CALLBACK[GTK_RADIO_BUTTON]
54
55	on_destroy is
56		do
57			print ("Buttons demo ending%N")
58			gtk.quit
59		end
60
61	on_gnu_compiler_toggled (a_toggle: GTK_TOGGLE_BUTTON) is
62		do
63			print ("on_gnu_compiler_toggled reached%N")
64			if a_toggle.is_active
65			then print ("You wisely chose SmartEiffel%N")
66			else  print ("Then help us to make it easy to use and develop and multi-compiler%N") end
67		end
68	
69end
70	
71	
72