Panel class Core

A control that holds others: the one place for what every container does alike. It keeps its children in one list (handed out without a copy), adds their layout print to its own, hit tests them in tree order before itself, and draws only those that reach into the surface's clip. A derived panel lays them out (Control.Measure, Control.Arrange) and draws its own face before them (Panel.RenderFace).

Invariants. A panel changes its children through Panel.AddChild, Panel.ClearChildren or Panel.EnsureChildren only, and says so to the host (Control.TreeChanged) once it is adopted. Hit test and render go over the same children in the same order, filtered by the same rule (Panel.ShowsChild).

public abstract class Panel : Control
Namespace
ArionUI.Presentation.Controls
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease
Inherits
Control

Constructors

Panel

protected Panel();

Properties

ChildCount

protected int ChildCount { get; }

How many children the panel holds now, without building any (Panel.EnsureChildren asks it to know whether it built them).

ChildList

protected Panel.ChildView ChildList { get; }

The children, in tree order, built if the panel builds them late - to read: a derived panel changes them through Panel.AddChild and Panel.ClearChildren only, so the host hears of every change.

Children

public sealed override IEnumerable<Control> Children { get; }

The controls inside this one, in tree order (visual order, tab order). A host keeps the tree it adopted: a control whose children change once it is adopted says so with Control.TreeChanged (on a shown board inside Board.Mutate), or its new children get no host and Tab, ticks and the wheel do not find them.

HitsSelf

protected virtual bool HitsSelf { get; }

Whether a press where no child answers lands on the panel itself (a list that takes drops, a chip); false: the panel is transparent there.

Methods

AddChild

protected void AddChild(Control child);

Adds a child at the end.

ClearChildren

protected void ClearChildren();

Takes every child away.

EnsureChildren

protected virtual void EnsureChildren();

A panel that builds its children when first asked (from init-only properties) does it here, through Panel.AddChild; called before every read of the children.

HitsChild

protected virtual bool HitsChild(Control child);

Whether a child that takes part answers presses itself; false leaves its area to the panel (a list's header and placeholder belong to the list).

HitTest

public override Control? HitTest(LogPoint p);

The control under an ABSOLUTE point, or null. Containers recurse; leaves answer for themselves. Same bounds the render pass used.

Render

public override void Render(IRenderSurface s, ControlFrame frame);

RenderChildren

protected void RenderChildren(IRenderSurface s, ControlFrame frame);

Draws the children that take part and reach into the clip - a child wholly outside it (a long column scrolled, a strip of it redrawn) is not asked to draw.

RenderFace

protected virtual void RenderFace(IRenderSurface s, ControlFrame frame);

What the panel draws under its children: its box, its own parts. Nothing by default.

RenderOver

protected virtual void RenderOver(IRenderSurface s, ControlFrame frame);

What the panel draws over its children (an insertion line). Nothing by default.

ShowsChild

protected virtual bool ShowsChild(Control child);

Whether child takes part now - drawn and hit; every visible child by default. A panel that shows some parts only in some states (a chip's actions while it is hovered) says so here, for both at once.

SizeBuffer

protected double[] SizeBuffer(int count);

A buffer of at least count sizes, kept between layouts: what a pass measured once and uses again in the same pass (each child measured once per pass, not once per walk).

Nested types

Panel.ChildView struct
The children of a panel, read only: an index, a count and a foreach that takes no enumerator from the heap - the paths that read them run every frame.