iup_widget_expand.e 2.5 KB

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