iup_widget_toggle.e 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. deferred class IUP_WIDGET_TOGGLE
  2. -- Commands to handle the attributes related with toggle operations.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. set_on
  7. -- Like set_value with ON
  8. do
  9. iup_open.set_attribute(Current, "VALUE", "ON")
  10. end
  11. set_off
  12. -- Like set_value with OFF
  13. do
  14. iup_open.set_attribute(Current, "VALUE", "OFF")
  15. end
  16. set_undefined
  17. -- Like set_value with NOTDEF
  18. do
  19. iup_open.set_attribute(Current, "VALUE", "NOTDEF")
  20. end
  21. is_on: BOOLEAN
  22. local
  23. str: STRING
  24. do
  25. str := iup_open.get_attribute(Current, "VALUE")
  26. if str.is_equal("ON") then
  27. Result := True
  28. else
  29. Result := False
  30. end
  31. end
  32. is_off: BOOLEAN
  33. local
  34. str: STRING
  35. do
  36. str := iup_open.get_attribute(Current, "VALUE")
  37. if str.is_equal("OFF") then
  38. Result := True
  39. else
  40. Result := False
  41. end
  42. end
  43. is_undefined: BOOLEAN
  44. local
  45. str: STRING
  46. do
  47. str := iup_open.get_attribute(Current, "VALUE")
  48. if str.is_equal("NOTDEF") then
  49. Result := True
  50. else
  51. Result := False
  52. end
  53. end
  54. end
  55. -- The MIT License (MIT)
  56. -- Copyright (c) 2019 by German A. Arias
  57. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  58. -- of this software and associated documentation files (the "Software"), to deal
  59. -- in the Software without restriction, including without limitation the rights
  60. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  61. -- copies of the Software, and to permit persons to whom the Software is
  62. -- furnished to do so, subject to the following conditions:
  63. --
  64. -- The above copyright notice and this permission notice shall be included in
  65. -- all copies or substantial portions of the Software.
  66. --
  67. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  68. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  69. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  70. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  71. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  72. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  73. -- SOFTWARE.