IDEIntf: designer mediator: LCLForm and Designer

git-svn-id: trunk@21624 -
This commit is contained in:
mattias 2009-09-08 15:26:39 +00:00
parent dca985f3e8
commit 4e4340b68b
3 changed files with 36 additions and 1 deletions

View File

@ -2507,7 +2507,9 @@ end;
procedure TDesigner.SetMediator(const AValue: TDesignerMediator);
begin
if FMediator=AValue then exit;
if FMediator<>nil then FMediator.Designer:=nil;
FMediator:=AValue;
if FMediator<>nil then FMediator.Designer:=Self;
end;
procedure TDesigner.SetShowEditorHints(const AValue: boolean);

View File

@ -43,6 +43,7 @@ type
private
FFrameWidth: integer;
FMediator: TDesignerMediator;
procedure SetMediator(const AValue: TDesignerMediator);
protected
procedure SetFrameWidth(const AValue: integer); virtual;
public
@ -53,7 +54,7 @@ type
procedure DoSaveBounds; override;
public
property FrameWidth: integer read FFrameWidth write SetFrameWidth;
property Mediator: TDesignerMediator read FMediator write FMediator;
property Mediator: TDesignerMediator read FMediator write SetMediator;
end;
@ -62,6 +63,14 @@ implementation
{ TNonControlDesignerForm }
procedure TNonControlDesignerForm.SetMediator(const AValue: TDesignerMediator);
begin
if FMediator=AValue then exit;
if FMediator<>nil then FMediator.LCLForm:=nil;
FMediator:=AValue;
if FMediator<>nil then FMediator.LCLForm:=Self;
end;
procedure TNonControlDesignerForm.SetFrameWidth(const AValue: integer);
begin
if FFrameWidth = AValue then

View File

@ -90,10 +90,21 @@ type
which will emulate the painting, handle the mouse and editing bounds. }
TDesignerMediator = class(TComponent)
private
FDesigner: TComponentEditorDesigner;
FLCLForm: TForm;
protected
procedure SetDesigner(const AValue: TComponentEditorDesigner);
procedure SetLCLForm(const AValue: TForm); virtual;
public
class function FormClass: TComponentClass; virtual; abstract;
class function CreateMediator(TheOwner, aForm: TComponent): TDesignerMediator; virtual; abstract;
class procedure InitFormInstance(aForm: TComponent); virtual; // called after NewInstance, before constructor
public
procedure SetBounds(AComponent: TComponent; NewBounds: TRect); virtual; abstract;
procedure GetBounds(AComponent: TComponent; out CurBounds: TRect); virtual; abstract;
property LCLForm: TForm read FLCLForm write SetLCLForm;
property Designer: TComponentEditorDesigner read FDesigner write SetDesigner;
end;
TDesignerMediatorClass = class of TDesignerMediator;
@ -182,6 +193,19 @@ implementation
{ TDesignerMediator }
procedure TDesignerMediator.SetDesigner(const AValue: TComponentEditorDesigner
);
begin
if FDesigner=AValue then exit;
FDesigner:=AValue;
end;
procedure TDesignerMediator.SetLCLForm(const AValue: TForm);
begin
if FLCLForm=AValue then exit;
FLCLForm:=AValue;
end;
class procedure TDesignerMediator.InitFormInstance(aForm: TComponent);
begin