Skip to content

IScreenObject Interface

A generic object processed by SadConsole. Provides parent/child, components, position, and input callbacks.

C#
public interface IScreenObject : IPositionable, IComponentHost

Indicates the sorting order this object should use when parented. Sorting is a manual operation on the Children collection.

C#
uint SortOrder { get; set; }

How the object should handle becoming active.

C#
FocusBehavior FocusedMode { get; set; }

A position that’s based on the current SadRogue.Primitives.IPositionable.Position, as interpreted by the implementing class, in pixels.

C#
Point AbsolutePosition { get; }

Most objects will implement this property based on SadRogue.Primitives.IPositionable.Position which usually depends on the Parent object’s position.

When true, this object should ignore it’s parent position when calculating AbsolutePosition; otherwise false.

C#
bool IgnoreParentPosition { get; set; }

The child objects of this instance.

C#
ScreenObjectCollection Children { get; }

Gets or sets the visibility of this object.

C#
bool IsEnabled { get; set; }

Gets or sets whether or not this object has exclusive access to the mouse events.

C#
bool IsExclusiveMouse { get; set; }

Gets or sets this console as the focused object for input.

C#
bool IsFocused { get; set; }

Gets or sets the visibility of this object.

C#
bool IsVisible { get; set; }

The parent object that this instance is a child of.

C#
IScreenObject? Parent { get; set; }

When true, this object will use the keyboard; otherwise false.

C#
bool UseKeyboard { get; set; }

When true, this object will use the mouse; otherwise false.

C#
bool UseMouse { get; set; }

Draws all SadComponents and Children.

C#
void Render(TimeSpan delta)

delta TimeSpan
The time that has elapsed since the last call.

Only processes if IsVisible is true.

Called when this object is focused.

C#
void OnFocused()

Called when this object’s focus has been lost.

C#
void OnFocusLost()

Called by the engine to process the keyboard.

C#
bool ProcessKeyboard(Keyboard keyboard)

keyboard Keyboard
Keyboard information.

bool
True when the keyboard had data and this console did something with it.

Processes the mouse.

C#
bool ProcessMouse(MouseScreenObjectState state)

state MouseScreenObjectState
The mouse state related to this object.

bool
True when this object should halt further mouse processing..

Called when the mouse is being used by something else.

C#
void LostMouse(MouseScreenObjectState state)

state MouseScreenObjectState
The current state of the mouse based on this object.

Updates all SadComponents and Children.

C#
void Update(TimeSpan delta)

delta TimeSpan
The time that has elapsed since the last call.

Only processes if IsEnabled is true.

Sets a value for AbsolutePosition based on the SadRogue.Primitives.IPositionable.Position of this instance and the Parent instance.

C#
void UpdateAbsolutePosition()

Raised when the IsEnabled property changes.

C#
event EventHandler IsEnabledChanged

EventHandler

Raised when the Parent property changes.

C#
event EventHandler<ValueChangedEventArgs<IScreenObject?>> ParentChanged

EventHandler<ValueChangedEventArgs<IScreenObject>>

Raised when the IsVisible property changes.

C#
event EventHandler IsVisibleChanged

EventHandler

Raised when the IsFocused property is false.

C#
event EventHandler FocusLost

EventHandler

Raised when the IsFocused property is true.

C#
event EventHandler Focused

EventHandler