52 lines
1.3 KiB
ObjectPascal
52 lines
1.3 KiB
ObjectPascal
|
|
unit uViewConfiguracionRegistryUtils;
|
||
|
|
|
||
|
|
interface
|
||
|
|
|
||
|
|
uses
|
||
|
|
Classes, Forms, uClassRegistryUtils;
|
||
|
|
|
||
|
|
type
|
||
|
|
IViewConfiguracionRegistry = interface (IComponentRegistry)
|
||
|
|
['{F9F580BA-B73E-4073-9AC6-6A63D3D93952}']
|
||
|
|
function CreateView(const aClassOrDisplayname: String;
|
||
|
|
aOwner: TComponent = nil): TFrame;
|
||
|
|
end;
|
||
|
|
|
||
|
|
TViewConfiguracionRegistry = class(TComponentRegistry, IViewConfiguracionRegistry)
|
||
|
|
protected
|
||
|
|
procedure ValidateMinAcceptableClass(var aMinAcceptableClass: TClass); override;
|
||
|
|
function CreateView( const aClassOrDisplayname: String;
|
||
|
|
aOwner: TComponent = nil ): TFrame;
|
||
|
|
public
|
||
|
|
property Count;
|
||
|
|
end;
|
||
|
|
|
||
|
|
var
|
||
|
|
ViewConfiguracionRegistry : IViewConfiguracionRegistry;
|
||
|
|
|
||
|
|
implementation
|
||
|
|
|
||
|
|
{ TViewConfiguracionRegistry }
|
||
|
|
|
||
|
|
function TViewConfiguracionRegistry.CreateView(const aClassOrDisplayname: String;
|
||
|
|
aOwner: TComponent): TFrame;
|
||
|
|
begin
|
||
|
|
Result := CreateComponent( aClassOrDisplayname, aOwner ) as TFrame;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TViewConfiguracionRegistry.ValidateMinAcceptableClass(
|
||
|
|
var aMinAcceptableClass: TClass);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
if not aMinAcceptableClass.InheritsFrom(TFrame) then
|
||
|
|
aMinAcceptableClass := TFrame;
|
||
|
|
end;
|
||
|
|
|
||
|
|
initialization
|
||
|
|
ViewConfiguracionRegistry := TViewConfiguracionRegistry.Create;
|
||
|
|
|
||
|
|
finalization
|
||
|
|
ViewConfiguracionRegistry := NIL;
|
||
|
|
|
||
|
|
end.
|