LMD VCL - ImageList support

From LMD
Revision as of 19:22, 28 March 2007 by Rafael (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Since LMD-Tools 8 LMD ImageLists are derived from TCustomImageList. Thus LMD Controls which could previously linked to LMD ImageLists can now make use of any TCustomImageList descendant. The other way around is unfortunately possible only, when no System ImageList Handle is required (e.g. Win32 controls of VCL palette will not be compatible. They can be linked to LMD ImageLists, but they can not make use of it). Other controls which use only Draw or GetBitmap methods will work, though.

LMD ImageLists are in LMD 2007 branch part of the lmdrtlx runtime package, thus also ElPack controls can make use of the advanced imagelist controls.

Wrapper methods

LMD-Tools ImageLists provide advanced functionality which is not available in VCL imagelists. Examples are two dimensional imagelists like in TLMDImageList or storing of any graphic file (in any size) in TLMDGraphicList. To allow programmers to easily access imagelists in a common way, wrapper methods were created in LMDCont unit, which take care to handle features of different imagelist classes. Available methods are:

General

<delphi>function LMDIsSingleItemImageList(aList:TCustomImageList):Boolean;</delphi> Returns false when imagelist is a list of imagelists (--> TLMDImageList and -Connector), 2 dimensional imagelists are referenced by controls via ListIndex (index of imagelist) AND ImageIndex (index of image) properties. LMD-Tools controls use the ListIndex property only, when imagelist is only one-dimensional.

<delphi>function LMDIsCollectionImageList(aList:TCustomImageList):Boolean;</delphi> Returns true when imagelist is a collection of imagelists (--> TLMDImageListConnector)

ImageList specific

function LMDIMLIsValidItem(aList:TCustomImageList; ListIndex, ImageIndex:Integer):Boolean; Checks whether Image is specified by ListIndex and ImageIndex is valid in ImageList aList.

procedure LMDIMLItemBitmap(aList:TCustomImageList; ListIndex, ImageIndex:Integer; tmp:TBitmap); Retrieve from ImageList aList the item indexed by ListIndex/ImageIndex parameters.

function LMDIMLItemWidth(aList:TCustomImageList; ListIndex:Integer):Integer; Returns width of a particular item.

function LMDIMLItemHeight(aList:TCustomImageList; ListIndex:Integer):Integer; Returns height of a particular item.

function LMDIMLItemRect(aList:TCustomImageList; ListIndex, ImageIndex:Integer):TRect; As before, but returns a TRect record for specified item.

function LMDIMLPalette(aList:TCustomImageList; ListIndex:Integer):HPalette; Returns associated palette for specified item.

function LMDIMLCount(aList:TCustomImageList;ListIndex:Integer=-1):Integer; Returns number of items in an imagelist. For two-dimensional imagelists ListIndex specifies the sublist for which number of images should be retrieved.

function LMDIMLTransparentColor(aList:TCustomImageList;ListIndex:Integer;ImageIndex:Integer=0):TColor; Returns Transparent color for imagelist or particular item.

function LMDIMLMasked(aList:TCustomImageList;ListIndex:Integer):Boolean; Returns masked state for imagelist or particular item.

procedure LMDIMLClipDraw(Canvas:TCanvas; target:TRect; flags:WORD; pos:LongInt; transColor:TColor; aList:TCustomImageList; ListIndex, index:Integer); Wraps ClipDraw feature of LMD imagelists.