iup_widget_image_1.e 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. deferred class IUP_WIDGET_IMAGE_1
  2. -- Command to handle the additional features to images in flat controls.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. set_image (name: STRING)
  7. -- (non inheritable): image name.
  8. do
  9. iup_open.set_attribute(Current, "IMAGE", name)
  10. end
  11. set_image_inactive (name: STRING)
  12. -- (non inheritable): Image name of the element when inactive. If it is
  13. -- not defined then the IMAGE is used and its colors will be replaced by
  14. -- a modified version creating the disabled effect.
  15. do
  16. iup_open.set_attribute(Current, "IMAGEINACTIVE", name)
  17. end
  18. set_image_position (pos: STRING)
  19. -- (non inheritable): Position of the image relative to the text when
  20. -- both are displayed. Can be: LEFT, RIGHT, TOP, BOTTOM. Default: LEFT.
  21. require
  22. is_valid_position(pos)
  23. do
  24. iup_open.set_attribute(Current, "IMAGEPOSITION", pos)
  25. end
  26. -- Validations
  27. is_valid_position (value: STRING): BOOLEAN
  28. do
  29. if value.is_equal("LEFT") or
  30. value.is_equal("RIGHT") or
  31. value.is_equal("TOP") or
  32. value.is_equal("BOTTOM") then
  33. Result := True
  34. else
  35. Result := False
  36. end
  37. end
  38. end
  39. -- The MIT License (MIT)
  40. -- Copyright (c) 2018, 2019 by German A. Arias
  41. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  42. -- of this software and associated documentation files (the "Software"), to deal
  43. -- in the Software without restriction, including without limitation the rights
  44. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45. -- copies of the Software, and to permit persons to whom the Software is
  46. -- furnished to do so, subject to the following conditions:
  47. --
  48. -- The above copyright notice and this permission notice shall be included in
  49. -- all copies or substantial portions of the Software.
  50. --
  51. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  54. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  55. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  56. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  57. -- SOFTWARE.