lcl: add another TImageList.Draw Delphi compatibility method (issue #0018921)

git-svn-id: trunk@29835 -
This commit is contained in:
paul 2011-03-14 07:25:08 +00:00
parent 5bc0a7c8d3
commit d257609a59
2 changed files with 25 additions and 8 deletions

View File

@ -172,7 +172,11 @@ type
procedure Clear;
procedure Delete(AIndex: Integer);
procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; AEnabled: Boolean = True); overload;
procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawEffect: TGraphicsDrawEffect); overload; virtual;
procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawEffect: TGraphicsDrawEffect); overload;
procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawingStyle: TDrawingStyle; AImageType: TImageType;
AEnabled: Boolean = True); overload;
procedure Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer; ADrawingStyle: TDrawingStyle; AImageType: TImageType;
ADrawEffect: TGraphicsDrawEffect); overload; virtual;
procedure FillDescription(out ADesc: TRawImageDescription);
procedure GetBitmap(Index: Integer; Image: TCustomBitmap); overload;
procedure GetBitmap(Index: Integer; Image: TCustomBitmap; AEffect: TGraphicsDrawEffect); overload;

View File

@ -28,6 +28,12 @@ const
SIG_LAZ3 = 'Li';
SIG_D3 = 'IL';
const
EffectMap: array[Boolean] of TGraphicsDrawEffect = (
gdeDisabled,
gdeNormal
);
{------------------------------------------------------------------------------
Method: CopyImage
Params: Destination, Source: the destination/source canvas
@ -485,24 +491,31 @@ end;
------------------------------------------------------------------------------}
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
AEnabled: Boolean);
const
EffectMap: array[Boolean] of TGraphicsDrawEffect =
(
gdeDisabled,
gdeNormal
);
begin
Draw(ACanvas, AX, AY, AIndex, EffectMap[AEnabled]);
end;
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
ADrawEffect: TGraphicsDrawEffect);
begin
Draw(ACanvas, AX, AY, AIndex, DrawingStyle, ImageType, ADrawEffect);
end;
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
ADrawingStyle: TDrawingStyle; AImageType: TImageType; AEnabled: Boolean);
begin
Draw(ACanvas, AX, AY, AIndex, ADrawingStyle, AImageType, EffectMap[AEnabled]);
end;
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
ADrawingStyle: TDrawingStyle; AImageType: TImageType;
ADrawEffect: TGraphicsDrawEffect);
begin
if (AIndex < 0) or (AIndex >= FCount) then Exit;
ReferenceNeeded;
TWSCustomImageListClass(WidgetSetClass).Draw(Self, AIndex, ACanvas, Rect(AX, AY, FWidth, FHeight),
BkColor, BlendColor, ADrawEffect, DrawingStyle, ImageType);
BkColor, BlendColor, ADrawEffect, ADrawingStyle, AImageType);
end;
{------------------------------------------------------------------------------