iup_widget_position.e 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. deferred class IUP_WIDGET_POSITION
  2. -- Commands to handle the attributes related with position.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. set_position (x: INTEGER; y: INTEGER)
  7. -- The position of the element relative to the origin of the
  8. -- Client area of the native parent. If you add the CLIENTOFFSET
  9. -- attribute of the native parent, you can obtain the
  10. -- coordinates relative to the Window area of the native parent. See
  11. -- the Layout Guide.
  12. -- It will be changed during the layout computation, except when
  13. -- FLOATING=YES or when used inside a concrete layout container.
  14. require
  15. non_negative: x >= 0
  16. y >= 0
  17. local
  18. size: STRING
  19. do
  20. size := x.out
  21. size.append_string(",")
  22. size.append_string(y.out)
  23. iup_open.set_attribute(Current, "POSITION", size)
  24. end
  25. get_position: TUPLE[INTEGER, INTEGER]
  26. -- Returns the position of the element relative to the origin of
  27. -- the Client area of the native parent. If you add the
  28. -- CLIENTOFFSET attribute of the native parent, you can obtain
  29. -- the coordinates relative to the Window area of the native parent.
  30. local
  31. position: STRING
  32. do
  33. position := iup_open.get_attribute(Current, "POSITION")
  34. Result := components_of_position(position)
  35. end
  36. end
  37. -- The MIT License (MIT)
  38. -- Copyright (c) 2016, 2019 by German A. Arias
  39. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  40. -- of this software and associated documentation files (the "Software"), to deal
  41. -- in the Software without restriction, including without limitation the rights
  42. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43. -- copies of the Software, and to permit persons to whom the Software is
  44. -- furnished to do so, subject to the following conditions:
  45. --
  46. -- The above copyright notice and this permission notice shall be included in
  47. -- all copies or substantial portions of the Software.
  48. --
  49. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  54. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  55. -- SOFTWARE.