- TLCLHandleComponent modified: added 2 virtual methods: WSCreateHandle and WSDestroyHandle

git-svn-id: trunk@10921 -
This commit is contained in:
paul 2007-04-09 07:03:40 +00:00
parent 0e86c269a0
commit 1119942290
4 changed files with 30 additions and 14 deletions

View File

@ -33,8 +33,8 @@ uses
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
Windows, SysUtils, ImgList, GraphType, Graphics, LCLType,
WinExt,
Windows, SysUtils, Classes, ImgList, GraphType, Graphics, LCLType,
WinExt,
////////////////////////////////////////////////////
WSImgList, WSLCLClasses, WSProc;
@ -50,7 +50,7 @@ type
class function CreateHandle(AList: TCustomImageList; ACount, AGrow, AWidth,
AHeight: Integer; AData: PRGBAQuad): TLCLIntfHandle; override;
class procedure Delete(AList: TCustomImageList; AIndex: Integer); override;
class procedure DestroyHandle(AList: TCustomImageList); override;
class procedure DestroyHandle(AComponent: TComponent); override;
class procedure Draw(AList: TCustomImageList; AIndex: Integer; ACanvas: TCanvas;
ABounds: TRect; AEnabled: Boolean; AStyle: TDrawingStyle); override;
class procedure Insert(AList: TCustomImageList; AIndex: Integer; AData: PRGBAQuad); override;
@ -107,11 +107,11 @@ begin
ImageList_Remove(HImageList(AList.Handle), AIndex);
end;
class procedure TWin32WSCustomImageList.DestroyHandle(AList: TCustomImageList);
class procedure TWin32WSCustomImageList.DestroyHandle(AComponent: TComponent);
begin
if not WSCheckHandleAllocated(AList, 'DestroyHandle')
if not WSCheckHandleAllocated(TCustomImageList(AComponent), 'DestroyHandle')
then Exit;
ImageList_Destroy(AList.Handle);
ImageList_Destroy(TCustomImageList(AComponent).Handle);
end;
class procedure TWin32WSCustomImageList.Draw(AList: TCustomImageList; AIndex: Integer;

View File

@ -60,9 +60,11 @@ type
protected
procedure CreateHandle;
procedure CreateParams(var AParams: TCreateParams); virtual;
procedure DestroyHandle;
procedure DestroyHandle;
procedure HandleCreated; virtual; // gets called after the Handle is created
procedure HandleDestroying; virtual; // gets called before the Handle is destroyed
function WSCreateHandle(AParams: TCreateParams): TLCLIntfHandle; virtual;
procedure WSDestroyHandle; virtual;
protected
property Handle: TLCLIntfHandle read GetHandle;
public
@ -145,7 +147,7 @@ var
Params: TCreateParams;
begin
CreateParams(Params);
// TODO: some WScall here
FHandle := WSCreateHandle(Params);
end;
procedure TLCLHandleComponent.CreateParams(var AParams: TCreateParams);
@ -155,7 +157,7 @@ end;
procedure TLCLHandleComponent.DestroyHandle;
begin
HandleDestroying;
// TODO: some WScall here
WSDestroyHandle;
FHandle := 0;
end;
@ -167,6 +169,17 @@ procedure TLCLHandleComponent.HandleDestroying;
begin
end;
function TLCLHandleComponent.WSCreateHandle(AParams: TCreateParams): TLCLIntfHandle;
begin
// this function should be overriden in derrived class
Result := 0;
end;
procedure TLCLHandleComponent.WSDestroyHandle;
begin
TWSLCLHandleComponentClass(WidgetSetClass).DestroyHandle(Self);
end;
function TLCLHandleComponent.HandleAllocated: Boolean;
begin
Result := FHandle <> 0;

View File

@ -52,7 +52,6 @@ type
AHeight: Integer; AData: PRGBAQuad): TLCLIntfHandle; virtual;
class procedure Delete(AList: TCustomImageList; AIndex: Integer); virtual;
class procedure DestroyHandle(AList: TCustomImageList); virtual;
class procedure Draw(AList: TCustomImageList; AIndex: Integer; ACanvas: TCanvas;
ABounds: TRect; AEnabled: Boolean; AStyle: TDrawingStyle); virtual;
@ -83,10 +82,6 @@ class procedure TWSCustomImageList.Delete(AList: TCustomImageList;
begin
end;
class procedure TWSCustomImageList.DestroyHandle(AList: TCustomImageList);
begin
end;
class procedure TWSCustomImageList.Draw(AList: TCustomImageList; AIndex: Integer;
ACanvas: TCanvas; ABounds: TRect; AEnabled: Boolean; AStyle: TDrawingStyle);
begin

View File

@ -67,7 +67,9 @@ type
{ TWSLCLHandleComponent }
TWSLCLHandleComponent = class(TWSLCLComponent)
class procedure DestroyHandle(AComponent: TComponent); virtual;
end;
TWSLCLHandleComponentClass = class of TWSLCLHandleComponent;
function FindWSComponentClass(const AComponent: TComponentClass): TWSLCLComponentClass;
@ -430,6 +432,12 @@ begin
Result := TWSPrivateClass(PClass(Pointer(Self) + vmtWSPrivate)^);
end;
{ TWSLCLHandleComponent }
class procedure TWSLCLHandleComponent.DestroyHandle(AComponent: TComponent);
begin
end;
initialization
DoInitialization;