iup_widget_expand.e 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. deferred class IUP_WIDGET_EXPAND
  2. -- Commands to handle the attributes related with expand.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. insert
  6. IUP_INTERFACE
  7. feature {ANY}
  8. set_expand (type: STRING)
  9. -- Allows the element to expand, fulfilling empty spaces inside its
  10. -- container. For a container, the actual EXPAND value will be always
  11. -- a combination of its own value and the value of its children. In
  12. -- the sense that a container can only expand if its children can
  13. -- expand too in the same direction.
  14. -- Values: "YES" (both directions), "HORIZONTAL", "VERTICAL",
  15. -- "HORIZONTALFREE", "VERTICALFREE" or "NO".
  16. -- Default: "NO". For containers the default is "YES."
  17. require
  18. valid_expand: is_valid_expand(type)
  19. do
  20. iup_open.set_attribute(Current, "EXPAND", type)
  21. end
  22. get_expand: STRING
  23. -- Return the expanded type of the element.
  24. do
  25. Result := iup_open.get_attribute(Current, "EXPAND")
  26. end
  27. set_expand_both_directions
  28. do
  29. iup_open.set_attribute(Current, "EXPAND", "YES")
  30. end
  31. set_expand_horizontal
  32. do
  33. iup_open.set_attribute(Current, "EXPAND", "HORIZONTAL")
  34. end
  35. set_expand_vertical
  36. do
  37. iup_open.set_attribute(Current, "EXPAND", "VERTICAL")
  38. end
  39. set_expand_horizontal_free
  40. do
  41. iup_open.set_attribute(Current, "EXPAND", "HORIZONTALFREE")
  42. end
  43. set_expand_vertical_free
  44. do
  45. iup_open.set_attribute(Current, "EXPAND", "VERTICALFREE")
  46. end
  47. set_expand_no
  48. do
  49. iup_open.set_attribute(Current, "EXPAND", "NO")
  50. end
  51. end
  52. -- The MIT License (MIT)
  53. -- Copyright (c) 2016 by German A. Arias
  54. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  55. -- of this software and associated documentation files (the "Software"), to deal
  56. -- in the Software without restriction, including without limitation the rights
  57. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58. -- copies of the Software, and to permit persons to whom the Software is
  59. -- furnished to do so, subject to the following conditions:
  60. --
  61. -- The above copyright notice and this permission notice shall be included in
  62. -- all copies or substantial portions of the Software.
  63. --
  64. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  65. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  66. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  67. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  68. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  69. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  70. -- SOFTWARE.