cd_canvas_initialization.e 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 {}
  42. -- Internals
  43. int_kill_canvas (data: POINTER)
  44. external "plug_in"
  45. alias "{
  46. location: "${sys}/plugins"
  47. module_name: "iup"
  48. feature_name: "cdKillCanvas"
  49. }"
  50. end
  51. int_canvas_activate (data: POINTER): INTEGER
  52. external "plug_in"
  53. alias "{
  54. location: "${sys}/plugins"
  55. module_name: "iup"
  56. feature_name: "cdCanvasActivate"
  57. }"
  58. end
  59. int_canvas_deactivate (data: POINTER)
  60. external "plug_in"
  61. alias "{
  62. location: "${sys}/plugins"
  63. module_name: "iup"
  64. feature_name: "cdCanvasDeactivate"
  65. }"
  66. end
  67. end
  68. -- The MIT License (MIT)
  69. -- Copyright (c) 2016 by German A. Arias
  70. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  71. -- of this software and associated documentation files (the "Software"), to deal
  72. -- in the Software without restriction, including without limitation the rights
  73. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  74. -- copies of the Software, and to permit persons to whom the Software is
  75. -- furnished to do so, subject to the following conditions:
  76. --
  77. -- The above copyright notice and this permission notice shall be included in
  78. -- all copies or substantial portions of the Software.
  79. --
  80. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  81. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  82. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  83. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  84. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  85. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  86. -- SOFTWARE.