mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-31 13:35:56 +02:00
IDE: designer mediator: added InitFormInstance method
git-svn-id: trunk@21621 -
This commit is contained in:
parent
9e1dbe78ab
commit
463fff0bb4
@ -61,6 +61,7 @@ type
|
||||
TJITReaderErrorEvent = procedure(Sender: TObject; Reader: TReader;
|
||||
ErrorType: TJITFormError;
|
||||
var Action: TModalResult) of object;
|
||||
TJITBeforeCreateEvent = procedure(Sender: TObject; Instance: TPersistent) of object;
|
||||
TJITExceptionEvent = procedure(Sender: TObject; E: Exception;
|
||||
var Action: TModalResult) of object;
|
||||
TJITPropertyNotFoundEvent = procedure(Sender: TObject; Reader: TReader;
|
||||
@ -88,6 +89,7 @@ type
|
||||
FCurUnknownClass: string;
|
||||
FCurUnknownProperty: string;
|
||||
FErrors: TLRPositionLinks;
|
||||
FOnBeforeCreate: TJITBeforeCreateEvent;
|
||||
FOnException: TJITExceptionEvent;
|
||||
FOnFindAncestors: TJITFindAncestors;
|
||||
FOnFindClass: TJITFindClass;
|
||||
@ -189,6 +191,7 @@ type
|
||||
property OnPropertyNotFound: TJITPropertyNotFoundEvent
|
||||
read FOnPropertyNotFound write FOnPropertyNotFound;
|
||||
property OnException: TJITExceptionEvent read FOnException write FOnException;
|
||||
property OnBeforeCreate: TJITBeforeCreateEvent read FOnBeforeCreate write FOnBeforeCreate;
|
||||
property OnFindAncestors: TJITFindAncestors read FOnFindAncestors
|
||||
write FOnFindAncestors;
|
||||
property OnFindClass: TJITFindClass read FOnFindClass write FOnFindClass;
|
||||
@ -1012,6 +1015,9 @@ begin
|
||||
if (not Visible) and (Instance is TControl) then
|
||||
TControl(Instance).ControlStyle:=
|
||||
TControl(Instance).ControlStyle+[csNoDesignVisible];
|
||||
// event
|
||||
if Assigned(OnBeforeCreate) then
|
||||
OnBeforeCreate(Self,Instance);
|
||||
// finish 'create' component
|
||||
Instance.Create(nil);
|
||||
if NewComponentName<>'' then begin
|
||||
|
@ -137,6 +137,7 @@ each control that's dropped onto the form
|
||||
procedure SetObj_Inspector(AnObjectInspector: TObjectInspectorDlg); virtual;
|
||||
procedure JITListReaderError(Sender: TObject; Reader: TReader;
|
||||
ErrorType: TJITFormError; var Action: TModalResult); virtual;
|
||||
procedure JITListBeforeCreate(Sender: TObject; Instance: TPersistent);
|
||||
procedure JITListException(Sender: TObject; E: Exception;
|
||||
var Action: TModalResult);
|
||||
procedure JITListPropertyNotFound(Sender: TObject; Reader: TReader;
|
||||
@ -858,6 +859,7 @@ constructor TCustomFormEditor.Create;
|
||||
procedure InitJITList(List: TJITComponentList);
|
||||
begin
|
||||
List.OnReaderError:=@JITListReaderError;
|
||||
List.OnBeforeCreate:=@JITListBeforeCreate;
|
||||
List.OnException:=@JITListException;
|
||||
List.OnPropertyNotFound:=@JITListPropertyNotFound;
|
||||
List.OnFindAncestors:=@JITListFindAncestors;
|
||||
@ -1248,7 +1250,6 @@ begin
|
||||
if Result is TNonControlDesignerForm then begin
|
||||
// create the mediator
|
||||
MediatorClass:=GetDesignerMediatorClass(TComponentClass(LookupRoot.ClassType));
|
||||
debugln(['TCustomFormEditor.CreateNonFormForm AAA1 ',MediatorClass<>nil]);
|
||||
if MediatorClass<>nil then
|
||||
TNonControlDesignerForm(Result).Mediator:=MediatorClass.CreateMediator(nil,LookupRoot);
|
||||
end;
|
||||
@ -2315,6 +2316,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.JITListBeforeCreate(Sender: TObject;
|
||||
Instance: TPersistent);
|
||||
var
|
||||
MediatorClass: TDesignerMediatorClass;
|
||||
begin
|
||||
if Instance is TComponent then begin
|
||||
MediatorClass:=GetDesignerMediatorClass(TComponentClass(Instance.ClassType));
|
||||
if MediatorClass<>nil then
|
||||
MediatorClass.InitFormInstance(TComponent(Instance));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomFormEditor.JITListException(Sender: TObject; E: Exception;
|
||||
var Action: TModalResult);
|
||||
var
|
||||
|
@ -93,6 +93,7 @@ type
|
||||
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
|
||||
end;
|
||||
TDesignerMediatorClass = class of TDesignerMediator;
|
||||
|
||||
@ -179,5 +180,12 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
{ TDesignerMediator }
|
||||
|
||||
class procedure TDesignerMediator.InitFormInstance(aForm: TComponent);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user