[USETUP] Additions for generic lists.

- Allow retrieving the number of items existing in the list;
- Fix the name of some function parameters.

svn path=/branches/setup_improvements/; revision=74547
This commit is contained in:
Hermès Bélusca-Maïto 2017-05-15 01:43:28 +00:00
parent 2521d3c478
commit 199fb91939
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 24 additions and 8 deletions

View file

@ -45,6 +45,7 @@ typedef struct _GENERIC_LIST_ENTRY
typedef struct _GENERIC_LIST
{
LIST_ENTRY ListHead;
ULONG NumOfEntries;
PLIST_ENTRY FirstShown;
PLIST_ENTRY LastShown;
@ -70,6 +71,7 @@ CreateGenericList(VOID)
return NULL;
InitializeListHead(&List->ListHead);
List->NumOfEntries = 0;
List->Left = 0;
List->Top = 0;
@ -78,6 +80,7 @@ CreateGenericList(VOID)
List->Redraw = TRUE;
List->CurrentEntry = NULL;
List->BackupEntry = NULL;
return List;
}
@ -131,6 +134,7 @@ AppendGenericListEntry(
InsertTailList(&List->ListHead,
&Entry->Entry);
List->NumOfEntries++;
if (Current || List->CurrentEntry == NULL)
{
@ -609,17 +613,25 @@ GetNextListEntry(
PVOID
GetListEntryUserData(
PGENERIC_LIST_ENTRY List)
PGENERIC_LIST_ENTRY Entry)
{
return List->UserData;
return Entry->UserData;
}
LPCSTR
GetListEntryText(
PGENERIC_LIST_ENTRY List)
PGENERIC_LIST_ENTRY Entry)
{
return List->Text;
return Entry->Text;
}
ULONG
GetNumberOfListEntries(
PGENERIC_LIST List)
{
return List->NumOfEntries;
}

View file

@ -98,11 +98,15 @@ GetNextListEntry(
PVOID
GetListEntryUserData(
PGENERIC_LIST_ENTRY List);
PGENERIC_LIST_ENTRY Entry);
LPCSTR
GetListEntryText(
PGENERIC_LIST_ENTRY List);
PGENERIC_LIST_ENTRY Entry);
ULONG
GetNumberOfListEntries(
PGENERIC_LIST List);
VOID
SaveGenericListState(
@ -114,8 +118,8 @@ RestoreGenericListState(
VOID
GenericListKeyPress(
PGENERIC_LIST List,
CHAR AsciChar);
PGENERIC_LIST GenericList,
CHAR AsciiChar);
BOOL
GenericListHasSingleEntry(