Raxol.Terminal.Window.Manager (Raxol v2.0.1)
View SourceRefactored Window.Manager that delegates to GenServer implementation.
This module provides the same API as the original Terminal.Window.Manager but uses a supervised GenServer instead of the Process dictionary for state management.
Migration Notice
This module is a drop-in replacement for Raxol.Terminal.Window.Manager.
All functions maintain backward compatibility while providing improved
fault tolerance and functional programming patterns.
Benefits over Process Dictionary
- Supervised state management with fault tolerance
- Pure functional window management
- Z-order window stacking support
- Spatial navigation mapping
- Better debugging and testing capabilities
- No global state pollution
New Features
- Window Z-ordering for proper stacking
- Spatial position tracking for navigation
- Custom navigation paths between windows
- Hierarchical window relationships
Summary
Functions
Cleanup the window manager. Alias for reset/0.
Counts the number of windows.
Creates a child window.
Creates a new window with the given configuration.
Creates a new window with dimensions.
Defines a navigation path between windows.
Destroys a window by ID.
Ensures the Window Manager server is started.
Gets the active window.
Gets child windows of a parent.
Gets the parent window of a child.
Gets the window manager state as a map.
Gets a window by ID.
Gets the window size.
Gets the window state.
Lists all windows.
Move a window to the specified position.
Moves a window to the back (bottom of Z-order).
Moves a window to the front (top of Z-order).
Creates a new window manager instance. For backward compatibility, returns {:ok, pid()} of the GenServer.
Creates a new window manager instance for testing. Returns a simple map structure instead of a process.
Registers a window's spatial position for navigation.
Resets the window manager to initial state.
Resizes a window. Alias for set_window_size/3.
Sets the active window.
Sets the icon name.
Set the stacking order of a window.
Set the title of a window.
Sets the window position.
Sets the window size.
Sets the window state.
Sets the window title.
Split a window horizontally or vertically.
Starts the window manager.
Updates the window manager configuration.
Checks if a window exists.
Types
Functions
Cleanup the window manager. Alias for reset/0.
Counts the number of windows.
@spec create_child_window(window_id(), Raxol.Terminal.Config.t()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, term()}
Creates a child window.
@spec create_window(Raxol.Terminal.Config.t()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, term()}
Creates a new window with the given configuration.
@spec create_window(integer(), integer()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, term()}
Creates a new window with dimensions.
@spec destroy_window(window_id()) :: :ok | {:error, :not_found}
Destroys a window by ID.
Ensures the Window Manager server is started.
Gets the active window.
@spec get_child_windows(window_id()) :: {:ok, [Raxol.Terminal.Window.t()]} | {:error, :not_found}
Gets child windows of a parent.
@spec get_parent_window(window_id()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found | :no_parent}
Gets the parent window of a child.
Gets the window manager state as a map.
@spec get_window(window_id()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Gets a window by ID.
Gets the window size.
Gets the window state.
@spec list_windows() :: {:ok, [Raxol.Terminal.Window.t()]}
Lists all windows.
Move a window to the specified position.
Moves a window to the back (bottom of Z-order).
Moves a window to the front (top of Z-order).
@spec new() :: {:ok, pid()}
Creates a new window manager instance. For backward compatibility, returns {:ok, pid()} of the GenServer.
@spec new_for_test() :: map()
Creates a new window manager instance for testing. Returns a simple map structure instead of a process.
Registers a window's spatial position for navigation.
Resets the window manager to initial state.
@spec resize(window_id(), integer(), integer()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Resizes a window. Alias for set_window_size/3.
Sets the active window.
Sets the icon name.
Set the stacking order of a window.
Set the title of a window.
@spec set_window_position(window_id(), integer(), integer()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Sets the window position.
@spec set_window_size(pid(), integer(), integer()) :: :ok
@spec set_window_size(window_id(), integer(), integer()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Sets the window size.
@spec set_window_state(pid(), atom()) :: :ok
@spec set_window_state(window_id(), window_state()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Sets the window state.
@spec set_window_title(pid(), String.t()) :: :ok
@spec set_window_title(window_id(), String.t()) :: {:ok, Raxol.Terminal.Window.t()} | {:error, :not_found}
Sets the window title.
Split a window horizontally or vertically.
@spec start_link() :: {:ok, pid()}
Starts the window manager.
Updates the window manager configuration.
Checks if a window exists.