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;
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;

View File

@ -182,12 +182,12 @@ var
begin
with TLMMouseEvent(Message) do
begin
WParam := Windows.WParam(ScrollInfo.nPos - (WheelDelta * Integer(ScrollInfo.nPage) * 4) div (120 * 10));
if WParam > ScrollInfo.nMax then
WParam := ScrollInfo.nMax;
if WParam < ScrollInfo.nMin then
WParam := ScrollInfo.nMin;
WParam := SB_THUMBPOSITION or (WParam shl 16);
WParam := Windows.WParam(ScrollInfo.nPos - (WheelDelta * Integer(ScrollInfo.nPage) * 4) div (120 * 10));
if WParam > ScrollInfo.nMax then
WParam := ScrollInfo.nMax;
if WParam < ScrollInfo.nMin then
WParam := ScrollInfo.nMin;
WParam := SB_THUMBPOSITION or (WParam shl 16);
end;
Windows.PostMessage(TWinControl(Sender).Handle, WM_VSCROLL, WParam, HWND(nil));
end;
@ -349,11 +349,11 @@ begin
with TLMMeasureItem(Message).MeasureItemStruct^ do
begin
if Sender is TCustomListBox then
begin
itemHeight := TCustomListBox(Sender).ItemHeight;
// if TCustomListBox(Sender).Style = lbOwnerDrawVariable then
// TCustomListBox(Sender).MeasureItem(itemID, integer(itemHeight));
end;
begin
itemHeight := TCustomListBox(Sender).ItemHeight;
if TCustomListBox(Sender).Style = lbOwnerDrawVariable then
TCustomListBox(Sender).MeasureItem(itemID, integer(itemHeight));
end;
end;
end;
@ -2996,6 +2996,9 @@ end;
{ =============================================================================
$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
* Fixed win32 listview

View File

@ -351,6 +351,7 @@ type
FItemHeight: Integer;
FItemIndex: integer;
FOnDrawItem: TDrawItemEvent;
FOnMeasureItem: TMeasureItemEvent;
FSorted: boolean;
FStyle: TListBoxStyle;
FTopIndex: integer;
@ -383,6 +384,9 @@ type
procedure SetStyle(Val : TListBoxStyle); virtual;
procedure DrawItem(Index: Integer; ARect: TRect;
State: TOwnerDrawState); virtual;
property OnMeasureItem: TMeasureItemEvent
read FOnMeasureItem write FOnMeasureItem;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
@ -391,6 +395,7 @@ type
function ItemRect(Index: Integer): TRect;
function ItemVisible(Index: Integer): boolean;
procedure MakeCurrentVisible;
procedure MeasureItem(Index: Integer; var TheHeight: Integer); virtual;
procedure Clear;
public
property Align;
@ -1544,6 +1549,9 @@ end.
{ =============================================================================
$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
implement new borderstyle
- centralize to twincontrol (protected)