ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
Popup.hpp File Reference

An anchored floating panel with close-on-outside and close-on-Escape. More...

#include "Common.hpp"
#include "Layout.hpp"
#include "Layouts.hpp"

Go to the source code of this file.

Classes

class  ZenitUI::UI::Popup
 A floating, anchored panel. More...

Functions

std::shared_ptr< Popup > ZenitUI::UI::ContextMenu (std::vector< std::pair< std::string, std::function< void()> > > items)
 Convenience factory: a vertical context menu popup.

Detailed Description

An anchored floating panel with close-on-outside and close-on-Escape.

A Popup is a Panel subclass that:

  • sets portal = true (draws and hit-tests above everything else);
  • is hidden by default (enabled = false, opacity = 0);
  • on open, sizes itself to its content's measured size and positions itself adjacent to an anchor widget (or at a screen position);
  • auto-flips above / below the anchor when there is not enough room;
  • closes itself on outside-click or Escape when configured to do so.