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

Sized action-backed popup plane, owned by one private managed Dialog activation. Use ui::popupMenu as an initially closed scene layer. One Ref observes this real Menu subtype; removal through ManagedScene removes its private root as well. No command store or scheduler is added. More...

#include <popup_menu.hpp>

Inheritance diagram for portals::PopupMenu:
portals::PopupMenuportals::PopupMenu portals::Menu portals::Control portals::SizedWidget portals::Widget portals::LayoutItem

Public Member Functions

 PopupMenu (GraphemeText empty, const std::vector< PopupEntry > &entries, const std::vector< ui::ActionRef > &leaves, PopupMenuOptions options, Node< Dialog > layer, ControlStyle style={}, SizePolicy policy=DEFAULT_MENU_POLICY)
 Internal construction path after checked popup admission.
std::expected< CellSize, TreeError > measure (CellSize available) override
std::expected< void, TreeError > arrange (CellRect local) override
std::expected< void, TreeError > paint (PaintContext &context) override
Node< Dialog > dialogRoot () const noexcept
std::size_t panelCount () const noexcept
std::optional< std::size_t > selectedIndex () const noexcept override
std::size_t visibleRowCount () const noexcept override
void resetSelection () noexcept
 Reset local selection before a new managed activation; no callback or tree access.
Public Member Functions inherited from portals::Menu
 Menu (GraphemeText empty, const std::vector< ui::ActionRef > &actions, MenuOptions options={}, ControlStyle style={}, SizePolicy policy=DEFAULT_MENU_POLICY)
Public Member Functions inherited from portals::Control
const GraphemeText & text () const
 Inspect the control's owning Unicode text on UI.
bool focused () const
 Inspect the last synchronized focus presentation on UI.
bool enabled () const
 Inspect the last synchronized subtree eligibility presentation on UI.
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.
virtual void unmount ()
 Called once before destruction, children first; cleanup continues on exceptions.
virtual bool styleReadOnly () const noexcept
 Read actual view-only state during style staging; false by default.
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.

Additional Inherited Members

Protected Member Functions inherited from portals::Control
 Control (GraphemeText text, std::string_view prefix, std::string_view suffix, ControlStyle style, SizePolicy policy)
 Own text/options and create fixed ASCII decorations under the text's validated width policy.
 Control (GraphemeText text, GraphemeText prefix, GraphemeText checkedPrefix, ControlStyle style, SizePolicy policy)
 Own explicitly validated equal-width boolean decorations; no additional retained fields.
bool booleanChromeMatches () const
std::expected< void, TreeError > paintCaption (PaintContext &context, bool stretchChrome)
 Paint the synchronized caption with intrinsic or allocated-width decorations.
void showChecked (bool checked)
 Select a same-width prefix between frames; used only by the checkbox binding.
bool shownChecked () const
 Inspect the single checked presentation flag on UI.
void showMixed (bool mixed)
 Select the fixed mixed decoration after caller-owned paint invalidation.

Detailed Description

Sized action-backed popup plane, owned by one private managed Dialog activation. Use ui::popupMenu as an initially closed scene layer. One Ref observes this real Menu subtype; removal through ManagedScene removes its private root as well. No command store or scheduler is added.

Constructor & Destructor Documentation

◆ PopupMenu()

portals::PopupMenu::PopupMenu ( GraphemeText empty,
const std::vector< PopupEntry > & entries,
const std::vector< ui::ActionRef > & leaves,
PopupMenuOptions options,
Node< Dialog > layer,
ControlStyle style = {},
SizePolicy policy = DEFAULT_MENU_POLICY )

Internal construction path after checked popup admission.

Precondition
Entries, leaf mapping and frame options were validated under the empty text width policy. Use ui::popupMenu for checked user-facing construction; allocation failures propagate.
Parameters
emptyValid empty text using the scene width policy.
entriesOwning immutable tree, copied before publication.
leavesAll leaf occurrences used by the existing shared presenter admission.
optionsPositive finite construction/paint geometry budgets.
layerPrivate existing Dialog root carrying input confinement and focus return.
styleManual row styles below the scene theme.
policyOrdinary content/min/max/flex policy on the transparent popup plane.

Member Function Documentation

◆ arrange()

std::expected< void, TreeError > portals::PopupMenu::arrange ( CellRect local)
overridevirtual
Parameters
localAllocated plane rectangle.
Returns
Checked panel placement without tree access.

Reimplemented from portals::Menu.

◆ dialogRoot()

Node< Dialog > portals::PopupMenu::dialogRoot ( ) const
noexcept
Returns
Private structural layer observer, without ownership or implicit activation.

◆ measure()

std::expected< CellSize, TreeError > portals::PopupMenu::measure ( CellSize available)
overridevirtual
Parameters
availableOffered plane extent.
Returns
Prepared content extent capped by available space.

Reimplemented from portals::Menu.

◆ paint()

std::expected< void, TreeError > portals::PopupMenu::paint ( PaintContext & context)
overridevirtual
Parameters
contextSynchronous frame sink.
Returns
Separately painted opaque panels with transparent gaps.

Reimplemented from portals::Menu.

◆ panelCount()

std::size_t portals::PopupMenu::panelCount ( ) const
noexcept
Returns
Prepared panels in the current navigation path, regardless of Dialog visibility.

◆ selectedIndex()

std::optional< std::size_t > portals::PopupMenu::selectedIndex ( ) const
overridevirtualnoexcept
Returns
Selection in the active panel's original entry order, or empty.

Reimplemented from portals::Menu.

◆ visibleRowCount()

std::size_t portals::PopupMenu::visibleRowCount ( ) const
overridevirtualnoexcept
Returns
Number of visible rows in the active panel, before viewport clipping.

Reimplemented from portals::Menu.


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