cd_iup.e 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. class CD_IUP
  2. inherit
  3. CANVAS_DRAW
  4. CD_CANVAS_SIMULATE
  5. CD_CANVAS_INITIALIZATION
  6. CD_CANVAS_CONTROL
  7. CD_CANVAS_COORDINATE_SYSTEM
  8. CD_CANVAS_WORLD_COORDINATES
  9. CD_CANVAS_GENERAL_ATTRIBUTES
  10. CD_CLIPPING
  11. CD_PRIMITIVES_MARKS
  12. CD_LINES
  13. CD_POLYGONS_BEZIER_REGIONS
  14. CD_COMPLEX_CLIPPING_REGIONS
  15. CD_FILLED_AREAS
  16. CD_TEXT
  17. CD_VECTOR_TEXT
  18. CD_CLIENT_IMAGES
  19. create {IUP_CANVAS}
  20. create_with_front_cd_canvas
  21. create {IUP_CONTROLS}
  22. create_with_cd_canvas
  23. create {IUP_CANVAS, IUP_CONTROLS}
  24. create_default
  25. create {ANY}
  26. create_with_canvas,
  27. create_double_buffer_with_canvas,
  28. create_double_buffer_rgb_with_canvas
  29. feature {IUP_CANVAS}
  30. create_with_front_cd_canvas (p: POINTER)
  31. do
  32. cnvs := p
  33. end
  34. feature {IUP_CONTROLS}
  35. create_with_cd_canvas (wgt: IUP_CANVAS; p: POINTER)
  36. do
  37. cnvs := p
  38. wgt.set_cd_canvas(Current)
  39. initialize_modes
  40. initialize_colors
  41. end
  42. feature {IUP_CANVAS, IUP_CONTROLS}
  43. create_default
  44. do
  45. end
  46. feature {ANY}
  47. create_with_canvas (wgt: IUP_CANVAS)
  48. do
  49. cnvs := int_create_canvas(int_cd_context_iup, wgt.widget)
  50. wgt.set_cd_canvas(Current)
  51. initialize_modes
  52. initialize_colors
  53. end
  54. create_double_buffer_with_canvas (wgt: IUP_CANVAS)
  55. do
  56. cnvs := int_create_canvas(int_cd_context_iup_double_buffer, wgt.widget)
  57. wgt.set_back_and_front_cd_canvas(Current)
  58. initialize_modes
  59. initialize_colors
  60. end
  61. create_double_buffer_rgb_with_canvas (wgt: IUP_CANVAS)
  62. do
  63. cnvs := int_create_canvas(int_cd_context_iup_double_buffer_rgb,
  64. wgt.widget)
  65. wgt.set_back_and_front_cd_canvas(Current)
  66. initialize_modes
  67. initialize_colors
  68. end
  69. feature {NONE}
  70. -- Internals
  71. int_create_canvas (context, data: POINTER): POINTER
  72. external
  73. "C inline use %"eiffel-iup.h%""
  74. alias
  75. "return cdCreateCanvas ($context, $data);"
  76. end
  77. int_cd_context_iup: POINTER
  78. external
  79. "C inline use %"eiffel-iup.h%""
  80. alias
  81. "return cdContextIup();"
  82. end
  83. int_cd_context_iup_double_buffer: POINTER
  84. external
  85. "C inline use %"eiffel-iup.h%""
  86. alias
  87. "return cdContextIupDBuffer();"
  88. end
  89. int_cd_context_iup_double_buffer_rgb: POINTER
  90. external
  91. "C inline use %"eiffel-iup.h%""
  92. alias
  93. "return cdContextIupDBufferRGB();"
  94. end
  95. end
  96. -- The MIT License (MIT)
  97. -- Copyright (c) 2016, 2017, 2019 by German A. Arias
  98. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  99. -- of this software and associated documentation files (the "Software"), to deal
  100. -- in the Software without restriction, including without limitation the rights
  101. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  102. -- copies of the Software, and to permit persons to whom the Software is
  103. -- furnished to do so, subject to the following conditions:
  104. --
  105. -- The above copyright notice and this permission notice shall be included in
  106. -- all copies or substantial portions of the Software.
  107. --
  108. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  109. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  110. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  111. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  112. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  113. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  114. -- SOFTWARE.