iup_widget_text_pos.e 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. deferred class IUP_WIDGET_TEXT_POS
  2. -- Commands to convert position in lin-col and viceversa.
  3. inherit
  4. IUP_WIDGET_INTERNALS
  5. feature {ANY}
  6. text_convert_lin_col_to_pos (line, column: INTEGER): INTEGER
  7. -- Converts a (lin, col) character positioning into an absolute position.
  8. -- lin and col starts at 1, pos starts at 0.
  9. local
  10. p: INTEGER
  11. do
  12. int_text_convert_lin_col_to_pos(widget, line, column, $p)
  13. Result := p
  14. end
  15. text_convert_pos_to_lin_col (position: INTEGER): TUPLE[INTEGER, INTEGER]
  16. -- Converts an absolute position into a (lin, col) character positioning.
  17. -- lin and col starts at 1, pos starts at 0.
  18. local
  19. l, c: INTEGER
  20. do
  21. int_text_convert_pos_to_lin_col(widget, position, $l, $c)
  22. Result := [l, c]
  23. end
  24. feature {NONE}
  25. -- Internals
  26. int_text_convert_lin_col_to_pos (wdt: POINTER; lin, col: INTEGER; pos: POINTER)
  27. external
  28. "C inline use %"eiffel-iup.h%""
  29. alias
  30. "IupTextConvertLinColToPos ($wdt, $lin, $col, $pos);"
  31. end
  32. int_text_convert_pos_to_lin_col (wdt: POINTER; pos: INTEGER; lin, col: POINTER)
  33. external
  34. "C inline use %"eiffel-iup.h%""
  35. alias
  36. "IupTextConvertPosToLinCol ($wdt, $pos, $lin, $col);"
  37. end
  38. end
  39. -- The MIT License (MIT)
  40. -- Copyright (c) 2017, 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.