[Overview][Types][Classes][Index] Reference for unit 'ImgList' (#lcl)

TCustomImageList

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for TImageList (not the same as a TBitmap collection)

Declaration

Source position: imglist.pp line 107

type TCustomImageList = class(TLCLReferenceComponent) end;

protected

  procedure CheckIndex();

  

Assures that Index is not out of the list bound.

  function GetReferenceHandle; override;

  

Returns the Handle of the Reference.

  procedure Initialize; virtual;

  

Initialize - sets up the list

  procedure DefineProperties(); override;

  procedure SetWidthHeight(); virtual;

  

Sets both the Width and Height of all images.

  procedure ClearOverlays;

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  function WSCreateReference(); override;

  

Instructs the widgtset to create an imagelist.

public

  constructor Create(); override;

  constructor CreateSize();

  

Initialize the list for image(s) with the given height and width.

  destructor Destroy; override;

  procedure AssignTo(); override;

  procedure Assign(); override;

  procedure WriteData(); virtual;

  

Writes the ImageList data into the stream.

  procedure ReadData(); virtual;

  

Restores the ImageList data from the stream.

  function Equals();

  

Check for equivalence with another ImageList

  procedure BeginUpdate;

  

Start updating the data, block the OnChange event.

  procedure EndUpdate;

  

EndUpdate - finish updating the data, call Change.

  function Add();

  

Adds an Image and Mask bitmap to the list. Returns the index of the added image or -1 if unsucessful.

  function AddIcon();

  

Adds an icon to the list, returning the index of the icon or -1 if not successful.

  procedure AddImages();

  

Adds images from another imagelist to the list.

  function AddMasked();

  

Adds one or more (bitmap width / imagelist width) transparent bitmaps to the list.

  function AddLazarusResource();

  

Loads a bitmap from a lazarus resources and adds it.

  function AddResourceName();

  procedure Change;

  

Send change notifications, if the list has changed and updates are not locked.

  procedure Clear;

  

Removes all images from the list.

  procedure Delete();

  

Delete the specified image.

  procedure Draw();

  

Paint an image

  procedure DrawOverlay();

  procedure FillDescription();

  

FillDescription - fills the description with the default info of the imagedata

  procedure GetBitmap();

  

Copies the selected image into the given bitmap

  procedure GetFullBitmap();

  

  procedure GetFullRawImage();

  

Exports the entire internal image (color array) and description.

  procedure GetIcon();

  procedure GetRawImage();

  

Exports an image as TRawImage.

  function GetHotSpot; virtual;

  

Returns the offset from the drawing position to the image origin.

  procedure Insert();

  

Inserts one or more images into the list at the index position.

  procedure InsertIcon();

  

Insert an Icon into the list.

  procedure InsertMasked();

  

Adds one or more transparent bitmaps to the list.

  procedure Move();

  

Move an image from index CurIndex to NewIndex.

  procedure Overlay();

  property HasOverlays: Boolean; [r]

  procedure Replace();

  

Replace the indexed image with the Bitmap given

  procedure ReplaceMasked();

  

ReplaceMasked - replaces the indexed image with the image given.

  procedure RegisterChanges();

  

Registers an TChangeLink object to get notified of a change of the imagelist.

  procedure StretchDraw();

  

Draws an image stretched to ARect.

  procedure UnRegisterChanges();

  

Unregisters an notification object.

  property AllocBy: Integer; [rw]

  

The length of the image list is increased in multiples of AllocBy images. Default is 4.

  property BlendColor: TColor; [rw]

  

The color for used in blending (dithering) an image.

  property BkColor: TColor; [rw]

  

The background color to use for transparent parts.

  property Count: Integer; [r]

  

The number of images in the list

  property DrawingStyle: TDrawingStyle; [rw]

  

The default drawing style - focussed, selected, normal or transparent.

  property HandleAllocated: Boolean;

  property Height: Integer; [rw]

  

The unique height of all images in the list.

  property Width: Integer; [rw]

  

The unique width of all images in the list.

  property OnChange: TNotifyEvent; [rw]

  

OnChange - event handler for a change in the imagelist

  property Masked: Boolean; [rw]

  

True when mask images are stored with every image (unused!).

  property Reference: TWSCustomImageListReference; [r]

  

Reference to the imagelist

  property ShareImages: Boolean; [rw]

  

True when this image list is shared. Unused!

  property ImageType: TImageType; [rw]

  

Unused!

Inheritance

TCustomImageList

  

Base class for TImageList (not the same as a TBitmap collection)

|

TLCLReferenceComponent

  

Base class for all components having an associated widget.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

An ImageList contains images (bitmaps or icons) of the same Width and Height, accessible by index. The images are stored in one big (wide) bitmap, whose width is Width*Count.

When an image of a different Width or Height is inserted, the previous contents of the list are discarded!

It's okay, however, to insert an imagelist-like bitmap, that contains multiple bitmaps of the same Width and Height as used by the ImageList. This allows one to insert e.g. other (compatible) ImageLists, or bitmaps for multiple states of essentially the same image (button pressed, released and disabled).

Transparency is implemented in the alpha channel of the raw 32 bit RGBA imagedata array - but not all platforms support such an alpha channel.

The painting of an image from the list is handled by the widgetset, no bitmap or icon component is involved. The widgetset can use a different internal organization of the data, optimized for immediate painting of an image.

NOTE: A TCustomImageList is not a TBitmap collection. If a storage of distinct bitmaps is needed, create your own list of TBitMaps (array or TList).

Please note also that inserting or moving images will affect the index of all following images, what can cause trouble with index constants. In such cases a bitmap collection may better fit your needs.

Remark: Windows ImgageLists can contain a list of monochrome mask bitmaps, present when Masked=True.

Errors

Currently only the insertion of Bitmaps is supported. Other image types should be rendered as bitmaps of Width and Height, which then can be inserted.

Image overlays also are unsupported.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.