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

#include <resizable_shell.hpp>

Public Member Functions

 ResizableShell (ResizableShellConfig cfg={})
 Construct with a config.
Size negotiate (Size requested) const
 Intended size → clamped to [min, max] and (when aspect is locked) snapped to the nearest aspect-correct rectangle.
Size apply (Size requested)
 Commit the new size. Returns the clamped size actually applied.
Size current () const
const ResizableShellConfig & config () const
std::vector< uint8_t > serialize () const
 Serialize the saved size to 8 bytes (little-endian u32 w, h).
bool deserialize (std::span< const uint8_t > blob)
 Restore from a blob produced by serialize().

Constructor & Destructor Documentation

◆ ResizableShell()

pulp::view::ResizableShell::ResizableShell ( ResizableShellConfig cfg = {})
inlineexplicit

Construct with a config.

current() is seeded by passing cfg.initial_size through negotiate(), so a misconfigured initial (outside min/max or violating aspect) reports the clamped size from the very first call — callers can never observe an invalid state. Fix per #206 review.

Member Function Documentation

◆ apply()

Size pulp::view::ResizableShell::apply ( Size requested)
inline

Commit the new size. Returns the clamped size actually applied.

◆ config()

const ResizableShellConfig & pulp::view::ResizableShell::config ( ) const
inline

◆ current()

Size pulp::view::ResizableShell::current ( ) const
inline

◆ deserialize()

bool pulp::view::ResizableShell::deserialize ( std::span< const uint8_t > blob)

Restore from a blob produced by serialize().

Returns false on short buffer or malformed payload. On success the size is also renegotiated through the current config so out-of-range saves (e.g. exported from a wider min/max) are clamped cleanly.

◆ negotiate()

Size pulp::view::ResizableShell::negotiate ( Size requested) const

Intended size → clamped to [min, max] and (when aspect is locked) snapped to the nearest aspect-correct rectangle.

◆ serialize()

std::vector< uint8_t > pulp::view::ResizableShell::serialize ( ) const

Serialize the saved size to 8 bytes (little-endian u32 w, h).

Plugins concatenate this with their parameter blob so the host's state round-trip restores the window size too.


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