iup_widget_usersize.e 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. deferred class IUP_WIDGET_USERSIZE
  2. -- Commands to handle the attributes related with user size.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. insert
  6. IUP_INTERFACE
  7. feature {ANY}
  8. set_user_size (width: INTEGER; height: INTEGER)
  9. -- Specifies the element User size in pixels.
  10. --
  11. -- You can also set only one of the parameters by setting the other value
  12. -- to 0.
  13. require
  14. non_negative: width >= 0
  15. height >= 0
  16. local
  17. size: STRING
  18. do
  19. size := width.to_string
  20. size.append_string("x")
  21. size.append_string(height.to_string)
  22. iup_open.set_attribute(Current, "USERSIZE", size)
  23. end
  24. get_user_size: TUPLE[INTEGER, INTEGER]
  25. -- Returns the User size, in pixels.
  26. local
  27. size: STRING
  28. do
  29. size := iup_open.get_attribute(Current, "USERSIZE")
  30. Result := components_of_size(size)
  31. end
  32. end
  33. -- The MIT License (MIT)
  34. -- Copyright (c) 2017 by German A. Arias
  35. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  36. -- of this software and associated documentation files (the "Software"), to deal
  37. -- in the Software without restriction, including without limitation the rights
  38. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39. -- copies of the Software, and to permit persons to whom the Software is
  40. -- furnished to do so, subject to the following conditions:
  41. --
  42. -- The above copyright notice and this permission notice shall be included in
  43. -- all copies or substantial portions of the Software.
  44. --
  45. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51. -- SOFTWARE.