[SHELL-EXPERIMENTS]
[reactos.git] / base / setup / usetup / genlist.c
index d93d952..6e5a736 100644 (file)
@@ -84,8 +84,9 @@ CreateGenericList(VOID)
 
 
 VOID
-DestroyGenericList(PGENERIC_LIST List,
-                   BOOLEAN FreeUserData)
+DestroyGenericList(
+    PGENERIC_LIST List,
+    BOOLEAN FreeUserData)
 {
     PGENERIC_LIST_ENTRY ListEntry;
     PLIST_ENTRY Entry;
@@ -110,10 +111,11 @@ DestroyGenericList(PGENERIC_LIST List,
 
 
 BOOLEAN
-AppendGenericListEntry(PGENERIC_LIST List,
-                     PCHAR Text,
-                     PVOID UserData,
-                     BOOLEAN Current)
+AppendGenericListEntry(
+    PGENERIC_LIST List,
+    PCHAR Text,
+    PVOID UserData,
+    BOOLEAN Current)
 {
     PGENERIC_LIST_ENTRY Entry;
 
@@ -139,8 +141,10 @@ AppendGenericListEntry(PGENERIC_LIST List,
 }
 
 
-static VOID
-DrawListFrame(PGENERIC_LIST GenericList)
+static
+VOID
+DrawListFrame(
+    PGENERIC_LIST GenericList)
 {
     COORD coPos;
     DWORD Written;
@@ -221,8 +225,10 @@ DrawListFrame(PGENERIC_LIST GenericList)
 }
 
 
-static VOID
-DrawListEntries(PGENERIC_LIST GenericList)
+static
+VOID
+DrawListEntries(
+    PGENERIC_LIST GenericList)
 {
     PGENERIC_LIST_ENTRY ListEntry;
     PLIST_ENTRY Entry;
@@ -286,8 +292,11 @@ DrawListEntries(PGENERIC_LIST GenericList)
     }
 }
 
-static VOID
-DrawScrollBarGenericList(PGENERIC_LIST GenericList)
+
+static
+VOID
+DrawScrollBarGenericList(
+    PGENERIC_LIST GenericList)
 {
     COORD coPos;
     DWORD Written;
@@ -331,12 +340,14 @@ DrawScrollBarGenericList(PGENERIC_LIST GenericList)
     }
 }
 
+
 VOID
-DrawGenericList(PGENERIC_LIST List,
-                SHORT Left,
-                SHORT Top,
-                SHORT Right,
-                SHORT Bottom)
+DrawGenericList(
+    PGENERIC_LIST List,
+    SHORT Left,
+    SHORT Top,
+    SHORT Right,
+    SHORT Bottom)
 {
     List->FirstShown = List->ListHead.Flink;
     List->Left = Left;
@@ -353,8 +364,10 @@ DrawGenericList(PGENERIC_LIST List,
     DrawScrollBarGenericList(List);
 }
 
+
 VOID
-ScrollPageDownGenericList (PGENERIC_LIST List)
+ScrollPageDownGenericList(
+    PGENERIC_LIST List)
 {
     SHORT i;
 
@@ -374,8 +387,10 @@ ScrollPageDownGenericList (PGENERIC_LIST List)
     List->Redraw = TRUE;
 }
 
+
 VOID
-ScrollPageUpGenericList (PGENERIC_LIST List)
+ScrollPageUpGenericList(
+    PGENERIC_LIST List)
 {
     SHORT i;
 
@@ -395,8 +410,10 @@ ScrollPageUpGenericList (PGENERIC_LIST List)
     List->Redraw = TRUE;
 }
 
+
 VOID
-ScrollDownGenericList (PGENERIC_LIST List)
+ScrollDownGenericList(
+    PGENERIC_LIST List)
 {
     PLIST_ENTRY Entry;
 
@@ -423,12 +440,14 @@ ScrollDownGenericList (PGENERIC_LIST List)
 
 
 VOID
-ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex)
+ScrollToPositionGenericList(
+    PGENERIC_LIST List,
+    ULONG uIndex)
 {
     PLIST_ENTRY Entry;
     ULONG uCount = 0;
 
-    if (List->CurrentEntry == NULL)
+    if (List->CurrentEntry == NULL || uIndex == 0)
         return;
 
     do
@@ -456,7 +475,8 @@ ScrollToPositionGenericList (PGENERIC_LIST List, ULONG uIndex)
 
 
 VOID
-ScrollUpGenericList (PGENERIC_LIST List)
+ScrollUpGenericList(
+    PGENERIC_LIST List)
 {
     PLIST_ENTRY Entry;
 
@@ -483,7 +503,24 @@ ScrollUpGenericList (PGENERIC_LIST List)
 
 
 VOID
-SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry)
+RedrawGenericList(
+    PGENERIC_LIST List)
+{
+    if (List->CurrentEntry == NULL)
+        return;
+
+    if (List->Redraw)
+    {
+        DrawListEntries(List);
+        DrawScrollBarGenericList(List);
+    }
+}
+
+
+VOID
+SetCurrentListEntry(
+    PGENERIC_LIST List,
+    PGENERIC_LIST_ENTRY Entry)
 {
     if (Entry->List != List)
         return;
@@ -492,14 +529,16 @@ SetCurrentListEntry(PGENERIC_LIST List, PGENERIC_LIST_ENTRY Entry)
 
 
 PGENERIC_LIST_ENTRY
-GetCurrentListEntry(PGENERIC_LIST List)
+GetCurrentListEntry(
+    PGENERIC_LIST List)
 {
     return List->CurrentEntry;
 }
 
 
 PGENERIC_LIST_ENTRY
-GetFirstListEntry(PGENERIC_LIST List)
+GetFirstListEntry(
+    PGENERIC_LIST List)
 {
     PLIST_ENTRY Entry = List->ListHead.Flink;
 
@@ -510,7 +549,8 @@ GetFirstListEntry(PGENERIC_LIST List)
 
 
 PGENERIC_LIST_ENTRY
-GetNextListEntry(PGENERIC_LIST_ENTRY Entry)
+GetNextListEntry(
+    PGENERIC_LIST_ENTRY Entry)
 {
     PLIST_ENTRY Next = Entry->Entry.Flink;
 
@@ -521,21 +561,25 @@ GetNextListEntry(PGENERIC_LIST_ENTRY Entry)
 
 
 PVOID
-GetListEntryUserData(PGENERIC_LIST_ENTRY List)
+GetListEntryUserData(
+    PGENERIC_LIST_ENTRY List)
 {
     return List->UserData;
 }
 
 
 LPCSTR
-GetListEntryText(PGENERIC_LIST_ENTRY List)
+GetListEntryText(
+    PGENERIC_LIST_ENTRY List)
 {
     return List->Text;
 }
 
 
 VOID
-GenericListKeyPress (PGENERIC_LIST GenericList, CHAR AsciChar)
+GenericListKeyPress(
+    PGENERIC_LIST GenericList,
+    CHAR AsciChar)
 {
     PGENERIC_LIST_ENTRY ListEntry;
     PGENERIC_LIST_ENTRY OldListEntry;
@@ -595,14 +639,16 @@ End:
 
 
 VOID
-SaveGenericListState(PGENERIC_LIST List)
+SaveGenericListState(
+    PGENERIC_LIST List)
 {
     List->BackupEntry = List->CurrentEntry;
 }
 
 
 VOID
-RestoreGenericListState(PGENERIC_LIST List)
+RestoreGenericListState(
+    PGENERIC_LIST List)
 {
     List->CurrentEntry = List->BackupEntry;
 }