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

http://github.com/tybor/Liberty · Specman e · 46 lines · 39 code · 5 blank · 2 comment · 5 complexity · 7d0f63851a4cf1016d71a39bac259971 MD5 · raw file

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