/src/wrappers/gtk/examples/gtk-demo/demo.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 49 code · 13 blank · 6 comment · 3 complexity · 66fc29208609b525f813c19257e46701 MD5 · raw file

  1. indexing
  2. description: "A single complete demo widget for gtk-demo application."
  3. copyright: "[
  4. Copyright (C) 2006 Paolo Redaelli, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. deferred class DEMO
  19. inherit GTK_CONTAINER
  20. feature
  21. name: STRING is
  22. -- Demo name
  23. deferred
  24. end
  25. description: STRING is
  26. -- Demo description
  27. deferred
  28. end
  29. source_code: STRING
  30. -- Demo source code, loaded at runtime
  31. filename: STRING is
  32. -- Filename where the sourcecode is stored.
  33. deferred
  34. end
  35. subdemos: COLLECTION [DEMO]
  36. -- Eventual sub-demos
  37. has_children, has_subdemos: BOOLEAN is
  38. do
  39. Result := subdemos /= Void
  40. end
  41. --window: GTK_WINDOW
  42. feature {}
  43. load_source_code is
  44. local file: TEXT_FILE_READ
  45. do
  46. create file.connect_to (filename)
  47. check file_connected: file.is_connected end
  48. create source_code.make_empty
  49. file.read_tail_in (source_code)
  50. ensure source_code_loaded: source_code /= Void
  51. end
  52. invariant
  53. name_not_void: name /= Void
  54. source_code_loaded: source_code /= Void
  55. end