/tutorial/get_text/vision/example.e

http://github.com/tybor/Liberty · Specman e · 46 lines · 31 code · 8 blank · 7 comment · 0 complexity · e04f14df1d8a42d2cb9ccf59ece46ca2 MD5 · raw file

  1. class EXAMPLE
  2. inherit
  3. GRAPHIC
  4. -- Give access to constants (vision, colors...)
  5. creation {ANY}
  6. make
  7. feature {}
  8. toplevel_window: TOPLEVEL_WINDOW
  9. make is
  10. local
  11. label: LABEL
  12. do
  13. create toplevel_window.default_create
  14. toplevel_window.set_title(translator.translation("Hello world!"))
  15. toplevel_window.set_background_color(white_color)
  16. toplevel_window.map
  17. -- put the window on the screen; may be done later
  18. create label.make(unicode_translator.translation("Hello world!"))
  19. -- windows are containers, you add widgets into them
  20. toplevel_window.child_attach(label)
  21. -- register procedure to call on user requests on 'quit'
  22. toplevel_window.when_close_requested(agent vision.loop_stack.break)
  23. -- start the event loop. The event loop executes registred
  24. -- behavior for user actions.
  25. -- It will stop when break is called (vision.loop_stack.break).
  26. vision.start
  27. io.put_string(translator.translation("The end%N"))
  28. end
  29. translator: TRANSLATOR is
  30. once
  31. create Result.init
  32. end
  33. unicode_translator: UNICODE_TRANSLATOR is
  34. once
  35. create Result.connect_to(translator)
  36. translator.bind_text_domain_code_set(Result.text_domain, once "UTF-8")
  37. end
  38. end -- class EXAMPLE