[USETUP] Additions for generic lists.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 15 May 2017 01:43:28 +0000 (01:43 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 26 May 2018 20:45:50 +0000 (22:45 +0200)
- 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
base/setup/usetup/genlist.h

index c6b0b53..5f79a90 100644 (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 Entry->Text;
+}
+
+
+ULONG
+GetNumberOfListEntries(
+    PGENERIC_LIST List)
 {
-    return List->Text;
+    return List->NumOfEntries;
 }
 
 
index 0361d2b..adc5c5c 100644 (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(