home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Plus! (NZ) 2001 June
/
HDC50.iso
/
Runimage
/
Delphi50
/
Doc
/
IMGLIST.INT
< prev
next >
Wrap
Text File
|
1999-08-11
|
4KB
|
109 lines
{*******************************************************}
{ }
{ Borland Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,99 Inprise Corporation }
{ }
{*******************************************************}
unit ImgList;
{$R-,T-,H+,X+}
interface
uses Windows, Classes, Graphics, CommCtrl;
type
{ TChangeLink }
TCustomImageList = class;
TChangeLink = class(TObject)
public
destructor Destroy; override;
procedure Change; dynamic;
property OnChange: TNotifyEvent;
property Sender: TCustomImageList;
end;
{ TCustomImageList }
TDrawingStyle = (dsFocus, dsSelected, dsNormal, dsTransparent);
TImageType = (itImage, itMask);
TResType = (rtBitmap, rtCursor, rtIcon);
TOverlay = 0..3;
TLoadResource = (lrDefaultColor, lrDefaultSize, lrFromFile,
lrMap3DColors, lrTransparent, lrMonoChrome);
TLoadResources = set of TLoadResource;
TImageIndex = type Integer;
TCustomImageList = class(TComponent)
protected
procedure AssignTo(Dest: TPersistent); override;
procedure Change; dynamic;
procedure DefineProperties(Filer: TFiler); override;
procedure DoDraw(Index: Integer; Canvas: TCanvas; X, Y: Integer;
Style: Cardinal; Enabled: Boolean); virtual;
procedure GetImages(Index: Integer; Image, Mask: TBitmap);
procedure HandleNeeded;
procedure Initialize; virtual;
public
constructor Create(AOwner: TComponent); override;
constructor CreateSize(AWidth, AHeight: Integer);
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
function Add(Image, Mask: TBitmap): Integer;
function AddIcon(Image: TIcon): Integer;
procedure AddImages(Value: TCustomImageList);
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
procedure Clear;
procedure Delete(Index: Integer);
procedure Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean=True);
procedure DrawOverlay(Canvas: TCanvas; X, Y: Integer;
ImageIndex: Integer; Overlay: TOverlay; Enabled: Boolean=True);
function FileLoad(ResType: TResType; Name: string;
MaskColor: TColor): Boolean;
procedure GetBitmap(Index: Integer; Image: TBitmap);
function GetHotSpot: TPoint; virtual;
procedure GetIcon(Index: Integer; Image: TIcon);
function GetImageBitmap: HBITMAP;
function GetMaskBitmap: HBITMAP;
function GetResource(ResType: TResType; Name: string;
Width: Integer; LoadFlags: TLoadResources; MaskColor: TColor): Boolean;
function GetInstRes(Instance: THandle; ResType: TResType; Name: string;
Width: Integer; LoadFlags: TLoadResources; MaskColor: TColor): Boolean;
function HandleAllocated: Boolean;
procedure Insert(Index: Integer; Image, Mask: TBitmap);
procedure InsertIcon(Index: Integer; Image: TIcon);
procedure InsertMasked(Index: Integer; Image: TBitmap; MaskColor: TColor);
procedure Move(CurIndex, NewIndex: Integer);
function Overlay(ImageIndex: Integer; Overlay: TOverlay): Boolean;
procedure RegisterChanges(Value: TChangeLink);
function ResourceLoad(ResType: TResType; Name: string;
MaskColor: TColor): Boolean;
function ResInstLoad(Instance: THandle; ResType: TResType; Name: string;
MaskColor: TColor): Boolean;
procedure Replace(Index: Integer; Image, Mask: TBitmap);
procedure ReplaceIcon(Index: Integer; Image: TIcon);
procedure ReplaceMasked(Index: Integer; NewImage: TBitmap; MaskColor: TColor);
procedure UnRegisterChanges(Value: TChangeLink);
property Count: Integer;
property Handle: HImageList;
public
property AllocBy: Integer default 4;
property BlendColor: TColor default clNone;
property BkColor: TColor default clNone;
property DrawingStyle: TDrawingStyle default dsNormal;
property Height: Integer default 16;
property ImageType: TImageType default itImage;
property Masked: Boolean default True;
property ShareImages: Boolean default False;
property Width: Integer default 16;
property OnChange: TNotifyEvent;
end;
implementation