mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 04:53:29 +01:00
Made the Element.Children collection public
This commit is contained in:
parent
fb3b586a35
commit
3a055129b5
5 changed files with 7 additions and 6 deletions
|
@ -33,6 +33,7 @@ Improvements
|
||||||
- **Include the SpriteBatchContext in OnDrawn, OnElementDrawn and OnSelectedElementDrawn**
|
- **Include the SpriteBatchContext in OnDrawn, OnElementDrawn and OnSelectedElementDrawn**
|
||||||
- Allow scrolling panels to set height based on children by setting TreatSizeAsMaximum
|
- Allow scrolling panels to set height based on children by setting TreatSizeAsMaximum
|
||||||
- Track element area update recursion count in UiMetrics
|
- Track element area update recursion count in UiMetrics
|
||||||
|
- Made the Element.Children collection public
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed hidden scroll bars inhibiting scrolling on their parent panel
|
- Fixed hidden scroll bars inhibiting scrolling on their parent panel
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Demos {
|
||||||
this.activeDemo = null;
|
this.activeDemo = null;
|
||||||
selection.IsHidden = false;
|
selection.IsHidden = false;
|
||||||
e.IsHidden = true;
|
e.IsHidden = true;
|
||||||
selection.Root.SelectElement(selection.GetChildren().First(c => c.CanBeSelected));
|
selection.Root.SelectElement(selection.Children.First(c => c.CanBeSelected));
|
||||||
},
|
},
|
||||||
IsHidden = true
|
IsHidden = true
|
||||||
});
|
});
|
||||||
|
|
|
@ -254,9 +254,9 @@ namespace Demos {
|
||||||
this.root.AddChild(new VerticalSpace(3));
|
this.root.AddChild(new VerticalSpace(3));
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "The code for this demo contains some examples for how to query element data. This is the output of that:"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "The code for this demo contains some examples for how to query element data. This is the output of that:"));
|
||||||
|
|
||||||
var children = this.root.GetChildren();
|
var children = this.root.Children;
|
||||||
var totalChildren = this.root.GetChildren(regardGrandchildren: true);
|
var totalChildren = this.root.GetChildren(regardGrandchildren: true);
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{children.Count()}</b> children, but there are <b>{totalChildren.Count()}</b> when regarding children's children"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{children.Count}</b> children, but there are <b>{totalChildren.Count()}</b> when regarding children's children"));
|
||||||
|
|
||||||
var textFields = this.root.GetChildren<TextField>();
|
var textFields = this.root.GetChildren<TextField>();
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{textFields.Count()}</b> text fields"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{textFields.Count()}</b> text fields"));
|
||||||
|
@ -270,7 +270,7 @@ namespace Demos {
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{autoWidthChildren.Count()}</b> auto-width children, <b>{autoWidthButtons.Count()}</b> of which are buttons"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{autoWidthChildren.Count()}</b> auto-width children, <b>{autoWidthButtons.Count()}</b> of which are buttons"));
|
||||||
|
|
||||||
// select the first element for auto-navigation
|
// select the first element for auto-navigation
|
||||||
this.root.Root.SelectElement(this.root.GetChildren().First(c => c.CanBeSelected));
|
this.root.Root.SelectElement(this.root.Children.First(c => c.CanBeSelected));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is used by the wobbling button (see above)
|
// This method is used by the wobbling button (see above)
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace MLEM.Ui.Elements {
|
||||||
this.GetGamepadNextElement = (dir, usualNext) => {
|
this.GetGamepadNextElement = (dir, usualNext) => {
|
||||||
// Force navigate down to our first child if we're open
|
// Force navigate down to our first child if we're open
|
||||||
if (this.IsOpen && dir == Direction2.Down)
|
if (this.IsOpen && dir == Direction2.Down)
|
||||||
return this.Panel.GetChildren().FirstOrDefault(c => c.CanBeSelected) ?? usualNext;
|
return this.Panel.Children.FirstOrDefault(c => c.CanBeSelected) ?? usualNext;
|
||||||
return usualNext;
|
return usualNext;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,7 +497,7 @@ namespace MLEM.Ui.Elements {
|
||||||
/// A list of all of this element's direct children.
|
/// A list of all of this element's direct children.
|
||||||
/// Use <see cref="AddChild{T}"/> or <see cref="RemoveChild"/> to manipulate this list while calling all of the necessary callbacks.
|
/// Use <see cref="AddChild{T}"/> or <see cref="RemoveChild"/> to manipulate this list while calling all of the necessary callbacks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly IList<Element> Children;
|
public readonly IList<Element> Children;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of all of the <see cref="UiAnimation"/> instances that are currently playing.
|
/// A list of all of the <see cref="UiAnimation"/> instances that are currently playing.
|
||||||
/// You can modify this collection through <see cref="PlayAnimation"/> and <see cref="StopAnimation"/>.
|
/// You can modify this collection through <see cref="PlayAnimation"/> and <see cref="StopAnimation"/>.
|
||||||
|
|
Loading…
Reference in a new issue