add measureitem to tcustomlistbox just like tcustomcombobox has

git-svn-id: trunk@5492 -
This commit is contained in:
micha 2004-05-21 11:13:18 +00:00
parent 9ebdcb9f6d
commit c5117d42da
3 changed files with 32 additions and 11 deletions

View File

@ -437,6 +437,16 @@ begin
FItems.Clear; FItems.Clear;
end; end;
{------------------------------------------------------------------------------
procedure TCustomListBox.MeasureItem(Index: Integer; var TheHeight: Integer);
------------------------------------------------------------------------------}
procedure TCustomListBox.MeasureItem(Index: Integer; var TheHeight: Integer);
begin
if Assigned(OnMeasureItem) then
OnMeasureItem(Self,Index,TheHeight);
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function TCustomListBox.GetIndexAtY(Y: integer): integer; function TCustomListBox.GetIndexAtY(Y: integer): integer;

View File

@ -351,8 +351,8 @@ begin
if Sender is TCustomListBox then if Sender is TCustomListBox then
begin begin
itemHeight := TCustomListBox(Sender).ItemHeight; itemHeight := TCustomListBox(Sender).ItemHeight;
// if TCustomListBox(Sender).Style = lbOwnerDrawVariable then if TCustomListBox(Sender).Style = lbOwnerDrawVariable then
// TCustomListBox(Sender).MeasureItem(itemID, integer(itemHeight)); TCustomListBox(Sender).MeasureItem(itemID, integer(itemHeight));
end; end;
end; end;
end; end;
@ -2996,6 +2996,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.113 2004/05/21 11:13:18 micha
add measureitem to tcustomlistbox just like tcustomcombobox has
Revision 1.112 2004/05/20 21:28:54 marc Revision 1.112 2004/05/20 21:28:54 marc
* Fixed win32 listview * Fixed win32 listview

View File

@ -351,6 +351,7 @@ type
FItemHeight: Integer; FItemHeight: Integer;
FItemIndex: integer; FItemIndex: integer;
FOnDrawItem: TDrawItemEvent; FOnDrawItem: TDrawItemEvent;
FOnMeasureItem: TMeasureItemEvent;
FSorted: boolean; FSorted: boolean;
FStyle: TListBoxStyle; FStyle: TListBoxStyle;
FTopIndex: integer; FTopIndex: integer;
@ -383,6 +384,9 @@ type
procedure SetStyle(Val : TListBoxStyle); virtual; procedure SetStyle(Val : TListBoxStyle); virtual;
procedure DrawItem(Index: Integer; ARect: TRect; procedure DrawItem(Index: Integer; ARect: TRect;
State: TOwnerDrawState); virtual; State: TOwnerDrawState); virtual;
property OnMeasureItem: TMeasureItemEvent
read FOnMeasureItem write FOnMeasureItem;
public public
constructor Create(AOwner : TComponent); override; constructor Create(AOwner : TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -391,6 +395,7 @@ type
function ItemRect(Index: Integer): TRect; function ItemRect(Index: Integer): TRect;
function ItemVisible(Index: Integer): boolean; function ItemVisible(Index: Integer): boolean;
procedure MakeCurrentVisible; procedure MakeCurrentVisible;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
procedure Clear; procedure Clear;
public public
property Align; property Align;
@ -1544,6 +1549,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.143 2004/05/21 11:13:18 micha
add measureitem to tcustomlistbox just like tcustomcombobox has
Revision 1.142 2004/05/21 09:03:54 micha Revision 1.142 2004/05/21 09:03:54 micha
implement new borderstyle implement new borderstyle
- centralize to twincontrol (protected) - centralize to twincontrol (protected)