/src/wrappers/gtk/examples/hello/hello.e

http://github.com/tybor/Liberty · Specman e · 60 lines · 44 code · 11 blank · 5 comment · 0 complexity · e3bac4607d2db7b8ab91fb75d2646144 MD5 · raw file

  1. indexing
  2. copyright: "(C) 2005 Paolo Redaelli "
  3. license: "LGPL v2 or later"
  4. date: "$Date:$"
  5. revision "$REvision:$"
  6. class HELLO
  7. insert GTK_MAIN
  8. creation make
  9. feature
  10. on_clicked (a_button: GTK_BUTTON) is
  11. require valid_button: a_button /= Void
  12. do
  13. print (once "Button `")
  14. print (a_button.label)
  15. print (once "' clicked%N")
  16. end
  17. feature {} -- creation
  18. make is
  19. local
  20. w1,w2: GTK_WIDGET; win: GTK_WINDOW; b: GTK_BUTTON
  21. rw: GTK_WINDOW; rb: GTK_BUTTON
  22. do
  23. initialize
  24. create window.make
  25. create button.with_label (label)
  26. window.set_title (title)
  27. window.add (button)
  28. button.connect_agent_to_clicked_signal (agent on_clicked)
  29. button.show
  30. window.show
  31. debug
  32. print ("button is at: "+button.to_pointer.to_string+"%N")
  33. end
  34. check
  35. -- window = r.wrapper(window.handle)
  36. end
  37. run_main_loop -- instead of "gtk_main"
  38. end
  39. feature -- Disposing
  40. feature
  41. window: MY_WINDOW
  42. -- the window
  43. title: STRING is "Wow my first Eiffel window!"
  44. -- window title
  45. button: MY_BUTTON
  46. -- the button
  47. label: STRING is "Hello world from eiffel-gtk!"
  48. -- button's label
  49. end