iup_widget_decoration.e 2.8 KB

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