reactos/base/setup/lib/utils/genlist.h
Hermès Bélusca-Maïto 1f4cb0977a
[SETUPLIB][USETUP] Don't store UI-related display strings in GENERIC_LIST_ENTRY-ies, + other code adaptations.
- Apart from allowing a UI cache variable that may be used when
  displaying GENERIC_LIST_ENTRY-ies, do not store any display strings
  associated to these list entries. They should be instead computed only
  when initializing a list UI (or a combo-box or list control if the
  code is used in Win32 environment).
  For this matter a callback is provided to InitGenericListUi() that
  does the job of computing the displayed string corresponding to a
  given GENERIC_LIST_ENTRY.

- Simplify the calls to InitGenericListUi(), and refactor the
  RestoreGenericListUiState() function.

- Use for-loops for iterating over GENERIC_LIST items.

- Adapt the storage data format for lists of settings items.

- The txtsetup.sif INF format specified in LoadSetupInf() should not be
  INF_STYLE_WIN4 (to be investigated...).
2018-10-28 01:32:15 +02:00

74 lines
1.4 KiB
C

/*
* PROJECT: ReactOS Setup Library
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Generic list functions
* COPYRIGHT: Copyright 2008-2018 Christoph von Wittich <christoph at reactos.org>
*/
#pragma once
typedef struct _GENERIC_LIST_ENTRY
{
LIST_ENTRY Entry;
struct _GENERIC_LIST* List;
PVOID Data;
ULONG_PTR UiData; // Cache variable for any UI list that displays these items
} GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY;
typedef struct _GENERIC_LIST
{
LIST_ENTRY ListHead;
ULONG NumOfEntries;
PGENERIC_LIST_ENTRY CurrentEntry;
} GENERIC_LIST, *PGENERIC_LIST;
PGENERIC_LIST
CreateGenericList(VOID);
VOID
DestroyGenericList(
IN OUT PGENERIC_LIST List,
IN BOOLEAN FreeData);
BOOLEAN
AppendGenericListEntry(
IN OUT PGENERIC_LIST List,
IN PVOID Data,
IN BOOLEAN Current);
VOID
SetCurrentListEntry(
IN PGENERIC_LIST List,
IN PGENERIC_LIST_ENTRY Entry);
PGENERIC_LIST_ENTRY
GetCurrentListEntry(
IN PGENERIC_LIST List);
PGENERIC_LIST_ENTRY
GetFirstListEntry(
IN PGENERIC_LIST List);
PGENERIC_LIST_ENTRY
GetNextListEntry(
IN PGENERIC_LIST_ENTRY Entry);
PVOID
GetListEntryData(
IN PGENERIC_LIST_ENTRY Entry);
ULONG_PTR
GetListEntryUiData(
IN PGENERIC_LIST_ENTRY Entry);
ULONG
GetNumberOfListEntries(
IN PGENERIC_LIST List);
BOOLEAN
GenericListHasSingleEntry(
IN PGENERIC_LIST List);
/* EOF */