mirror of
https://github.com/reactos/reactos.git
synced 2025-05-15 07:17:23 +00:00
[USETUP]
Center the current list item before drawing the list. #CORE-10659 #resolve svn path=/trunk/; revision=70287
This commit is contained in:
parent
ebb8c660f4
commit
dd58b4a93f
1 changed files with 47 additions and 0 deletions
|
@ -341,6 +341,51 @@ DrawScrollBarGenericList(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
CenterCurrentListItem(
|
||||||
|
PGENERIC_LIST List)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY Entry;
|
||||||
|
ULONG MaxVisibleItems, ItemCount, i;
|
||||||
|
|
||||||
|
if ((List->Top == 0 && List->Bottom == 0) ||
|
||||||
|
IsListEmpty(&List->ListHead) ||
|
||||||
|
List->CurrentEntry == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MaxVisibleItems = (ULONG)(List->Bottom - List->Top - 1);
|
||||||
|
|
||||||
|
ItemCount = 0;
|
||||||
|
Entry = List->ListHead.Flink;
|
||||||
|
while (Entry != &List->ListHead)
|
||||||
|
{
|
||||||
|
ItemCount++;
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ItemCount > MaxVisibleItems)
|
||||||
|
{
|
||||||
|
Entry = &List->CurrentEntry->Entry;
|
||||||
|
for (i = 0; i < MaxVisibleItems / 2; i++)
|
||||||
|
{
|
||||||
|
if (Entry->Blink != &List->ListHead)
|
||||||
|
Entry = Entry->Blink;
|
||||||
|
}
|
||||||
|
|
||||||
|
List->FirstShown = Entry;
|
||||||
|
|
||||||
|
for (i = 0; i < MaxVisibleItems; i++)
|
||||||
|
{
|
||||||
|
if (Entry->Flink != &List->ListHead)
|
||||||
|
Entry = Entry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
List->LastShown = Entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DrawGenericList(
|
DrawGenericList(
|
||||||
PGENERIC_LIST List,
|
PGENERIC_LIST List,
|
||||||
|
@ -360,6 +405,8 @@ DrawGenericList(
|
||||||
if (IsListEmpty(&List->ListHead))
|
if (IsListEmpty(&List->ListHead))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
CenterCurrentListItem(List);
|
||||||
|
|
||||||
DrawListEntries(List);
|
DrawListEntries(List);
|
||||||
DrawScrollBarGenericList(List);
|
DrawScrollBarGenericList(List);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue