mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 21:38:00 +02:00
Adds a new virtual method to allow descendents to override their WSClass
git-svn-id: trunk@31868 -
This commit is contained in:
parent
8ce1ae04fd
commit
e8b84a2b50
@ -41,6 +41,7 @@ type
|
||||
FLCLRefCount: integer;
|
||||
protected
|
||||
class procedure WSRegisterClass; virtual;
|
||||
class function GetWSComponentClass(ASelf: TLCLComponent): TWSLCLComponentClass; virtual;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -89,6 +90,20 @@ begin
|
||||
//
|
||||
end;
|
||||
|
||||
// This method allows descendents to override the FWidgetSetClass
|
||||
class function TLCLComponent.GetWSComponentClass(ASelf: TLCLComponent): TWSLCLComponentClass;
|
||||
begin
|
||||
Result := FindWSComponentClass(Self);
|
||||
|
||||
if Result = nil then
|
||||
begin
|
||||
{$IFDEF VerboseLCL}
|
||||
DebugLn(['TLCLComponent.NewInstance WARNING: missing FWidgetSetClass ',ClassName]);
|
||||
{$ENDIF}
|
||||
Result := TWSLCLComponent;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TLCLComponent.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
@ -115,15 +130,8 @@ class function TLCLComponent.NewInstance: TObject;
|
||||
begin
|
||||
Result := inherited NewInstance;
|
||||
WSRegisterClass;
|
||||
TLCLComponent(Result).FWidgetSetClass := FindWSComponentClass(Self);
|
||||
|
||||
if TLCLComponent(Result).FWidgetSetClass = nil then
|
||||
begin
|
||||
{$IFDEF VerboseLCL}
|
||||
DebugLn(['TLCLComponent.NewInstance WARNING: missing FWidgetSetClass ',ClassName]);
|
||||
{$ENDIF}
|
||||
TLCLComponent(Result).FWidgetSetClass := TWSLCLComponent;
|
||||
end;
|
||||
TLCLComponent(Result).FWidgetSetClass := GetWSComponentClass(TLCLComponent(Result));
|
||||
end;
|
||||
|
||||
procedure TLCLComponent.RemoveAllHandlersOfObject(AnObject: TObject);
|
||||
|
Loading…
Reference in New Issue
Block a user