flat_controls.e 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. class FLAT_CONTROLS
  2. inherit
  3. IUP_INTERFACE
  4. create {ANY}
  5. make
  6. feature {ANY}
  7. make
  8. local
  9. gui: IUP
  10. i: STRING
  11. a, b, c, d: ARRAY[IUP_WIDGET]
  12. ff: IUP_FLAT_FRAME
  13. ft: IUP_FLAT_TABS
  14. f1, f2, f3, f4, f5, f6, f7, f8: IUP_FLAT_BUTTON
  15. ftg: IUP_FLAT_TOGGLE
  16. scroll: IUP_FLAT_SCROLL_BOX
  17. v: IUP_VBOX
  18. h1, h2: IUP_HBOX
  19. sep: IUP_FLAT_SEPARATOR
  20. w: IUP_DIALOG
  21. do
  22. gui := iup_open
  23. create f1.flat_button("Flat button 1")
  24. f1.set_cb_flat_action(agent close)
  25. f1.set_padding(5, 3)
  26. f1.set_border(True)
  27. create f2.flat_button("Flat button 2")
  28. f2.set_cb_flat_action(agent close)
  29. f2.set_padding(5, 3)
  30. f2.set_border(True)
  31. create f3.flat_button("Flat button 3")
  32. f3.set_cb_flat_action(agent close)
  33. f3.set_padding(5, 3)
  34. f3.set_border(True)
  35. create f4.flat_button("Flat button 4")
  36. f4.set_cb_flat_action(agent close)
  37. f4.set_padding(5, 3)
  38. f4.set_border(True)
  39. create f5.flat_button("Flat button 5")
  40. f5.set_cb_flat_action(agent close)
  41. f5.set_padding(5, 3)
  42. f5.set_border(True)
  43. create f6.flat_button("Flat button 6 to test a flat scroll box at eiffel-iup")
  44. f6.set_cb_flat_action(agent close)
  45. f6.set_padding(5, 3)
  46. f6.set_border(True)
  47. create f7.flat_button("Flat button 7 to test a flat scroll box at eiffel-iup")
  48. f7.set_cb_flat_action(agent close)
  49. f7.set_padding(5, 3)
  50. f7.set_border(True)
  51. create f8.flat_button("Flat button 8 to test a flat scroll box at eiffel-iup")
  52. f8.set_cb_flat_action(agent close)
  53. f8.set_padding(5, 3)
  54. f8.set_border(True)
  55. create ftg.flat_toggle("Option")
  56. a := {ARRAY[IUP_WIDGET]} << f4, f5, ftg >>
  57. create h1.hbox(a)
  58. create ff.flat_frame(h1)
  59. ff.set_title("A flat frame")
  60. b := {ARRAY[IUP_WIDGET]} << f1, f2, f3, ff >>
  61. create ft.flat_tabs(b)
  62. ft.set_tab_n_title("One", 0)
  63. ft.set_tab_n_title("Two", 1)
  64. ft.set_tab_n_title("Three", 2)
  65. ft.set_tab_n_title("Four", 3)
  66. ft.set_size(250, 250)
  67. c := {ARRAY[IUP_WIDGET]} << f6, f7, f8 >>
  68. create h2.hbox(c)
  69. create scroll.flat_scroll_box(h2)
  70. scroll.set_size(5, 5)
  71. create sep.flat_separator
  72. sep.set_horizontal_orientation
  73. sep.set_style_fill
  74. sep.set_rgb_color(0, 200, 0)
  75. d := {ARRAY[IUP_WIDGET]} << ft, sep, scroll >>
  76. create v.vbox(d)
  77. create w.dialog(v)
  78. w.set_title("Flat controls and containers")
  79. w.set_predefined_size("HALF", "HALF")
  80. i := w.show
  81. gui.main_loop
  82. gui.close
  83. end
  84. close (widget: IUP_FLAT_BUTTON): STRING
  85. do
  86. io.put_string("Executed %N")
  87. Result := "IUP_CLOSE"
  88. end
  89. end -- class FLAT_CONTROLS