/src/wrappers/gtk/examples/progress_bar/progress_bar.e

http://github.com/tybor/Liberty · Specman e · 58 lines · 44 code · 13 blank · 1 comment · 0 complexity · b36df72177903b4a64432c26545acb5b MD5 · raw file

  1. class PROGRESS_BAR
  2. inherit
  3. GTK
  4. creation
  5. make
  6. feature
  7. bar: GTK_PROGRESS_BAR
  8. pulse: GTK_BUTTON
  9. hbox: GTK_HBOX
  10. window: GTK_WINDOW
  11. make is
  12. -- Make
  13. local i: ITERATOR[G_PARAM_SPEC]
  14. do
  15. gtk.initialize
  16. create window.make
  17. window.set_title ("Progress Bar")
  18. window.midscreen
  19. create bar.make
  20. bar.set_text ("A simple example of a progress bar")
  21. bar.set_fraction (0.35)
  22. create hbox.make (False, 2)
  23. hbox.pack_start_defaults (bar)
  24. create pulse.with_label("Pulse!")
  25. pulse.connect_agent_to_clicked_signal(agent clicked)
  26. hbox.pack_end_defaults (pulse)
  27. window.add (hbox)
  28. print ("Window has "+window.properties.count.out+" properties: ")
  29. from
  30. i:=window.properties.get_new_iterator;
  31. i.start
  32. until i.is_off loop
  33. std_output.put_string(i.item.name) std_output.put_string(once " - ")
  34. std_output.put_string(i.item.nick) std_output.put_string(once ":* ")
  35. print (i.item.blurb) std_output.put_new_line
  36. i.next
  37. end
  38. window.show_all
  39. gtk.run_main_loop
  40. end
  41. clicked (a_button: GTK_BUTTON) is
  42. do
  43. bar.pulse
  44. end
  45. end