Class CompositeControl
Base class for controls that host and render other controls.
Implements
Inherited Members
Namespace: SadConsole.UI.Controls
Assembly: SadConsole.dll
Syntax
public abstract class CompositeControl : ControlBase, IContainer, IList<ControlBase>, ICollection<ControlBase>, IEnumerable<ControlBase>, IEnumerable
Constructors
CompositeControl(int, int)
Creates a new control with the specified width and height.
Declaration
public CompositeControl(int width, int height)
Parameters
| Type | Name | Description |
|---|---|---|
| int | width | Width of the control in cells. |
| int | height | Height of the control in cells. |
Fields
Controls
The controls this composite control is hosting. Use AddControl(ControlBase) and RemoveControl(ControlBase) to manage the collection.
Declaration
protected List<ControlBase> Controls
Field Value
| Type | Description |
|---|---|
| List<ControlBase> |
MouseLastHandledByChild
Declaration
protected bool MouseLastHandledByChild
Field Value
| Type | Description |
|---|---|
| bool |
NamedControls
The controls added which contain a Name value.
Declaration
protected Dictionary<string, ControlBase> NamedControls
Field Value
| Type | Description |
|---|---|
| Dictionary<string, ControlBase> |
Properties
Count
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
this[int]
Declaration
protected ControlBase this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type | Description |
|---|---|
| ControlBase |
Methods
AddControl(ControlBase)
Adds a child control to this control.
Declaration
protected void AddControl(ControlBase control)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlBase | control | The control to add. |
CreateChildControls()
Create each control and add it to Controls.
Declaration
protected virtual void CreateChildControls()
OnMouseExit(ControlMouseState)
Called when the mouse exits the area of the control. Raises the MouseExit event and calls the DetermineState() method.
Declaration
protected override void OnMouseExit(ControlBase.ControlMouseState state)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlBase.ControlMouseState | state | The current mouse data |
Overrides
ProcessMouse(MouseScreenObjectState)
Processes the mouse on each control hosted by this control.
Declaration
public override bool ProcessMouse(MouseScreenObjectState state)
Parameters
| Type | Name | Description |
|---|---|---|
| MouseScreenObjectState | state | The mouse state based on the parent screen object. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
RemoveControl(ControlBase)
Removes a child control from this control.
Declaration
protected void RemoveControl(ControlBase control)
Parameters
| Type | Name | Description |
|---|---|---|
| ControlBase | control | The control to remove. |
UpdateAndRedraw(TimeSpan)
Updates each control hosted by this control.
Declaration
public override void UpdateAndRedraw(TimeSpan time)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | time | The game frame time delta. |