/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

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