Files
PalUIExtension/Api/Overlay.hpp

35 lines
1.4 KiB
C++
Raw Normal View History

2026-09-07 19:33:58 -04:00
#pragma once
#include "PanelWidget.hpp"
#include "OverlaySlot.hpp"
namespace PalUIExtension::Api
{
// UOverlay : public UPanelWidget directly (confirmed by the header --
// no ContentWidget rung to skip here, unlike SizeBox). Every generic
// panel operation -- AddChild, GetChildAt, GetAllChildren,
// GetChildObjects -- is already on PanelWidget and works unchanged;
// AddChildToOverlay below is the one thing Overlay adds beyond that,
// and it exists only because the engine returns the concrete
// UOverlaySlot* type instead of the generic UPanelSlot* AddChild()
// returns, so you get typed access to Padding/Alignment without an
// extra cast.
class Overlay : public PanelWidget
{
public:
static auto ClassPath() -> const TCHAR* { return STR("/Script/UMG.Overlay"); }
static auto DebugTag() -> const TCHAR* { return STR("Overlay"); }
Overlay() = default;
explicit Overlay(UObject* Obj)
: PanelWidget(Obj, ClassOf<Overlay>(), DebugTag()) {}
auto AddChildToOverlay(UObject* Content) -> OverlaySlot
{
struct P { UObject* Content; UObject* ReturnValue; } p{ Content, nullptr };
auto Result = CallForReturn(STR("AddChildToOverlay"), p, &P::ReturnValue);
return (Result && *Result) ? OverlaySlot{ *Result } : OverlaySlot{};
}
};
}