mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 07:18:16 +02:00
improved TListView.SetItemVisible from Andrew Haines
git-svn-id: trunk@5948 -
This commit is contained in:
parent
69059885b0
commit
20cfc9e471
@ -645,7 +645,7 @@ type
|
||||
procedure SetColumns(const AValue: TListColumns);
|
||||
procedure SetDefaultItemHeight(AValue: integer);
|
||||
procedure SetItems(const AValue : TListItems);
|
||||
procedure SetItemVisible(const Avalue: TListItem);
|
||||
procedure SetItemVisible(const Avalue: TListItem; const PartialOK: Boolean);
|
||||
procedure SetMultiSelect(const AValue: Boolean);
|
||||
procedure SetSmallImages(const AValue: TCustomImageList);
|
||||
procedure SetScrollBars(const Value: TScrollStyle);
|
||||
@ -2456,6 +2456,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.146 2004/09/08 23:05:35 mattias
|
||||
improved TListView.SetItemVisible from Andrew Haines
|
||||
|
||||
Revision 1.145 2004/09/08 22:59:54 mattias
|
||||
started TTabControl
|
||||
|
||||
|
@ -243,10 +243,12 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView SetItemVisible }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.SetItemVisible(const AValue : TListItem);
|
||||
procedure TCustomListView.SetItemVisible(const AValue : TListItem;
|
||||
const PartialOK: Boolean);
|
||||
begin
|
||||
if (not HandleAllocated) or (csLoading in ComponentState) then exit;
|
||||
TWSCustomListViewClass(WidgetSetClass).ItemShow(Self, AValue.Index, AValue);
|
||||
TWSCustomListViewClass(WidgetSetClass).ItemShow(
|
||||
Self, AValue.Index, AValue, PartialOK);
|
||||
end;
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView Delete }
|
||||
@ -613,6 +615,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.40 2004/09/08 23:05:35 mattias
|
||||
improved TListView.SetItemVisible from Andrew Haines
|
||||
|
||||
Revision 1.39 2004/07/24 00:00:33 mattias
|
||||
started TCollectionPropertyEditor
|
||||
|
||||
|
@ -520,7 +520,7 @@ procedure TListItem.MakeVisible(PartialOK: Boolean);
|
||||
begin
|
||||
if (FOwner <> nil)
|
||||
and (FOwner.Fowner <> nil)
|
||||
then FOwner.FOwner.SetItemVisible(Self);
|
||||
then FOwner.FOwner.SetItemVisible(Self, PartialOK);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -564,6 +564,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.20 2004/09/08 23:05:35 mattias
|
||||
improved TListView.SetItemVisible from Andrew Haines
|
||||
|
||||
Revision 1.19 2004/07/14 15:57:53 mattias
|
||||
fixed 1.0.10 compilation from Vincent
|
||||
|
||||
|
@ -94,7 +94,7 @@ type
|
||||
class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
|
||||
class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
|
||||
class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); override;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -727,10 +727,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem);
|
||||
procedure TGtkWSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean);
|
||||
var
|
||||
WidgetInfo: PWidgetInfo;
|
||||
CListWidget: PGtkCList;
|
||||
RowTopY: Integer;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'ItemShow')
|
||||
then Exit;
|
||||
@ -738,11 +739,28 @@ begin
|
||||
WidgetInfo := GetWidgetInfo(Pointer(ALV.Handle));
|
||||
CListWidget := PGtkCList(WidgetInfo^.CoreWidget);
|
||||
|
||||
RowTopY := (CListWidget^.row_height * AIndex) + ((AIndex +1) *
|
||||
{CELL} 1 {SPACING} + CListWidget^.voffset);
|
||||
|
||||
// 0=NotVisible
|
||||
// 1=PartiallyVisible
|
||||
// 2=Fully Visible
|
||||
if gtk_clist_row_is_visible(CListWidget, AIndex) < 2
|
||||
then gtk_clist_moveto(CListWidget, AIndex, 0, 1, 0);
|
||||
// |
|
||||
if gtk_clist_row_is_visible(CListWidget, AIndex) < (2 - Ord(PartialOK)) then begin
|
||||
if (RowTopY + CListWidget^.row_height > CListWidget^.clist_window_height) then begin
|
||||
gtk_clist_moveto (CListWidget, AIndex, -1, 1, 0);
|
||||
// | | | |
|
||||
// The Row | | |
|
||||
// The Column | |
|
||||
// Row Align |
|
||||
end // Column Align
|
||||
else if (RowTopY < 0) then begin
|
||||
gtk_clist_moveto (CListWidget, AIndex, -1, 0, 0);
|
||||
end;// |
|
||||
end; // |
|
||||
// |
|
||||
// 0 = your row will be at the top.
|
||||
// 1 = it will be at the bottom.
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
|
@ -86,7 +86,7 @@ type
|
||||
class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); override;
|
||||
class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); override;
|
||||
class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); override;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); override;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSListView }
|
||||
@ -440,12 +440,12 @@ begin
|
||||
ListView_SetItemText(ALV.Handle, AIndex, ASubIndex, PChar(AText));
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem);
|
||||
procedure TWin32WSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean);
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'ItemShow')
|
||||
then Exit;
|
||||
|
||||
ListView_EnsureVisible(ALV.Handle, AIndex, 1);
|
||||
ListView_EnsureVisible(ALV.Handle, AIndex, Ord(PartialOK));
|
||||
end;
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ type
|
||||
class procedure ItemSetImage(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex, AImageIndex: Integer); virtual;
|
||||
class procedure ItemSetState(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const AState: TListItemState; const AIsSet: Boolean); virtual;
|
||||
class procedure ItemSetText(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const ASubIndex: Integer; const AText: String); virtual;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem); virtual;
|
||||
class procedure ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean); virtual;
|
||||
end;
|
||||
|
||||
{ TWSListView }
|
||||
@ -219,7 +219,7 @@ procedure TWSCustomListView.ItemSetText(const ALV: TCustomListView; const AIndex
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem);
|
||||
procedure TWSCustomListView.ItemShow(const ALV: TCustomListView; const AIndex: Integer; const AItem: TListItem; const PartialOK: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user