home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 October / tst.iso / programs / borland / RUNIMAGE / DELPHI40 / DOC / IMGLIST.INT < prev    next >
Encoding:
Text File  |  1998-06-17  |  4.2 KB  |  107 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Visual Component Library         }
  5. {                                                       }
  6. {       Copyright (c) 1995,98 Inprise Corporation       }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit ImgList;
  11.  
  12. {$R-}
  13.  
  14. interface
  15.  
  16. uses Windows, Classes, Graphics, CommCtrl;
  17.  
  18. type
  19.  
  20. { TChangeLink }
  21.  
  22.   TCustomImageList = class;
  23.  
  24.   TChangeLink = class(TObject)
  25.   public
  26.     destructor Destroy; override;
  27.     procedure Change; dynamic;
  28.     property OnChange: TNotifyEvent;
  29.     property Sender: TCustomImageList;
  30.   end;
  31.  
  32. { TCustomImageList }
  33.  
  34.   TDrawingStyle = (dsFocus, dsSelected, dsNormal, dsTransparent);
  35.   TImageType = (itImage, itMask);
  36.   TResType = (rtBitmap, rtCursor, rtIcon);
  37.   TOverlay = 0..3;
  38.   TLoadResource = (lrDefaultColor, lrDefaultSize, lrFromFile,
  39.     lrMap3DColors, lrTransparent, lrMonoChrome);
  40.   TLoadResources = set of TLoadResource;
  41.  
  42.   TCustomImageList = class(TComponent)
  43.   protected
  44.     procedure Change; dynamic;
  45.     procedure DefineProperties(Filer: TFiler); override;
  46.     procedure DoDraw(Index: Integer; Canvas: TCanvas; X, Y: Integer;
  47.       Style: Cardinal; Enabled: Boolean); virtual;
  48.     procedure GetImages(Index: Integer; Image, Mask: TBitmap);
  49.     procedure HandleNeeded;
  50.     procedure Initialize; virtual;
  51.   public
  52.     constructor Create(AOwner: TComponent); override;
  53.     constructor CreateSize(AWidth, AHeight: Integer);
  54.     destructor Destroy; override;
  55.     procedure Assign(Source: TPersistent); override;
  56.     function Add(Image, Mask: TBitmap): Integer;
  57.     function AddIcon(Image: TIcon): Integer;
  58.     procedure AddImages(Value: TCustomImageList);
  59.     function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
  60.     procedure Clear;
  61.     procedure Delete(Index: Integer);
  62.     procedure Draw(Canvas: TCanvas; X, Y, Index: Integer; Enabled: Boolean=True);
  63.     procedure DrawOverlay(Canvas: TCanvas; X, Y: Integer;
  64.       ImageIndex: Integer; Overlay: TOverlay; Enabled: Boolean=True);
  65.     function FileLoad(ResType: TResType; Name: string;
  66.       MaskColor: TColor): Boolean;
  67.     procedure GetBitmap(Index: Integer; Image: TBitmap);
  68.     function GetHotSpot: TPoint; virtual;
  69.     procedure GetIcon(Index: Integer; Image: TIcon);
  70.     function GetImageBitmap: HBITMAP;
  71.     function GetMaskBitmap: HBITMAP;
  72.     function GetResource(ResType: TResType; Name: string;
  73.       Width: Integer; LoadFlags: TLoadResources; MaskColor: TColor): Boolean;
  74.     function GetInstRes(Instance: THandle; ResType: TResType; Name: string;
  75.       Width: Integer; LoadFlags: TLoadResources; MaskColor: TColor): Boolean;
  76.     function HandleAllocated: Boolean;
  77.     procedure Insert(Index: Integer; Image, Mask: TBitmap);
  78.     procedure InsertIcon(Index: Integer; Image: TIcon);
  79.     procedure InsertMasked(Index: Integer; Image: TBitmap; MaskColor: TColor);
  80.     procedure Move(CurIndex, NewIndex: Integer);
  81.     function Overlay(ImageIndex: Integer; Overlay: TOverlay): Boolean;
  82.     procedure RegisterChanges(Value: TChangeLink);
  83.     function ResourceLoad(ResType: TResType; Name: string;
  84.       MaskColor: TColor): Boolean;
  85.     function ResInstLoad(Instance: THandle; ResType: TResType; Name: string;
  86.       MaskColor: TColor): Boolean;
  87.     procedure Replace(Index: Integer; Image, Mask: TBitmap);
  88.     procedure ReplaceIcon(Index: Integer; Image: TIcon);
  89.     procedure ReplaceMasked(Index: Integer; NewImage: TBitmap; MaskColor: TColor);
  90.     procedure UnRegisterChanges(Value: TChangeLink);
  91.     property Count: Integer;
  92.     property Handle: HImageList;
  93.   public
  94.     property AllocBy: Integer default 4;
  95.     property BlendColor: TColor default clNone;
  96.     property BkColor: TColor default clNone;
  97.     property DrawingStyle: TDrawingStyle default dsNormal;
  98.     property Height: Integer default 16;
  99.     property ImageType: TImageType default itImage;
  100.     property Masked: Boolean default True;
  101.     property ShareImages: Boolean default False;
  102.     property Width: Integer default 16;
  103.     property OnChange: TNotifyEvent;
  104.   end;
  105.  
  106. implementation
  107.