/src/wrappers/gtk/examples/toolbar/tool_bar_demo.e

http://github.com/tybor/Liberty · Specman e · 72 lines · 60 code · 12 blank · 0 comment · 0 complexity · 5e5c13888820dddb0b8edc3050bc7b00 MD5 · raw file

  1. class TOOL_BAR_DEMO
  2. insert
  3. GTK
  4. GTK_STOCK_ITEMS
  5. creation make
  6. feature -- GUI elements
  7. window: GTK_WINDOW
  8. new_button, open_button,close_button,quit_button: GTK_TOOL_BUTTON
  9. separator: GTK_SEPARATOR_TOOL_ITEM
  10. menu_item: GTK_MENU_TOOL_BUTTON
  11. menu: GTK_MENU
  12. find_foo, find_bar: GTK_MENU_ITEM
  13. radio1, radio2: GTK_RADIO_TOOL_BUTTON
  14. toolbar: GTK_TOOLBAR
  15. feature -- Initialisation
  16. make is
  17. do
  18. gtk.initialize
  19. create window.make
  20. window.set_title (window_title)
  21. window.connect_agent_to_destroy_signal (agent on_destroy)
  22. create new_button.from_stock(gtk_stock_new)
  23. create open_button.from_stock(gtk_stock_open)
  24. create close_button.from_stock(gtk_stock_close)
  25. create quit_button.from_stock(gtk_stock_quit)
  26. create separator.make
  27. create menu_item.from_stock(gtk_stock_find)
  28. create menu.make
  29. create find_foo.with_label("Find foo")
  30. create find_bar.with_label("Find bar")
  31. create radio1.from_group(Void)
  32. create radio2.from_widget(radio1)
  33. radio1.set_label("SmartEiffel")
  34. radio2.set_label("ISE (ECMA?) Eiffel")
  35. menu_item.set_menu(menu)
  36. menu.append(find_foo)
  37. menu.append(find_bar)
  38. quit_button.connect_agent_to_clicked_signal(agent on_destroy)
  39. create toolbar.make
  40. toolbar.append (new_button)
  41. toolbar.append (open_button)
  42. toolbar.append (close_button)
  43. toolbar.append (quit_button)
  44. toolbar.append (separator)
  45. toolbar.append (menu_item)
  46. toolbar.append (radio1)
  47. toolbar.append (radio2)
  48. window.add(toolbar)
  49. window.show_all
  50. gtk.run_main_loop
  51. end
  52. feature -- Agents
  53. on_destroy (a_gtk_object: GTK_OBJECT) is
  54. do
  55. print ("on destroy has been called%N")
  56. gtk.quit
  57. end
  58. feature -- Constants
  59. window_title: STRING is "Eiffel GTK Toolbar demo"
  60. end