Skip to content

CompositeControl Class

Base class for controls that host and render other controls.

C#
public abstract class CompositeControl : ControlBase, IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable

Inheritance objectControlBase

Implements IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable

Creates a new control with the specified width and height.

C#
public CompositeControl(int width, int height)

width int
Width of the control in cells.

height int
Height of the control in cells.

C#
protected bool MouseLastHandledByChild

The controls this composite control is hosting. Use AddControl(ControlBase) and RemoveControl(ControlBase) to manage the collection.

C#
protected List<ControlBase> Controls

The controls added which contain a Name value.

C#
protected Dictionary<string, ControlBase> NamedControls
C#
public int Count { get; }
C#
protected ControlBase this[int index] { get; }

Create each control and add it to Controls.

C#
protected virtual void CreateChildControls()

Processes the mouse on each control hosted by this control.

C#
public override bool ProcessMouse(MouseScreenObjectState state)

state MouseScreenObjectState
The mouse state based on the parent screen object.

bool
true when a control processes the mouse; otherwise false.

Called when the mouse exits the area of the control. Raises the MouseExit event and calls the DetermineState() method.

C#
protected override void OnMouseExit(ControlBase.ControlMouseState state)

state ControlBase.ControlMouseState
The current mouse data

Adds a child control to this control.

C#
protected void AddControl(ControlBase control)

control ControlBase
The control to add.

Removes a child control from this control.

C#
protected void RemoveControl(ControlBase control)

control ControlBase
The control to remove.

Updates each control hosted by this control.

C#
public override void UpdateAndRedraw(TimeSpan time)

time TimeSpan
The game frame time delta.