Class BaseProxyLayoutEngine
- Namespace
- Whim
- Assembly
- Whim.dll
Abstract layout engine, which proxy layout engines should inherit from.
public abstract record BaseProxyLayoutEngine : ILayoutEngine, IEquatable<BaseProxyLayoutEngine>
- Inheritance
-
BaseProxyLayoutEngine
- Implements
- Derived
- Inherited Members
Remarks
Proxy layout engines are layout engines that wrap another layout engine.
Proxy layout engines are useful for adding additional functionality to a layout engine.
For example, the
Whim.Gaps
plugin uses a proxy layout engine to add gaps to a layout engine.
Proxy layout engine tests should extend the Whim.TestUtils.ProxyLayoutEngineBaseTests
class, to verify they do not break in common scenarios.Constructors
BaseProxyLayoutEngine(ILayoutEngine)
Creates a new with the given
innerLayoutEngine
.protected BaseProxyLayoutEngine(ILayoutEngine innerLayoutEngine)
Parameters
innerLayoutEngine
ILayoutEngine
Properties
Count
The number of windows in the layout engine.
public abstract int Count { get; }
Property Value
Identity
The identity of the layout engine.
public LayoutEngineIdentity Identity { get; }
Property Value
InnerLayoutEngine
The proxied layout engine.
protected ILayoutEngine InnerLayoutEngine { get; }
Property Value
Name
The name is only really important for the user, so we can use the name of the proxied layout engine.
public string Name { get; }
Property Value
Methods
AddWindow(IWindow)
Adds a
window
to the layout engine.public abstract ILayoutEngine AddWindow(IWindow window)
Parameters
window
IWindow
Returns
- ILayoutEngine
- The new ILayoutEngine after the add.
ContainsEqual(ILayoutEngine)
Checks to see if this
or a child layout engine is equal to
layoutEngine
.public bool ContainsEqual(ILayoutEngine layoutEngine)
Parameters
layoutEngine
ILayoutEngine- The layout engine to check for.
Returns
- bool
if the layout engine is found, otherwise.
ContainsWindow(IWindow)
Determines whether the layout engine contains the
window
.public abstract bool ContainsWindow(IWindow window)
Parameters
window
IWindow
Returns
- bool
- True if the layout engine contains the
window
, otherwise false.
DoLayout(IRectangle<int>, IMonitor)
Performs a layout inside the available
rectangle
.public abstract IEnumerable<IWindowState> DoLayout(IRectangle<int> rectangle, IMonitor monitor)
Parameters
rectangle
IRectangle<int>- The available area to do a layout inside.
monitor
IMonitor- The monitor which the layout is being done for.
Returns
- IEnumerable<IWindowState>
- The layout result.
Remarks
For a given
rectangle
, the layout engine should return the same
result every time.FocusWindowInDirection(Direction, IWindow)
Focuses the
window
in the direction
.
It's recommended that this method is not called directly, but rather
through the FocusWindowInDirection(Direction, IWindow?, bool) method.public abstract ILayoutEngine FocusWindowInDirection(Direction direction, IWindow window)
Parameters
Returns
GetFirstWindow()
Retrieves the first window in the layout engine.
public abstract IWindow? GetFirstWindow()
Returns
GetLayoutEngine<T>()
Checks to see if this
or a child layout engine is type
T
.public T? GetLayoutEngine<T>() where T : ILayoutEngine
Returns
- T
- The layout engine with type
T
, or null if none is found.
Type Parameters
T
- The type of layout engine to check for.
MinimizeWindowEnd(IWindow)
Called when a window is being unminimized - i.e., the window size will no longer be
Minimized.
The layout engine can choose to ignore this call, if it does not support unminimizing
windows.
public abstract ILayoutEngine MinimizeWindowEnd(IWindow window)
Parameters
window
IWindow
Returns
MinimizeWindowStart(IWindow)
Called when a window is being minimized - i.e., the window size will become
Minimized.
The layout engine can choose to ignore this call, if it does not support minimizing
windows.
public abstract ILayoutEngine MinimizeWindowStart(IWindow window)
Parameters
window
IWindow
Returns
MoveWindowEdgesInDirection(Direction, IPoint<double>, IWindow)
Moves the focused window's edges by the specified
deltas
.public abstract ILayoutEngine MoveWindowEdgesInDirection(Direction edge, IPoint<double> deltas, IWindow window)
Parameters
edge
Directiondeltas
IPoint<double>- The deltas to change the given
edges
by. Thedeltas
are in the range [0, 1] for both x and y (the unit square). window
IWindow
Returns
- ILayoutEngine
- The new ILayoutEngine after the move.
MoveWindowToPoint(IWindow, IPoint<double>)
Move the
window
to the point
.
The point has a coordinate space of [0, 1] for both x and y.public abstract ILayoutEngine MoveWindowToPoint(IWindow window, IPoint<double> point)
Parameters
Returns
- ILayoutEngine
- The new ILayoutEngine after the move.
PerformCustomAction<T>(LayoutEngineCustomAction<T>)
Attempts to trigger a custom action in a layout engine.
public abstract ILayoutEngine PerformCustomAction<T>(LayoutEngineCustomAction<T> action)
Parameters
action
LayoutEngineCustomAction<T>- Metadata about the action to perform, and the payload to perform it with.
Returns
- ILayoutEngine
- A new layout engine if the action is handled, otherwise it returns the current layout engine.
Type Parameters
T
- The type of the
action
's payload.
Remarks
This method is used to handle custom actions that are not part of the
ILayoutEngine interface.
For example, the SliceLayoutEngine uses this method to promote/demote windows in the
window stack.
RemoveWindow(IWindow)
Removes a
window
from the layout engine.public abstract ILayoutEngine RemoveWindow(IWindow window)
Parameters
window
IWindow
Returns
- ILayoutEngine
- The new ILayoutEngine after the remove.
SwapWindowInDirection(Direction, IWindow)
Swaps the
window
in the direction
.
It's recommended that this method is not called directly, but rather
through SwapWindowInDirection(Direction, IWindow?, bool).public abstract ILayoutEngine SwapWindowInDirection(Direction direction, IWindow window)
Parameters
Returns
- ILayoutEngine
- The new ILayoutEngine after the swap.