iup_widget_image_position.e 1.8 KB

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