iup_cbox.e 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. class IUP_CBOX
  2. -- Container for position elements in absolute coordinates. It is a
  3. -- concrete layout container.
  4. -- The IupCbox is equivalent of a IUP_VBOX or IUP_HBOX where all the
  5. -- children have the FLOATING attribute set to YES, but children must use
  6. -- CX and CY attributes instead of the POSITION attribute.
  7. inherit
  8. IUP_CONTAINER
  9. IUP_WIDGET_EXPAND
  10. IUP_WIDGET_SIZE
  11. IUP_WIDGET_RASTERSIZE
  12. IUP_WIDGET_USERSIZE
  13. IUP_WIDGET_WID
  14. IUP_WIDGET_FONT
  15. IUP_WIDGET_CLIENTSIZE
  16. IUP_WIDGET_CLIENTOFFSET
  17. IUP_WIDGET_POSITION
  18. IUP_WIDGET_MAXMIN_SIZE
  19. IUP_WIDGET_CHILD
  20. IUP_WIDGET_NAME
  21. IUP_WIDGET_CUSTOM_ATTRIBUTES
  22. create {ANY}
  23. cbox_empty,
  24. cbox
  25. feature {ANY}
  26. cbox_empty
  27. -- Create an empty cbox
  28. local
  29. p, a_cbox: POINTER
  30. do
  31. a_cbox := int_cbox_empty (p)
  32. set_widget(a_cbox)
  33. end
  34. cbox (col: ARRAY[IUP_WIDGET])
  35. -- Create a new cbox containing the list of widgets
  36. local
  37. iterator: ITERATOR[IUP_WIDGET]; i: INTEGER; arg: NATIVE_ARRAY[POINTER]; s: IUP_WIDGET; a_cbox: POINTER
  38. do
  39. i := col.count
  40. arg := arg.calloc(i)
  41. iterator := col.new_iterator
  42. i := 0
  43. from
  44. iterator.start
  45. until
  46. iterator.is_off
  47. loop
  48. s := iterator.item
  49. arg.put(s.widget, i)
  50. iterator.next
  51. i := i + 1
  52. end
  53. a_cbox := int_cbox (arg.to_external)
  54. set_widget(a_cbox)
  55. end
  56. feature {}
  57. -- Internals
  58. int_cbox_empty (arguments: POINTER): POINTER
  59. external "plug_in"
  60. alias "{
  61. location: "${sys}/plugins"
  62. module_name: "iup"
  63. feature_name: "IupCbox"
  64. }"
  65. end
  66. int_cbox (arguments: POINTER): POINTER
  67. external "plug_in"
  68. alias "{
  69. location: "${sys}/plugins"
  70. module_name: "iup"
  71. feature_name: "IupCboxv"
  72. }"
  73. end
  74. end -- class IUP_CBOX
  75. -- The MIT License (MIT)
  76. -- Copyright (c) 2016, 2017 by German A. Arias
  77. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  78. -- of this software and associated documentation files (the "Software"), to deal
  79. -- in the Software without restriction, including without limitation the rights
  80. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  81. -- copies of the Software, and to permit persons to whom the Software is
  82. -- furnished to do so, subject to the following conditions:
  83. --
  84. -- The above copyright notice and this permission notice shall be included in
  85. -- all copies or substantial portions of the Software.
  86. --
  87. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  88. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  89. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  90. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  91. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  92. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  93. -- SOFTWARE.