Skip to content

Commit

Permalink
Convert to auto-property
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Dec 4, 2023
1 parent 1833630 commit 5bfe0a5
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions osu.Framework/Graphics/UserInterface/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract partial class Menu : CompositeDrawable, IStateful<MenuState>
/// <summary>
/// The <see cref="Container{T}"/> that contains the items of this <see cref="Menu"/>.
/// </summary>
protected FillFlowContainer<DrawableMenuItem> ItemsContainer => itemsFlow;
protected FillFlowContainer<DrawableMenuItem> ItemsContainer { get; private set; }

/// <summary>
/// The container that provides the masking effects for this <see cref="Menu"/>.
Expand All @@ -62,7 +62,6 @@ public abstract partial class Menu : CompositeDrawable, IStateful<MenuState>

protected readonly Direction Direction;

private FillFlowContainer<DrawableMenuItem> itemsFlow;
private Menu parentMenu;
private Menu submenu;

Expand Down Expand Up @@ -102,7 +101,7 @@ protected Menu(Direction direction, bool topLevelMenu = false)
{
d.RelativeSizeAxes = Axes.Both;
d.Masking = false;
d.Child = itemsFlow = (FillFlowContainer<DrawableMenuItem>)CreateItemsFlow(direction == Direction.Horizontal ? FillDirection.Horizontal : FillDirection.Vertical);
d.Child = ItemsContainer = (FillFlowContainer<DrawableMenuItem>)CreateItemsFlow(direction == Direction.Horizontal ? FillDirection.Horizontal : FillDirection.Vertical);
})
}
},
Expand Down Expand Up @@ -182,7 +181,7 @@ public float MaxWidth

maxWidth = value;

((IItemsFlow)itemsFlow).SizeCache.Invalidate();
((IItemsFlow)ItemsContainer).SizeCache.Invalidate();
}
}

Expand All @@ -201,7 +200,7 @@ public float MaxHeight

maxHeight = value;

((IItemsFlow)itemsFlow).SizeCache.Invalidate();
((IItemsFlow)ItemsContainer).SizeCache.Invalidate();
}
}

Expand Down Expand Up @@ -271,7 +270,7 @@ private void resetState()
return;

submenu?.Close();
((IItemsFlow)itemsFlow).SizeCache.Invalidate();
((IItemsFlow)ItemsContainer).SizeCache.Invalidate();
}

/// <summary>
Expand All @@ -288,7 +287,7 @@ public virtual void Add(MenuItem item)
drawableItem.SetFlowDirection(Direction);

ItemsContainer.Add(drawableItem);
((IItemsFlow)itemsFlow).SizeCache.Invalidate();
((IItemsFlow)ItemsContainer).SizeCache.Invalidate();
}

private void itemStateChanged(DrawableMenuItem item, MenuItemState state)
Expand All @@ -308,7 +307,7 @@ private void itemStateChanged(DrawableMenuItem item, MenuItemState state)
public bool Remove(MenuItem item)
{
bool result = ItemsContainer.RemoveAll(d => d.Item == item, true) > 0;
((IItemsFlow)itemsFlow).SizeCache.Invalidate();
((IItemsFlow)ItemsContainer).SizeCache.Invalidate();

return result;
}
Expand Down Expand Up @@ -440,7 +439,7 @@ protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();

if (!((IItemsFlow)itemsFlow).SizeCache.IsValid)
if (!((IItemsFlow)ItemsContainer).SizeCache.IsValid)
{
// Our children will be relatively-sized on the axis separate to the menu direction, so we need to compute
// that size ourselves, based on the content size of our children, to give them a valid relative size
Expand Down Expand Up @@ -474,7 +473,7 @@ protected override void UpdateAfterChildren()

UpdateSize(new Vector2(width, height));

((IItemsFlow)itemsFlow).SizeCache.Validate();
((IItemsFlow)ItemsContainer).SizeCache.Validate();
}
}

Expand Down

0 comments on commit 5bfe0a5

Please sign in to comment.