mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 10:49:27 +02:00
lcl: implement TImageList.AddIcon (issue #0017900)
git-svn-id: trunk@28955 -
This commit is contained in:
parent
bd8008f11a
commit
1b32e2fefb
@ -50,7 +50,7 @@ interface
|
||||
{$endif}
|
||||
|
||||
uses
|
||||
SysUtils, Classes, FPCAdds, LCLStrConsts, LCLIntf, LResources, LCLType,
|
||||
Types, SysUtils, Classes, FPCAdds, LCLStrConsts, LCLIntf, LResources, LCLType,
|
||||
LCLProc, Graphics, GraphType, LCLClasses, IntfGraphics, FPReadBMP,
|
||||
WSReferences;
|
||||
|
||||
@ -163,7 +163,7 @@ type
|
||||
procedure EndUpdate;
|
||||
|
||||
function Add(Image, Mask: TCustomBitmap): Integer;
|
||||
function AddIcon(Image: TIcon): Integer;
|
||||
function AddIcon(Image: TCustomIcon): Integer;
|
||||
procedure AddImages(AValue: TCustomImageList);
|
||||
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
|
||||
function AddLazarusResource(const ResourceName: string; MaskColor: TColor = clNone): integer;
|
||||
@ -181,6 +181,7 @@ type
|
||||
function GetHotSpot: TPoint; virtual;
|
||||
|
||||
procedure Insert(AIndex: Integer; AImage, AMask: TCustomBitmap);
|
||||
procedure InsertIcon(AIndex: Integer; AIcon: TCustomIcon);
|
||||
procedure InsertMasked(Index: Integer; AImage: TCustomBitmap; MaskColor: TColor);
|
||||
procedure Move(ACurIndex, ANewIndex: Integer);
|
||||
procedure Replace(AIndex: Integer; AImage, AMask: TCustomBitmap);
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
type
|
||||
TImageListSignature = array[0..1] of char;
|
||||
TCustomIconAccess = class(TCustomIcon);
|
||||
|
||||
const
|
||||
SIG_LAZ1 = #1#0;
|
||||
@ -73,13 +74,10 @@ end;
|
||||
|
||||
Adds an icon to the list.
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomImageList.AddIcon(Image: TIcon): Integer;
|
||||
begin
|
||||
//!!! check one or more
|
||||
|
||||
//No Icon Support yet
|
||||
|
||||
Result := -1;
|
||||
function TCustomImageList.AddIcon(Image: TCustomIcon): Integer;
|
||||
begin
|
||||
Result := Count;
|
||||
InsertIcon(Result, Image);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -697,6 +695,18 @@ begin
|
||||
InternalInsert(AIndex, AImage.Handle, msk, AImage.Width, AImage.Height);
|
||||
end;
|
||||
|
||||
procedure TCustomImageList.InsertIcon(AIndex: Integer; AIcon: TCustomIcon);
|
||||
var
|
||||
IconIndex: Integer;
|
||||
Image: TIconImage;
|
||||
begin
|
||||
if AIcon = nil then Exit;
|
||||
IconIndex := AIcon.GetBestIndexForSize(Size(Width, Height));
|
||||
if IconIndex = -1 then Exit;
|
||||
Image := TSharedIcon(TCustomIconAccess(AIcon).FSharedImage).Images[IconIndex];
|
||||
InternalInsert(AIndex, Image.Handle, Image.MaskHandle, Image.Width, Image.Height);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomImageList.InsertMasked
|
||||
Params: Index: the index of the inserted image
|
||||
|
Loading…
Reference in New Issue
Block a user