/src/wrappers/gtk/examples/multiple-hello/my_window.e
Specman e | 46 lines | 39 code | 5 blank | 2 comment | 5 complexity | 7d0f63851a4cf1016d71a39bac259971 MD5 | raw file
1class MY_WINDOW 2 3inherit GTK_WINDOW redefine make, on_destroy end 4 5creation make 6 7feature 8 make is 9 do 10 Precursor 11 enable_on_destroy 12 -- create destroy_callback.make; destroy_callback.connect (Current, agent on_destroy) 13 end 14 15feature -- callback 16 -- destroy_callback: DESTROY_CALLBACK 17 on_destroy is 18 local 19 windows: G_LIST[GTK_WINDOW]; wi: ITERATOR[GTK_WINDOW] 20 w: GTK_WINDOW; t: STRING 21 do 22 windows:=gtk.toplevels 23 check windows/=Void end 24 if windows.count>1 then 25 print (windows.count.out+" windows: ") 26 from wi:=windows.get_new_iterator; wi.start until wi.is_off 27 loop 28 w:=wi.item 29 if w/=Void then 30 t:=w.title 31 if t/=Void then print ("'"+t+"'") 32 else print ("No title") end 33 else 34 raise("Void window") 35 end 36 wi.next 37 if not wi.is_off then print (", ") end 38 end 39 print ("%N"+title+" is being closed.%N") 40 else 41 print ("%NLast window is being closed, we quit.%N") 42 gtk.quit 43 end 44 end 45end 46