#pragma once #include #include "Subsurface.hpp" #include "View.hpp" #include "../../helpers/signal/Signal.hpp" #include "../../helpers/memory/Memory.hpp" #include "../../helpers/AnimatedVariable.hpp" class CXDGPopupResource; namespace Desktop::View { class CPopup : public IView { public: // dummy head nodes static SP create(PHLWINDOW pOwner); static SP create(PHLLS pOwner); // real nodes static SP create(SP popup, WP pOwner); static SP fromView(SP); virtual ~CPopup(); virtual eViewType type() const; virtual bool visible() const; virtual std::optional logicalBox() const; virtual bool desktopComponent() const; virtual std::optional surfaceLogicalBox() const; SP getT1Owner() const; Vector2D coordsRelativeToParent() const; Vector2D coordsGlobal() const; PHLMONITOR getMonitor() const; Vector2D size() const; void onNewPopup(SP popup); void onDestroy(); void onMap(); void onUnmap(); void onCommit(bool ignoreSiblings = false); void onReposition(); void recheckTree(); bool inert() const; // will also loop over this node void breadthfirst(std::function, void*)> fn, void* data); SP at(const Vector2D& globalCoords, bool allowsInput = false); // WP m_self; bool m_mapped = false; // fade in-out PHLANIMVAR m_alpha; bool m_fadingOut = false; private: CPopup(); // T1 owners, each popup has to have one of these PHLWINDOWREF m_windowOwner; PHLLSREF m_layerOwner; // T2 owners WP m_parent; WP m_resource; Vector2D m_lastSize = {}; Vector2D m_lastPos = {}; bool m_requestedReposition = false; bool m_inert = false; // std::vector> m_children; SP m_subsurfaceHead; struct { CHyprSignalListener newPopup; CHyprSignalListener destroy; CHyprSignalListener map; CHyprSignalListener unmap; CHyprSignalListener commit; CHyprSignalListener dismissed; CHyprSignalListener reposition; } m_listeners; void initAllSignals(); void reposition(); void recheckChildrenRecursive(); void sendScale(); void fullyDestroy(); Vector2D localToGlobal(const Vector2D& rel) const; Vector2D t1ParentCoords() const; static void bfHelper(std::vector> const& nodes, std::function, void*)> fn, void* data); }; }