iup_widget_press.e 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. deferred class IUP_WIDGET_PRESS
  2. -- Commands to handle the additional features to press state in flat
  3. -- controls.
  4. inherit
  5. IUP_WIDGET_INTERNALS
  6. insert
  7. IUP_INTERFACE
  8. feature {ANY}
  9. set_rgb_press_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  10. -- color used to indicate a press state. Default: "150 200 235".
  11. do
  12. iup_open.set_attribute(Current, "PSCOLOR", rgb_to_string(red, green, blue))
  13. end
  14. reset_press_color
  15. -- BGCOLOR will be used.
  16. do
  17. iup_open.set_attribute_null(Current, "PSCOLOR")
  18. end
  19. set_rgb_text_press_color (red: INTEGER; green: INTEGER; blue: INTEGER)
  20. -- text color used to indicate a press state. If not defined FGCOLOR will
  21. -- be used instead.
  22. do
  23. iup_open.set_attribute(Current, "TEXTPSCOLOR", rgb_to_string(red, green, blue))
  24. end
  25. is_pressed: BOOLEAN
  26. -- Returns the button state if pressed.
  27. local
  28. str: STRING
  29. do
  30. str := iup_open.get_attribute(Current, "PRESSED")
  31. Result := yesno_to_boolean(str)
  32. end
  33. end
  34. -- The MIT License (MIT)
  35. -- Copyright (c) 2019 by German A. Arias
  36. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  37. -- of this software and associated documentation files (the "Software"), to deal
  38. -- in the Software without restriction, including without limitation the rights
  39. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40. -- copies of the Software, and to permit persons to whom the Software is
  41. -- furnished to do so, subject to the following conditions:
  42. --
  43. -- The above copyright notice and this permission notice shall be included in
  44. -- all copies or substantial portions of the Software.
  45. --
  46. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52. -- SOFTWARE.