iup_container.e 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. deferred class IUP_CONTAINER
  2. inherit
  3. IUP_WIDGET
  4. IUP_WIDGET_VISIBLE
  5. feature {ANY}
  6. -- Commands to handle heirarchy
  7. append (new_child: IUP_WIDGET): detachable IUP_WIDGET
  8. -- Inserts an interface element at the end of the container, after
  9. -- the last element of the container. Valid for any element that
  10. -- contains other elements like dialog, frame, hbox, vbox, zbox or menu.
  11. -- Returns: the actual parent if the interface element was
  12. -- successfully inserted. Otherwise returns Void.
  13. do
  14. Result := iup_open.iup_append(Current, new_child)
  15. end
  16. insert (ref_child: IUP_WIDGET; new_child: IUP_WIDGET): detachable IUP_WIDGET
  17. -- Inserts an interface element before another child of the
  18. -- container. Valid for any element that contains other elements
  19. -- like dialog, frame, hbox, vbox, zbox, menu, etc.
  20. -- Returns: the actual parent if the interface element was
  21. -- successfully inserted. Otherwise returns NULL
  22. do
  23. Result := iup_open.iup_insert(Current, ref_child, new_child)
  24. end
  25. get_child (pos: INTEGER): detachable IUP_WIDGET
  26. -- Returns the a child of the control given its position.
  27. -- Returns: the child or Void if there is none.
  28. do
  29. Result := iup_open.iup_get_child(Current, pos)
  30. end
  31. get_child_pos (child: IUP_WIDGET): INTEGER
  32. -- Returns the position of a child of the given control.
  33. -- Returns: the position of the desire child starting at 0, or -1
  34. -- if child not found.
  35. do
  36. Result := iup_open.iup_get_child_pos(Current, child)
  37. end
  38. get_child_count: INTEGER
  39. -- Returns the number of children of the given control.
  40. do
  41. Result := iup_open.iup_get_child_count(Current)
  42. end
  43. get_next_child (child: IUP_WIDGET): detachable IUP_WIDGET
  44. -- Returns the a child of the given control given its brother.
  45. -- Returns: the child or Void.
  46. do
  47. Result := iup_open.iup_get_next_child(Current, child)
  48. end
  49. refresh_children
  50. -- Updates the size and layout of controls after changing size
  51. -- attributes, or attributes that affect the size of the control. Can
  52. -- be used for any element inside a dialog, only its children will
  53. -- be updated. It can change the layout of all the controls inside
  54. -- the given element because of the dynamic layout positioning.
  55. do
  56. iup_open.iup_refresh_children(Current)
  57. end
  58. update_children
  59. -- Mark the element children to be redraw when the control returns
  60. -- to the system.
  61. do
  62. iup_open.iup_update_children(Current)
  63. end
  64. redraw_with_children
  65. -- Force the element and its children to be redrawn immediately.
  66. do
  67. iup_open.iup_redraw(Current, 1)
  68. end
  69. end
  70. -- The MIT License (MIT)
  71. -- Copyright (c) 2016, 2018 by German A. Arias
  72. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  73. -- of this software and associated documentation files (the "Software"), to deal
  74. -- in the Software without restriction, including without limitation the rights
  75. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  76. -- copies of the Software, and to permit persons to whom the Software is
  77. -- furnished to do so, subject to the following conditions:
  78. --
  79. -- The above copyright notice and this permission notice shall be included in
  80. -- all copies or substantial portions of the Software.
  81. --
  82. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  83. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  84. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  85. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  86. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  87. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  88. -- SOFTWARE.