Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::WindowManager Class Reference

#include <window_manager.hpp>

Public Member Functions

 WindowManager ()
 ~WindowManager ()
 WindowManager (const WindowManager &)=delete
WindowManager & operator= (const WindowManager &)=delete
WindowId register_window (WindowHost *host, View *root_view, WindowType type, WindowId parent_id=0)
 Register a window with the manager.
void unregister_window (WindowId id)
 Remove a window from the registry.
const WindowRecord * window (WindowId id) const
 Get the record for a window (nullptr if not found).
std::vector< WindowId > window_ids () const
 Get all active window IDs.
std::vector< WindowId > children_of (WindowId parent_id) const
 Get children of a given window.
size_t window_count () const
 Count of active windows.
void close_window (WindowId id)
 Close a window and all its children (depth-first).
void set_on_window_closed (std::function< void(WindowId)> cb)
 Set a callback invoked when a window is about to be unregistered.
void set_shared_theme (const Theme &theme)
 Set the shared theme.
const Theme & shared_theme () const
 Get the current shared theme.
void send_message (WindowId target, const WindowMessage &msg)
 Send a message to a specific window.
void broadcast_message (const WindowMessage &msg)
 Broadcast a message to all windows.
void set_message_handler (WindowId id, MessageHandler handler)
 Register a message handler for a window. Replaces any previous handler.
std::unordered_map< WindowId, WindowState > save_all_states () const
 Snapshot the current state of all windows (positions, sizes, screens).
void restore_state (WindowId id, const WindowState &state)
 Restore window state from a previous snapshot.
void set_shared_gpu_device (void *device_handle)
 Set the shared GPU device handle (Dawn wgpu::Device*).
void * shared_gpu_device () const
 Get the shared GPU device handle. Returns nullptr if not set.

Static Public Member Functions

static std::vector< ScreenInfo > available_screens ()
 Enumerate available screens/monitors. Platform-specific.
static ScreenInfo primary_screen ()
 Get info for the primary screen.
static bool is_multi_window_supported ()
 Whether the current platform supports multi-window.

Constructor & Destructor Documentation

◆ WindowManager() [1/2]

pulp::view::WindowManager::WindowManager ( )

◆ ~WindowManager()

pulp::view::WindowManager::~WindowManager ( )

◆ WindowManager() [2/2]

pulp::view::WindowManager::WindowManager ( const WindowManager & )
delete

Member Function Documentation

◆ available_screens()

std::vector< ScreenInfo > pulp::view::WindowManager::available_screens ( )
static

Enumerate available screens/monitors. Platform-specific.

◆ broadcast_message()

void pulp::view::WindowManager::broadcast_message ( const WindowMessage & msg)

Broadcast a message to all windows.

◆ children_of()

std::vector< WindowId > pulp::view::WindowManager::children_of ( WindowId parent_id) const

Get children of a given window.

◆ close_window()

void pulp::view::WindowManager::close_window ( WindowId id)

Close a window and all its children (depth-first).

Calls request_close() on each WindowHost, then unregisters.

◆ is_multi_window_supported()

bool pulp::view::WindowManager::is_multi_window_supported ( )
static

Whether the current platform supports multi-window.

Returns false on iOS, embedded, or platforms that restrict window creation (some plugin hosts).

◆ operator=()

WindowManager & pulp::view::WindowManager::operator= ( const WindowManager & )
delete

◆ primary_screen()

ScreenInfo pulp::view::WindowManager::primary_screen ( )
static

Get info for the primary screen.

◆ register_window()

WindowId pulp::view::WindowManager::register_window ( WindowHost * host,
View * root_view,
WindowType type,
WindowId parent_id = 0 )

Register a window with the manager.

Returns a unique WindowId. The caller retains ownership of host and root_view.

◆ restore_state()

void pulp::view::WindowManager::restore_state ( WindowId id,
const WindowState & state )

Restore window state from a previous snapshot.

Only applies to windows whose IDs match.

◆ save_all_states()

std::unordered_map< WindowId, WindowState > pulp::view::WindowManager::save_all_states ( ) const

Snapshot the current state of all windows (positions, sizes, screens).

◆ send_message()

void pulp::view::WindowManager::send_message ( WindowId target,
const WindowMessage & msg )

Send a message to a specific window.

◆ set_message_handler()

void pulp::view::WindowManager::set_message_handler ( WindowId id,
MessageHandler handler )

Register a message handler for a window. Replaces any previous handler.

◆ set_on_window_closed()

void pulp::view::WindowManager::set_on_window_closed ( std::function< void(WindowId)> cb)

Set a callback invoked when a window is about to be unregistered.

Useful for cleanup (e.g. saving window state before removal).

◆ set_shared_gpu_device()

void pulp::view::WindowManager::set_shared_gpu_device ( void * device_handle)

Set the shared GPU device handle (Dawn wgpu::Device*).

All windows MUST share the same device. Each window gets its own surface/swapchain on this device. Three.js/WebGPU bridge surfaces also use this shared device.

◆ set_shared_theme()

void pulp::view::WindowManager::set_shared_theme ( const Theme & theme)

Set the shared theme.

Propagates to all registered windows' root views via set_theme().

◆ shared_gpu_device()

void * pulp::view::WindowManager::shared_gpu_device ( ) const

Get the shared GPU device handle. Returns nullptr if not set.

◆ shared_theme()

const Theme & pulp::view::WindowManager::shared_theme ( ) const

Get the current shared theme.

◆ unregister_window()

void pulp::view::WindowManager::unregister_window ( WindowId id)

Remove a window from the registry.

Does NOT destroy the WindowHost — that's the caller's responsibility.

◆ window()

const WindowRecord * pulp::view::WindowManager::window ( WindowId id) const

Get the record for a window (nullptr if not found).

◆ window_count()

size_t pulp::view::WindowManager::window_count ( ) const

Count of active windows.

◆ window_ids()

std::vector< WindowId > pulp::view::WindowManager::window_ids ( ) const

Get all active window IDs.


The documentation for this class was generated from the following file: