https://git.reactos.org/?p=reactos.git;a=commitdiff;h=199fb91939fb8d395af504d620f3564dbfca4e51
commit 199fb91939fb8d395af504d620f3564dbfca4e51 Author: Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org> AuthorDate: Mon May 15 01:43:28 2017 +0000 Commit: Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org> CommitDate: Sat May 26 22:45:50 2018 +0200 [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 --- base/setup/usetup/genlist.c | 20 ++++++++++++++++---- base/setup/usetup/genlist.h | 12 ++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/base/setup/usetup/genlist.c b/base/setup/usetup/genlist.c index c6b0b536d1..5f79a906bf 100644 --- a/base/setup/usetup/genlist.c +++ b/base/setup/usetup/genlist.c @@ -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 Entry->Text; +} + + +ULONG +GetNumberOfListEntries( + PGENERIC_LIST List) { - return List->Text; + return List->NumOfEntries; } diff --git a/base/setup/usetup/genlist.h b/base/setup/usetup/genlist.h index 0361d2b888..adc5c5c923 100644 --- a/base/setup/usetup/genlist.h +++ b/base/setup/usetup/genlist.h @@ -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(