mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 16:55:55 +02:00
IDEIntf: started TDesignerMediator
git-svn-id: trunk@21601 -
This commit is contained in:
parent
a1f53fabc8
commit
2291788a7c
@ -124,6 +124,7 @@ each control that's dropped onto the form
|
|||||||
FDefineProperties: TAVLTree;// tree of TDefinePropertiesCacheItem
|
FDefineProperties: TAVLTree;// tree of TDefinePropertiesCacheItem
|
||||||
FStandardDefinePropertiesRegistered: Boolean;
|
FStandardDefinePropertiesRegistered: Boolean;
|
||||||
FDesignerBaseClasses: TFPList; // list of TComponentClass
|
FDesignerBaseClasses: TFPList; // list of TComponentClass
|
||||||
|
FDesignerMediatorClasses: TFPList;// list of TDesignerMediatorClass
|
||||||
function GetPropertyEditorHook: TPropertyEditorHook;
|
function GetPropertyEditorHook: TPropertyEditorHook;
|
||||||
function FindDefinePropertyNode(const APersistentClassName: string
|
function FindDefinePropertyNode(const APersistentClassName: string
|
||||||
): TAVLTreeNode;
|
): TAVLTreeNode;
|
||||||
@ -217,6 +218,12 @@ each control that's dropped onto the form
|
|||||||
function GetCurrentDesigner: TIDesigner; override;
|
function GetCurrentDesigner: TIDesigner; override;
|
||||||
function GetDesignerByComponent(AComponent: TComponent): TIDesigner; override;
|
function GetDesignerByComponent(AComponent: TComponent): TIDesigner; override;
|
||||||
|
|
||||||
|
// designer mediators
|
||||||
|
function GetDesignerMediators(Index: integer): TDesignerMediatorClass; override;
|
||||||
|
procedure RegisterDesignerMediator(MediatorClass: TDesignerMediatorClass); override;
|
||||||
|
procedure UnregisterDesignerMediator(MediatorClass: TDesignerMediatorClass); override;
|
||||||
|
function DesignerMediatorCount: integer; override;
|
||||||
|
|
||||||
// component editors
|
// component editors
|
||||||
function GetComponentEditor(AComponent: TComponent): TBaseComponentEditor;
|
function GetComponentEditor(AComponent: TComponent): TBaseComponentEditor;
|
||||||
|
|
||||||
@ -864,6 +871,7 @@ begin
|
|||||||
FNonFormForms := TAVLTree.Create(@CompareNonFormDesignerForms);
|
FNonFormForms := TAVLTree.Create(@CompareNonFormDesignerForms);
|
||||||
FSelection := TPersistentSelectionList.Create;
|
FSelection := TPersistentSelectionList.Create;
|
||||||
FDesignerBaseClasses:=TFPList.Create;
|
FDesignerBaseClasses:=TFPList.Create;
|
||||||
|
FDesignerMediatorClasses:=TFPList.Create;
|
||||||
for l:=Low(StandardDesignerBaseClasses) to High(StandardDesignerBaseClasses) do
|
for l:=Low(StandardDesignerBaseClasses) to High(StandardDesignerBaseClasses) do
|
||||||
FDesignerBaseClasses.Add(StandardDesignerBaseClasses[l]);
|
FDesignerBaseClasses.Add(StandardDesignerBaseClasses[l]);
|
||||||
|
|
||||||
@ -888,6 +896,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
FreeAndNil(JITFormList);
|
FreeAndNil(JITFormList);
|
||||||
FreeAndNil(JITNonFormList);
|
FreeAndNil(JITNonFormList);
|
||||||
|
FreeAndNil(FDesignerMediatorClasses);
|
||||||
FreeAndNil(FDesignerBaseClasses);
|
FreeAndNil(FDesignerBaseClasses);
|
||||||
FreeAndNil(FComponentInterfaces);
|
FreeAndNil(FComponentInterfaces);
|
||||||
FreeAndNil(FSelection);
|
FreeAndNil(FSelection);
|
||||||
@ -1496,6 +1505,29 @@ begin
|
|||||||
Result:=AForm.Designer;
|
Result:=AForm.Designer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomFormEditor.GetDesignerMediators(Index: integer
|
||||||
|
): TDesignerMediatorClass;
|
||||||
|
begin
|
||||||
|
Result:=TDesignerMediatorClass(FDesignerMediatorClasses[Index]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomFormEditor.RegisterDesignerMediator(
|
||||||
|
MediatorClass: TDesignerMediatorClass);
|
||||||
|
begin
|
||||||
|
FDesignerMediatorClasses.Add(MediatorClass);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomFormEditor.UnregisterDesignerMediator(
|
||||||
|
MediatorClass: TDesignerMediatorClass);
|
||||||
|
begin
|
||||||
|
FDesignerMediatorClasses.Remove(MediatorClass);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomFormEditor.DesignerMediatorCount: integer;
|
||||||
|
begin
|
||||||
|
Result:=FDesignerMediatorClasses.Count;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomFormEditor.GetComponentEditor(AComponent: TComponent
|
function TCustomFormEditor.GetComponentEditor(AComponent: TComponent
|
||||||
): TBaseComponentEditor;
|
): TBaseComponentEditor;
|
||||||
var
|
var
|
||||||
|
@ -85,6 +85,17 @@ type
|
|||||||
X,Y,W,H : Integer): TIComponentInterface; virtual; abstract;
|
X,Y,W,H : Integer): TIComponentInterface; virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TDesignerMediator
|
||||||
|
To edit designer forms which do not use the LCL register a TDesignerMediator,
|
||||||
|
which will emulate the painting and handle the mouse. }
|
||||||
|
|
||||||
|
TDesignerMediator = class
|
||||||
|
public
|
||||||
|
class function FormClass: TComponentClass; virtual; abstract;
|
||||||
|
class function CreateMediator(Form: TComponent): TDesignerMediator; virtual; abstract;
|
||||||
|
end;
|
||||||
|
TDesignerMediatorClass = TDesignerMediator;
|
||||||
|
|
||||||
|
|
||||||
{ TAbstractFormEditor }
|
{ TAbstractFormEditor }
|
||||||
|
|
||||||
@ -92,6 +103,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function GetDesignerBaseClasses(Index: integer): TComponentClass; virtual; abstract;
|
function GetDesignerBaseClasses(Index: integer): TComponentClass; virtual; abstract;
|
||||||
function GetDesigner(Index: integer): TIDesigner; virtual; abstract;
|
function GetDesigner(Index: integer): TIDesigner; virtual; abstract;
|
||||||
|
function GetDesignerMediators(Index: integer): TDesignerMediatorClass; virtual; abstract;
|
||||||
public
|
public
|
||||||
// components
|
// components
|
||||||
function FindComponentByName(const Name: ShortString
|
function FindComponentByName(const Name: ShortString
|
||||||
@ -149,6 +161,12 @@ type
|
|||||||
function CutSelectionToClipboard: Boolean; virtual; abstract;
|
function CutSelectionToClipboard: Boolean; virtual; abstract;
|
||||||
function PasteSelectionFromClipboard(Flags: TComponentPasteSelectionFlags
|
function PasteSelectionFromClipboard(Flags: TComponentPasteSelectionFlags
|
||||||
): Boolean; virtual; abstract;
|
): Boolean; virtual; abstract;
|
||||||
|
|
||||||
|
// mediators for non LCL forms
|
||||||
|
procedure RegisterDesignerMediator(MediatorClass: TDesignerMediatorClass); virtual; abstract;
|
||||||
|
procedure UnregisterDesignerMediator(MediatorClass: TDesignerMediatorClass); virtual; abstract;
|
||||||
|
function DesignerMediatorCount: integer; virtual; abstract;
|
||||||
|
property DesignerMediators[Index: integer]: TDesignerMediatorClass read GetDesignerMediators;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
Loading…
Reference in New Issue
Block a user