Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::DocumentView Class Reference

Read-only retained document viewport; source I/O, decoding and layout run on application workers. Construct with ui::viewer for automatic scene-owned preparation. Paint only consumes immutable frames. Raw tree emplacement provides an empty viewport until a managed source is attached. More...

#include <document_view.hpp>

Inheritance diagram for portals::DocumentView:
portals::DocumentViewportals::DocumentView portals::ScrollArea portals::SizedWidget portals::Layout portals::Widget portals::LayoutItem

Public Member Functions

 DocumentView (WidthPolicy width={}, DocumentViewConfig config={}, ControlStyle style={}, FrameOptions frame={}, std::optional< ScrollAreaOptions > scroll={})
 ~DocumentView () override
 Release bounded UI ownership without joining background work.
std::expected< CellSize, TreeError > measureChildren (std::span< const MeasuredChild > children) const override
std::expected< void, TreeError > paint (PaintContext &context) override
bool styleReadOnly () const noexcept override
Public Member Functions inherited from portals::ScrollArea
 ScrollArea (std::shared_ptr< ScrollController > controller={}, WidthPolicy width={}, ScrollAreaOptions options={}, ControlStyle style={}, SizePolicy policy={})
 ScrollArea (std::shared_ptr< ScrollController > controller, WidthPolicy width, ScrollAreaOptions options, ControlStyle style, SizePolicy policy, FrameOptions frame, std::in_place_t advanced)
 Construct an area with an owning advanced frame, compiled before initialization.
 ~ScrollArea () override
 Release owning values; no user callback or terminal operation occurs.
void unmount () override
 Retire this node's lease and pointer token before destruction.
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< CellSize, TreeError > childAvailable (CellSize available) const override
std::expected< CellSize, TreeError > measureChildren (std::span< const MeasuredChild > children) const override
std::expected< void, TreeError > arrange (CellRect local) override
std::expected< CellRect, TreeError > childClip (CellSize available) const override
std::expected< std::vector< CellRect >, TreeError > arrangeChildren (std::span< const MeasuredChild > children, CellSize available) const override
std::expected< void, TreeError > paint (PaintContext &context) override
ComputedStyle styleDefaults () const override
Public Member Functions inherited from portals::SizedWidget
 SizedWidget (SizePolicy policy={})
 Own the supplied policies; checked by layout.
SizePolicy sizePolicy () const override
 Copy current policy without borrowing storage.
Public Member Functions inherited from portals::Widget
virtual ~Widget ()=default
 Destroy on UI after the last active tree borrow.
virtual void mount ()
 Called exactly once after attachment; exceptions are reported.
const std::shared_ptr< const StyleSnapshot > & computedStyle () const noexcept
 Inspect the last atomically installed theme inside tree.read/frame.
std::uint64_t styleRevision () const noexcept
Public Member Functions inherited from portals::LayoutItem
virtual ~LayoutItem ()=default
 Destroy with the implementing widget.
Public Member Functions inherited from portals::Layout
virtual ~Layout ()=default
 Destroy with the implementing widget.
virtual std::expected< LayoutChildPolicy, TreeError > childLayoutFor (NodeId child, CellSize available) const
 Describe one child's clip and reveal policy after arrangeChildren.

Friends

struct detail::DocumentViewAccess

Detailed Description

Read-only retained document viewport; source I/O, decoding and layout run on application workers. Construct with ui::viewer for automatic scene-owned preparation. Paint only consumes immutable frames. Raw tree emplacement provides an empty viewport until a managed source is attached.

Constructor & Destructor Documentation

◆ DocumentView()

portals::DocumentView::DocumentView ( WidthPolicy width = {},
DocumentViewConfig config = {},
ControlStyle style = {},
FrameOptions frame = {},
std::optional< ScrollAreaOptions > scroll = {} )
explicit
Parameters
widthImmutable terminal width policy.
configBounded preparation settings.
styleManual appearances beneath theme rules.
frameOwning standard frame options.
scrollOptional native scroll input/chrome overrides; absent selects viewer defaults.
Exceptions
std::bad_allocOn construction allocation before mounting.

Member Function Documentation

◆ measureChildren()

std::expected< CellSize, TreeError > portals::DocumentView::measureChildren ( std::span< const MeasuredChild > children) const
overridevirtual
Parameters
childrenMust be empty.
Returns
Prepared intrinsic extent or INVALID_ARGUMENT.

Implements portals::Layout.

◆ paint()

std::expected< void, TreeError > portals::DocumentView::paint ( PaintContext & context)
overridevirtual
Parameters
contextBorrowed renderer.
Returns
Existing frame/sink error; never reads or parses a source.

Reimplemented from portals::Widget.

◆ styleReadOnly()

bool portals::DocumentView::styleReadOnly ( ) const
inlineoverridevirtualnoexcept
Returns
True for the read-only style selector.

Reimplemented from portals::Widget.


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