simple_notepad_2.e 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. class SIMPLE_NOTEPAD_2
  2. insert
  3. IUP_INTERFACE
  4. create {ANY}
  5. make
  6. feature {ANY}
  7. exit_cb (widget: IUP_MENU_ITEM): STRING
  8. do
  9. Result := "IUP_CLOSE"
  10. end
  11. make
  12. local
  13. i: STRING
  14. gui: IUP
  15. ml: IUP_MULTILINE
  16. v: IUP_VBOX
  17. w: IUP_DIALOG
  18. item_exit, item_open, item_saveas: IUP_MENU_ITEM
  19. sep: IUP_MENU_SEPARATOR
  20. file_menu, menu: IUP_MENU
  21. sub1_menu: IUP_SUBMENU
  22. do
  23. gui := iup_open
  24. create ml.multiline
  25. ml.set_expand("YES")
  26. create v.vbox({ARRAY[IUP_WIDGET] 1, << ml >>})
  27. create item_open.item("Open")
  28. item_open.set_hide_mark(True)
  29. create item_saveas.item("Save As")
  30. item_saveas.set_hide_mark(True)
  31. create item_exit.item("Exit")
  32. item_exit.set_hide_mark(True)
  33. item_exit.set_cb_action(agent exit_cb(?))
  34. create sep.separator
  35. create file_menu.menu({ARRAY[IUP_MENU_ELEMENT] 1, << item_open, item_saveas, sep, item_exit >>})
  36. create sub1_menu.submenu("File", file_menu)
  37. create menu.menu({ARRAY[IUP_MENU_ELEMENT] 1, << sub1_menu >>})
  38. create w.dialog(v)
  39. w.set_menu_widget(menu)
  40. w.set_title("Simple Notepad")
  41. w.set_predefined_size("QUARTER", "QUARTER")
  42. i := w.show_predefined_xy("IUP_CENTER", "IUP_CENTER")
  43. w.set_user_size(0, 0)
  44. gui.main_loop
  45. gui.close
  46. end
  47. end