Class TIconListBox (unit IconCtls)

Inherits from

TCustomListBox

Constructors


constructor Create(AOwner: TComponent);

TIconListBox Component


Functions

procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);

Draw the item requested in the given rectangle.

function GetIcon(const Index: integer): TIcon;

Returns the icon for a given combobox index

function GetVersion: TDFSVersion;

If anything went wrong, we fall down to here.

procedure MeasureItem(Index: Integer; var Height: Integer);

Owner drawing routines

Return the size of the item we are drawing


function ReadIcon(const Index: integer): TIcon;

Icon service routines

Used to extract icons from files and assign them to a TIcon object


procedure SetAutoDisable(Value: boolean);

Update the AutoDisable property

procedure SetEnableCaching(Value: boolean);

Update the EnableCaching property

procedure SetFileName(Value: String);

procedure CreateParams(var Params: TCreateParams); override;} { Routines for setting property values and updating affected items

Update the filename of the icon file.


procedure SetVersion(const Val: TDFSVersion);


procedure SetXIcons(Value: integer);

Set the number of icons to be displayed in the listbox

procedure SetYIcons(Value: integer);

Call ResetSize to update the width or height, depending on the orientation

procedure CNDeleteItem(var Msg: TWMDeleteItem);

procedure TIconListBox.

procedure FreeIcons;

Free the icon resources we created.

procedure LoadIcons;

Routines that should only be used internally by component

Initialize the icon handles, which are stored in the Objects property


procedure ResetSize;

Reset the size of the listbox to reflect changes in orientation and IconsDisplayed

procedure UpdateEnabledState;

Disable the control if we don't have a valid filename, and option is enabled

Properties

property Align :

Protected properties in parent that we will make available to everyone

property AutoDisable : boolean

If true, the combobox will be disabled when FileName does not exist

property Color :


property Ctl3D :


property DragCursor :


property DragMode :


property EnableCaching : boolean

If true, icons will be loaded as needed, instead of all at once

property Enabled :


property FileName : string

Name of icon file to display

property ItemIndex :


property NumberOfIcons : integer

The number of icons in the file.

property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowHint :


property TabOrder :


property TabStop :


property Version : TDFSVersion


property Visible :


property XIcons : integer

Number of icons that are to be displayed in the listbox.

property YIcons : integer

Number of icons that are to be displayed in the listbox.

Events

event OnChange : TNotifyEvent


event OnClick :


event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnFileChange : TNotifyEvent

Useful if you have statics the reflect the number of icons, etc.

event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


Variables

FAutoDisable : boolean;


FEnableCaching : boolean;


FFileName : String;

Private declarations

FItemWidth : integer;


FNumberOfIcons : integer;


FOnChange : TNotifyEvent;


FOnFileChange : TNotifyEvent;

Borland forgot this one in the parent, no idea why.

FXIcons : integer;


FYIcons : integer;



Constructors


constructor Create(AOwner: TComponent);

TIconListBox Component


Functions


procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState);

Draw the item requested in the given rectangle. Because of the parent's default } { behavior, we needn't worry about the State. That's very nice.


function GetIcon(const Index: integer): TIcon;

Returns the icon for a given combobox index


function GetVersion: TDFSVersion;

If anything went wrong, we fall down to here. You may want to add some } { sort of user notification. No clean up is necessary since we did not } { create anything. We'll just ignore the problem and hope it goes away. :) } {!


procedure MeasureItem(Index: Integer; var Height: Integer);

Owner drawing routines

Return the size of the item we are drawing


function ReadIcon(const Index: integer): TIcon;

Icon service routines

Used to extract icons from files and assign them to a TIcon object


procedure SetAutoDisable(Value: boolean);

Update the AutoDisable property


procedure SetEnableCaching(Value: boolean);

Update the EnableCaching property


procedure SetFileName(Value: String);

procedure CreateParams(var Params: TCreateParams); override;} { Routines for setting property values and updating affected items

Update the filename of the icon file.


procedure SetVersion(const Val: TDFSVersion);


procedure SetXIcons(Value: integer);

Set the number of icons to be displayed in the listbox


procedure SetYIcons(Value: integer);

Call ResetSize to update the width or height, depending on the orientation


procedure CNDeleteItem(var Msg: TWMDeleteItem);

procedure TIconListBox.CreateParams(var Params: TCreateParams); begin inherited CreateParams(Params); { if Orientation = lbVertical then Params.Style := Params.Style or LBS_DISABLENOSCROLL or WS_VSCROLL and (not WS_HSCROLL) else Params.Style := Params.Style or LBS_DISABLENOSCROLL or WS_HSCROLL and (not WS_VSCROLL);} end;


procedure FreeIcons;

Free the icon resources we created.


procedure LoadIcons;

Routines that should only be used internally by component

Initialize the icon handles, which are stored in the Objects property


procedure ResetSize;

Reset the size of the listbox to reflect changes in orientation and IconsDisplayed


procedure UpdateEnabledState;

Disable the control if we don't have a valid filename, and option is enabled


Properties


property Align :

Protected properties in parent that we will make available to everyone


property AutoDisable : boolean

If true, the combobox will be disabled when FileName does not exist


property Color :


property Ctl3D :


property DragCursor :


property DragMode :


property EnableCaching : boolean

If true, icons will be loaded as needed, instead of all at once


property Enabled :


property FileName : string

Name of icon file to display


property ItemIndex :


property NumberOfIcons : integer

The number of icons in the file. -1 if FileName is not valid.


property ParentColor :


property ParentCtl3D :


property ParentFont :


property ParentShowHint :


property PopupMenu :


property ShowHint :


property TabOrder :


property TabStop :


property Version : TDFSVersion


property Visible :


property XIcons : integer

Number of icons that are to be displayed in the listbox. The width is modified } { automatically when you change this property.


property YIcons : integer

Number of icons that are to be displayed in the listbox. The height is modified } { automatically when you change this property.


Events


event OnChange : TNotifyEvent


event OnClick :


event OnDblClick :


event OnDragDrop :


event OnDragOver :


event OnEndDrag :


event OnEnter :


event OnExit :


event OnFileChange : TNotifyEvent

Useful if you have statics the reflect the number of icons, etc.


event OnKeyDown :


event OnKeyPress :


event OnKeyUp :


Variables


FAutoDisable : boolean;


FEnableCaching : boolean;


FFileName : String;

Private declarations


FItemWidth : integer;


FNumberOfIcons : integer;


FOnChange : TNotifyEvent;


FOnFileChange : TNotifyEvent;

Borland forgot this one in the parent, no idea why.


FXIcons : integer;


FYIcons : integer;