iup_widget_decoration.e 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. deferred class IUP_WIDGET_DECORATION
  2. -- Commands to handle decoration.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. set_decoration (state: BOOLEAN)
  7. -- (non inheritable): Enable a decoration area around the child. Default
  8. -- False. (since 3.20).
  9. do
  10. iup_open.set_attribute(Current, "DECORATION", boolean_to_yesno(state))
  11. end
  12. has_decoration: BOOLEAN
  13. local
  14. str: STRING
  15. do
  16. str := iup_open.get_attribute(Current, "DECORATION")
  17. Result := yesno_to_boolean(str)
  18. end
  19. set_decoration_size (width, height: INTEGER)
  20. -- (non inheritable): total size of the decoration. Used only when
  21. -- DECORATION=True. (since 3.20)
  22. require
  23. non_negative: width >= 0
  24. height >= 0
  25. local
  26. size: STRING
  27. do
  28. size := width.out
  29. size.append_string("x")
  30. size.append_string(height.out)
  31. iup_open.set_attribute(Current, "DECORSIZE", size)
  32. end
  33. get_decoration_size: TUPLE[INTEGER, INTEGER]
  34. local
  35. str: STRING
  36. do
  37. str := iup_open.get_attribute(Current, "DECORSIZE")
  38. Result := components_of(str, 'x')
  39. end
  40. set_decoration_offset (left, top: INTEGER)
  41. -- (non inheritable): decoration offset from left border and top border.
  42. -- Used only when DECORATION=True. (since 3.20)
  43. require
  44. non_negative: left >= 0
  45. top >= 0
  46. local
  47. size: STRING
  48. do
  49. size := left.out
  50. size.append_string("x")
  51. size.append_string(top.out)
  52. iup_open.set_attribute(Current, "DECOROFFSET", size)
  53. end
  54. get_decoration_offset: TUPLE[INTEGER, INTEGER]
  55. local
  56. str: STRING
  57. do
  58. str := iup_open.get_attribute(Current, "DECOROFFSET")
  59. Result := components_of(str, 'x')
  60. end
  61. end
  62. -- The MIT License (MIT)
  63. -- Copyright (c) 2016, 2017, 2019 by German A. Arias
  64. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  65. -- of this software and associated documentation files (the "Software"), to deal
  66. -- in the Software without restriction, including without limitation the rights
  67. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68. -- copies of the Software, and to permit persons to whom the Software is
  69. -- furnished to do so, subject to the following conditions:
  70. --
  71. -- The above copyright notice and this permission notice shall be included in
  72. -- all copies or substantial portions of the Software.
  73. --
  74. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  75. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  76. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  77. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  78. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  79. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  80. -- SOFTWARE.