cherry-pick: Fix missing scrollbars in Admin Player List window (upstream #40525) (#5028)

Fix missing scrollbars in Admin Player List window (#40525)

* Fix missing scrollbars in Admin Player List window

* Revert "Fix missing scrollbars in Admin Player List window"

This reverts commit c5aea1a0550deb1d1d7aae4e2dec964e93d2d8ae.

* Invalidate cached item height when item generation callback changes

Signed-off-by: DisposableCrewmember42 <disposablecrewmember42@proton.me>
Co-authored-by: eoineoineoin <helloworld@eoinrul.es>
This commit is contained in:
DisposableCrewmember42 2025-12-24 11:16:26 +00:00 committed by GitHub
parent d00e19f4b1
commit b5ae2263a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -27,7 +27,16 @@ public class ListContainer : Control
/// Called when creating a button on the UI.
/// The provided <see cref="ListContainerButton"/> is the generated button that Controls should be parented to.
/// </summary>
public Action<ListData, ListContainerButton>? GenerateItem;
public Action<ListData, ListContainerButton>? GenerateItem
{
get => _generateItem;
set {
_generateItem = value;
// Invalidate _itemHeight so we recalculate the size of children the next
// time PopulateList() is called
_itemHeight = 0;
}
}
/// <inheritdoc cref="BaseButton.OnPressed"/>
public Action<BaseButton.ButtonEventArgs, ListData>? ItemPressed;
@ -58,6 +67,7 @@ public class ListContainer : Control
private bool _updateChildren = false;
private bool _suppressScrollValueChanged;
private ButtonGroup? _buttonGroup;
public Action<ListData, ListContainerButton>? _generateItem;
public int ScrollSpeedY { get; set; } = 50;