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

http://github.com/tybor/Liberty · Specman e · 31 lines · 25 code · 6 blank · 0 comment · 2 complexity · 98d821e0115a8128a283f648d9cf6346 MD5 · raw file

  1. class EIFFEL_COMPILER_BUTTON
  2. inherit
  3. GTK_RADIO_BUTTON redefine with_label,with_label_from_widget, on_toggled end
  4. G_SIGNALS
  5. creation with_label, with_label_from_widget
  6. feature
  7. with_label (a_group: G_SLIST[GTK_RADIO_BUTTON]; a_label: STRING) is
  8. do
  9. Precursor (a_group, a_label)
  10. connect (Current, "toggled", $on_toggled)
  11. end
  12. with_label_from_widget (a_widget: GTK_RADIO_BUTTON; a_label: STRING) is
  13. do
  14. Precursor (a_widget, a_label)
  15. connect (Current, "toggled", $on_toggled)
  16. end
  17. feature -- Callback
  18. on_toggled is
  19. do
  20. print ("Button `")
  21. print (label)
  22. if is_active then print ("' activated%N")
  23. else print ("' deactivated%N") end
  24. end
  25. end