Skip to content

Commit

Permalink
Added setter for DoesListItemsHaveFocus on ListBox
Browse files Browse the repository at this point in the history
Added SetTileShapeCollection in CollidableListVsTileShapeCollectionRelationship.
  • Loading branch information
vchelaru committed Dec 23, 2023
1 parent 5126172 commit ca1cbb5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -146,6 +151,10 @@ public int SelectedIndex
/// </summary>
public event Action<object, SelectionChangedEventArgs> SelectionChanged;
public event FocusUpdateDelegate FocusUpdate;

/// <summary>
/// Event raised when the user presses a button at the top-level (if the list box has focus, but the individual items do not)
/// </summary>
public event Action<Xbox360GamePad.Button> ControllerButtonPushed;
public event Action<int> GenericGamepadButtonPushed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,19 @@ public class CollidableListVsTileShapeCollectionRelationship<FirstCollidableT> :

public CollidableListVsTileShapeCollectionRelationship(PositionedObjectList<FirstCollidableT> list, TileShapeCollection tileShapeCollection)
{
data = new CollidableVsTileShapeCollectionData<FirstCollidableT>(tileShapeCollection);
SetTileShapeCollection(tileShapeCollection);
this.list = list;
}

/// <summary>
/// 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.
/// </summary>
/// <param name="tileShapeCollection"></param>
public void SetTileShapeCollection(TileShapeCollection tileShapeCollection)
{
data = new CollidableVsTileShapeCollectionData<FirstCollidableT>(tileShapeCollection);
}

public override bool DoCollisions()
{
bool didCollisionOccur = false;
Expand Down

0 comments on commit ca1cbb5

Please sign in to comment.