GR32.Paint.Controller.API.pas 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. unit GR32.Paint.Controller.API;
  2. (* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1 or LGPL 2.1 with linking exception
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * Alternatively, the contents of this file may be used under the terms of the
  16. * Free Pascal modified version of the GNU Lesser General Public License
  17. * Version 2.1 (the "FPC modified LGPL License"), in which case the provisions
  18. * of this license are applicable instead of those above.
  19. * Please see the file LICENSE.txt for additional information concerning this
  20. * license.
  21. *
  22. * The Original Code is Paint tools for Graphics32
  23. *
  24. * The Initial Developer of the Original Code is
  25. * Anders Melander, [email protected]
  26. *
  27. * Portions created by the Initial Developer are Copyright (C) 2008-2025
  28. * the Initial Developer. All Rights Reserved.
  29. *
  30. * ***** END LICENSE BLOCK ***** *)
  31. interface
  32. {$INCLUDE GR32.inc}
  33. uses
  34. Controls,
  35. GR32,
  36. GR32.Paint.Tool.API;
  37. //------------------------------------------------------------------------------
  38. //
  39. // IBitmap32PaintController
  40. //
  41. //------------------------------------------------------------------------------
  42. // Manages paint tool selection and tool operation state
  43. //------------------------------------------------------------------------------
  44. type
  45. IBitmap32PaintController = interface
  46. ['{707D785B-8B5B-48C0-8DC8-A3AF168041ED}']
  47. function BeginOperation(const Context: IBitmap32PaintToolContext): boolean;
  48. function ContinueOperation(const Context: IBitmap32PaintToolContext): boolean;
  49. procedure EndOperation(Complete: boolean);
  50. // Mouse events forwarded from the mouse controller.
  51. procedure MouseDown(const Context: IBitmap32PaintToolContext; Button: TMouseButton);
  52. procedure MouseMove(const Context: IBitmap32PaintToolContext);
  53. procedure MouseUp(const Context: IBitmap32PaintToolContext; Button: TMouseButton);
  54. procedure MouseEnter;
  55. procedure MouseExit;
  56. // CreateToolContext creates a new tool context object.
  57. // It is the responsibility of the caller to initialize and maintain the returned object with context values.
  58. // The creation of the actual context object is delegated to the paint host.
  59. function CreateToolContext: IBitmap32PaintToolContext;
  60. function GetPaintTool: IBitmap32PaintTool;
  61. procedure SetPaintTool(const Value: IBitmap32PaintTool);
  62. property PaintTool: IBitmap32PaintTool read GetPaintTool write SetPaintTool;
  63. function GetActivePaintTool: IBitmap32PaintTool;
  64. property ActivePaintTool: IBitmap32PaintTool read GetActivePaintTool;
  65. function GetActivePaintToolContext: IBitmap32PaintToolContext;
  66. property ActivePaintToolContext: IBitmap32PaintToolContext read GetActivePaintToolContext;
  67. end;
  68. //------------------------------------------------------------------------------
  69. //------------------------------------------------------------------------------
  70. //------------------------------------------------------------------------------
  71. implementation
  72. end.