| 1 |
{ |
| 2 |
Copyright 2022-2022 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Base classes to access Castle Game Engine editor functionality from custom components. |
| 17 |
|
| 18 |
Right now just TCastleComponentEditorDesigner, |
| 19 |
our descendant of TComponentEditorDesigner that you can access using GetDesigner |
| 20 |
in classes that descend from TComponentEditor. |
| 21 |
It exposes to CGE-specific functionality to custom components. |
| 22 |
|
| 23 |
See https://castle-engine.io/custom_components#_add_verbs_to_the_context_menu_for_given_component |
| 24 |
about component editors. |
| 25 |
} |
| 26 |
unit CastleEditorAccess; |
| 27 |
|
| 28 |
{$I castleconf.inc} |
| 29 |
|
| 30 |
interface |
| 31 |
|
| 32 |
uses Classes, |
| 33 |
ComponentEditors; |
| 34 |
|
| 35 |
type |
| 36 |
{ Access instance of this from TComponentEditor descendants, using GetDesigner. |
| 37 |
This class allows to act on CGE editor from within a specific component editor. } |
| 38 |
TCastleComponentEditorDesigner = class(TComponentEditorDesigner) |
| 39 |
public |
| 40 |
{ Component editor can use this to propose opening a new design. |
| 41 |
For example TCastleTransformDesign can propose to open design |
| 42 |
in TCastleTransformDesign.URL. } |
| 43 |
procedure ProposeOpenDesign(const DesignUrl: String); virtual; abstract; |
| 44 |
|
| 45 |
{ Free component C (which should be part of this designed, owned by DesignOwner) |
| 46 |
and all children. |
| 47 |
|
| 48 |
We have to delete things recursively, otherwise they would keep existing, |
| 49 |
taking resources and reserving names in DesignOwner, |
| 50 |
even though they would not be visible when disconnected from parent |
| 51 |
hierarchy. |
| 52 |
|
| 53 |
This does nothing if you try to free some internal component |
| 54 |
(like csTransient) or the design root (which can never be freed). } |
| 55 |
procedure FreeComponentRecursively(const C: TComponent); virtual; abstract; |
| 56 |
end; |
| 57 |
|
| 58 |
implementation |
| 59 |
|
| 60 |
end. |