From ca1cbb58fdcf017c430128fac93935efca654e1a Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Sat, 23 Dec 2023 11:06:25 -0700 Subject: [PATCH] Added setter for DoesListItemsHaveFocus on ListBox Added SetTileShapeCollection in CollidableListVsTileShapeCollectionRelationship. --- .../FlatRedBall.Forms.Shared/Controls/ListBox.cs | 11 ++++++++++- ...CollidableListVsTileShapeCollectionRelationship.cs | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/ListBox.cs b/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/ListBox.cs index c1fd513f1..7488715f6 100644 --- a/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/ListBox.cs +++ b/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.Shared/Controls/ListBox.cs @@ -23,8 +23,13 @@ public class ListBox : ItemsControl , IInputReceiver public bool DoListItemsHaveFocus { get => doListBoxItemsHaveFocus; - private set + set { + if(!IsFocused && value) + { + IsFocused = true; + } + doListBoxItemsHaveFocus = value; if (SelectedIndex > -1 && SelectedIndex < ListBoxItemsInternal.Count) @@ -146,6 +151,10 @@ public int SelectedIndex /// public event Action SelectionChanged; public event FocusUpdateDelegate FocusUpdate; + + /// + /// Event raised when the user presses a button at the top-level (if the list box has focus, but the individual items do not) + /// public event Action ControllerButtonPushed; public event Action GenericGamepadButtonPushed; diff --git a/FRBDK/Glue/TileGraphicsPlugin/TileGraphicsPlugin/EmbeddedCodeFiles/CollidableListVsTileShapeCollectionRelationship.cs b/FRBDK/Glue/TileGraphicsPlugin/TileGraphicsPlugin/EmbeddedCodeFiles/CollidableListVsTileShapeCollectionRelationship.cs index 53d96f3aa..1ca48f376 100644 --- a/FRBDK/Glue/TileGraphicsPlugin/TileGraphicsPlugin/EmbeddedCodeFiles/CollidableListVsTileShapeCollectionRelationship.cs +++ b/FRBDK/Glue/TileGraphicsPlugin/TileGraphicsPlugin/EmbeddedCodeFiles/CollidableListVsTileShapeCollectionRelationship.cs @@ -31,10 +31,19 @@ public class CollidableListVsTileShapeCollectionRelationship : public CollidableListVsTileShapeCollectionRelationship(PositionedObjectList list, TileShapeCollection tileShapeCollection) { - data = new CollidableVsTileShapeCollectionData(tileShapeCollection); + SetTileShapeCollection(tileShapeCollection); this.list = list; } + /// + /// Sets the TileShapeCollection used by this CollisionRelationship. This is automatically called by the constructor, so it should only be manually called to change the TileShapeCollection after this relationship has been created. + /// + /// + public void SetTileShapeCollection(TileShapeCollection tileShapeCollection) + { + data = new CollidableVsTileShapeCollectionData(tileShapeCollection); + } + public override bool DoCollisions() { bool didCollisionOccur = false;