iup_widget_image_1.e 2.3 KB

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