cd_canvas_initialization.e 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. deferred class CD_CANVAS_INITIALIZATION
  2. inherit
  3. CANVAS_DRAW
  4. feature {ANY}
  5. kill_canvas
  6. -- Destroys a previously created canvas.
  7. do
  8. int_kill_canvas(cnvs)
  9. end
  10. activate: BOOLEAN
  11. -- Activates a canvas for drawing. This is used only for a few drivers.
  12. -- Native Window and IUP drivers will update the canvas size if the
  13. -- window size has changed. Double Buffer driver will recreate the image
  14. -- buffer if the window canvas size has changed. In these cases the
  15. -- function MUST be called, for other drivers is useless. Return True
  16. -- or False.
  17. local
  18. state: INTEGER
  19. do
  20. state := int_canvas_activate(cnvs)
  21. if state.is_equal(0) then
  22. Result := True
  23. else
  24. Result := False
  25. end
  26. end
  27. deactivate
  28. -- Called when the application has finished drawing in the canvas. It is
  29. -- optional, but if used for the Native Window driver in Windows when the
  30. -- handle can not be retained, the drawing can only be done again after a
  31. -- "activate". On some drivers will simply call Flush.
  32. do
  33. int_canvas_deactivate(cnvs)
  34. end
  35. -- Skip:
  36. --
  37. -- cdCanvasGetContext
  38. -- cdContextCaps
  39. -- cdContextType
  40. -- cdContextIsPlus
  41. feature {NONE}
  42. -- Internals
  43. int_kill_canvas (data: POINTER)
  44. external
  45. "C inline use %"eiffel-iup.h%""
  46. alias
  47. "cdKillCanvas ($data);"
  48. end
  49. int_canvas_activate (data: POINTER): INTEGER
  50. external
  51. "C inline use %"eiffel-iup.h%""
  52. alias
  53. "return cdCanvasActivate ($data);"
  54. end
  55. int_canvas_deactivate (data: POINTER)
  56. external
  57. "C inline use %"eiffel-iup.h%""
  58. alias
  59. "cdCanvasDeactivate ($data);"
  60. end
  61. end
  62. -- The MIT License (MIT)
  63. -- Copyright (c) 2016, 2019 by German A. Arias
  64. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  65. -- of this software and associated documentation files (the "Software"), to deal
  66. -- in the Software without restriction, including without limitation the rights
  67. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  68. -- copies of the Software, and to permit persons to whom the Software is
  69. -- furnished to do so, subject to the following conditions:
  70. --
  71. -- The above copyright notice and this permission notice shall be included in
  72. -- all copies or substantial portions of the Software.
  73. --
  74. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  75. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  76. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  77. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  78. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  79. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  80. -- SOFTWARE.